acpica Makefile: Make it possible to pass additional CFLAGS when invoking make
Thomas Renninger
PATCH RESEND 1/2 acpica Makefile: Make it possible to pass additional CFLAGS when invoking make
acpcia: Make it possible to pass additional CFLAGS when invoking make
-D_FORTIFY_SOURCE=2 without -O2 can cause:
--
/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
--
Such compiler flags must be able to get passed when invoking make. OpenSUSE packages require to build binaries with CLFAGS="$RPM_OPT_FLAGS", to make sure debuginfo can be obtained, security/optimization/test flags of the compiler for the distribution built against are passed, etc.
This patch differs between:
1) Optional CFLAGS (OPT_CFLAGS) which have a sane default:
-D_FORTIFY_SOURCE=2 -O2 and warning flags These will get replaced if OPT_CFLAGS= are passed via make OPT_CFLAGS=".." invokation
2) Elementary CFLAGS (-I includes, -Dxy, ...) which are mandatory for a successful compile run
--- generate/unix/Makefile.config | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
generate/unix/Makefile.config +6 -2
@@ -38,7 +38,7 @@ CC = gcc OBJDIR = obj$(BITS) BINDIR = bin$(BITS) BITSFLAG = -m$(BITS) -COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< +COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $< LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) INSTALLDIR = /usr/bin INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
@@ -103,11 +103,15 @@ ACPICA_HEADERS = \ # Common compiler flags. The warning flags in addition to -Wall are not # automatically included in -Wall. # +OPT_CFLAGS ?= \ + -D_FORTIFY_SOURCE=2 -O2 \ + $(CWARNINGFLAGS) + CFLAGS += \ + $(OPT_CFLAGS) \ $(BITSFLAG) \ -D$(HOST) \ -D_GNU_SOURCE \ - -D_FORTIFY_SOURCE=2 \ -I$(ACPICA_INCLUDE) LDFLAGS += $(BITSFLAG)
acpcia: Make it possible to pass additional CFLAGS when invoking make
-D_FORTIFY_SOURCE=2 without -O2 can cause:
--
/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
--
Such compiler flags must be able to get passed when invoking make. OpenSUSE packages require to build binaries with CLFAGS="$RPM_OPT_FLAGS", to make sure debuginfo can be obtained, security/optimization/test flags of the compiler for the distribution built against are passed, etc.
This patch differs between:
1) Optional CFLAGS (OPT_CFLAGS) which have a sane default:
-D_FORTIFY_SOURCE=2 -O2 and warning flags These will get replaced if OPT_CFLAGS= are passed via make OPT_CFLAGS=".." invokation
2) Elementary CFLAGS (-I includes, -Dxy, ...) which are mandatory for a successful compile run
--- generate/unix/Makefile.config | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
generate/unix/Makefile.config +6 -2
@@ -38,7 +38,7 @@ CC = gcc OBJDIR = obj$(BITS) BINDIR = bin$(BITS) BITSFLAG = -m$(BITS) -COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< +COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $< LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) INSTALLDIR = /usr/bin INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
@@ -103,11 +103,15 @@ ACPICA_HEADERS = \ # Common compiler flags. The warning flags in addition to -Wall are not # automatically included in -Wall. # +OPT_CFLAGS ?= \ + -D_FORTIFY_SOURCE=2 -O2 \ + $(CWARNINGFLAGS) + CFLAGS += \ + $(OPT_CFLAGS) \ $(BITSFLAG) \ -D$(HOST) \ -D_GNU_SOURCE \ - -D_FORTIFY_SOURCE=2 \ -I$(ACPICA_INCLUDE) LDFLAGS += $(BITSFLAG)
Moore
We have to think about _FORTIFY_SOURCE a bit more because we have had problems on some hosts with the -O2 flag.
Bob
Quoted 64 lines
-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of Thomas Renninger
Sent: Wednesday, November 14, 2012 6:52 AM
To: devel(a)acpica.org
Subject: [Devel] [RESEND] [PATCH 1/2] acpicaMakefile: Make it possible to pass additional CFLAGS when invoking makeacpcia: Make it possible to pass additional CFLAGS when invoking make
-D_FORTIFY_SOURCE=2 without -O2 can cause:
--
/usr/include/features.h:314:4: error: #warning_FORTIFY_SOURCErequires compiling with optimization (-O) [-Werror=cpp]
--
Such compiler flags must be able to get passed when invoking make. OpenSUSE packages require to build binaries with CLFAGS="$RPM_OPT_FLAGS", to make sure debuginfo can be obtained,security/optimization/testflags of the compiler for the distribution built against are passed, etc.This patch differs between:
1) Optional CFLAGS (OPT_CFLAGS) which have a sane default:
-D_FORTIFY_SOURCE=2 -O2 and warning flags These will get replaced if OPT_CFLAGS= are passed via make OPT_CFLAGS=".." invokation
2) Elementary CFLAGS (-I includes, -Dxy, ...) which are mandatory for a successful compile runSigned-off-by Thomas Renninger <trenn(a)suse.de>CC arjan(a)linux.intel.com--- generate/unix/Makefile.config | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Index:
acpica-unix2-20120913/generate/unix/Makefile.config
===================================================================generate/unix/Makefile.config +1
-1@@ -38,7 +38,7 @@ CC = gcc OBJDIR = obj$(BITS) BINDIR = bin$(BITS) BITSFLAG = -m$(BITS) -COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< +COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $< LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) INSTALLDIR = /usr/bin INSTALLPROG = install -D ../$(BINDIR)/$(PROG)$(DESTDIR)$(INSTALLDIR)/$(PROG) @@ -103,11 +103,15 @@
ACPICA_HEADERS= \
# Common compiler flags. The warning flags in addition to -Wall are not # automatically included in -Wall.
#generate/unix/Makefile.config +5
-1+OPT_CFLAGS ?= \ + -D_FORTIFY_SOURCE=2 -O2 \ + $(CWARNINGFLAGS) + CFLAGS += \ + $(OPT_CFLAGS) \ $(BITSFLAG) \ -D$(HOST) \ -D_GNU_SOURCE \ - -D_FORTIFY_SOURCE=2 \ -I$(ACPICA_INCLUDE) LDFLAGS += $(BITSFLAG)
Thomas Renninger
Quoted 2 lines · Robert
We have to think about
_FORTIFY_SOURCEa bit more because we have had problems on some hosts with the -O2 flag.
But this is the whole point.
Currently I cannot see a possibility to pass a compiler flag dynamically via make at all to give someone the chance to remove _FORTIFY_SOURCE or add/remove other compiler flags dynamically (without the need of modifying the Makefile itself).
I do not care much about the default CFLAGS, but we need a possibility to pass optional flags dynamically.
Thanks,
Thomas
Moore
Yes, I understand. We are thinking about what the defaults should be.
However, of course we will add the ability to pass in flags. Thanks,
Bob
Quoted 24 lines
-----Original Message-----
From: Thomas Renninger [mailto:trenn(a)suse.de]
Sent: Wednesday, November 14, 2012 9:46 AM
To: Moore, Robert
Cc: devel(a)acpica.org
Subject: Re: [Devel] [RESEND] [PATCH 1/2] acpicaMakefile: Make it possible to pass additional CFLAGS when invoking makeQuoted 2 lines · Robert
We have to think about
_FORTIFY_SOURCEa bit more because we have had problems on some hosts with the -O2 flag.But this is the whole point.
Currently I cannot see a possibility to pass a compiler flag dynamically via make at all to give someone the chance to remove_FORTIFY_SOURCEor add/remove other compiler flags dynamically (without the need of modifying theMakefileitself).I do not care much about the default CFLAGS, but we need a possibility to pass optional flags dynamically.
Thanks,
Thomas