All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn at suse.de>
To: devel@acpica.org
Subject: [Devel] [RESEND] [PATCH 1/2] acpica Makefile: Make it possible to pass additional CFLAGS when invoking make
Date: Wed, 14 Nov 2012 15:52:29 +0100	[thread overview]
Message-ID: <201211141552.29440.trenn@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2092 bytes --]

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

Signed-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
===================================================================
--- acpica-unix2-20120913.orig/generate/unix/Makefile.config
+++ acpica-unix2-20120913/generate/unix/Makefile.config
@@ -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)

[-- Attachment #2: acpica_make_CFLAGS_overridable.ksh --]
[-- Type: text/plain, Size: 2032 bytes --]

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

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: arjan@linux.intel.com
---
 generate/unix/Makefile.config |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: acpica-unix2-20120913/generate/unix/Makefile.config
===================================================================
--- acpica-unix2-20120913.orig/generate/unix/Makefile.config
+++ acpica-unix2-20120913/generate/unix/Makefile.config
@@ -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)

             reply	other threads:[~2012-11-14 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 14:52 Thomas Renninger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-14 15:43 [Devel] [RESEND] [PATCH 1/2] acpica Makefile: Make it possible to pass additional CFLAGS when invoking make Moore, Robert
2012-11-14 17:46 Thomas Renninger
2012-11-14 17:47 Moore, Robert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201211141552.29440.trenn@suse.de \
    --to=devel@acpica.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.