File acpica_make_CFLAGS_overridable of Package acpica

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 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)
openSUSE Build Service is sponsored by