commit c0c5a85c6ad3b73c989bf375e9321629c7c9f404
Author: Kevin Pyle <gcc-python-plugin.8eaf7cd8e5128d8191fe(a)spamgourmet.com>
Date: Sun Mar 18 16:21:28 2012 -0500
Split CPPFLAGS/CFLAGS/LDFLAGS.
Users may want to set other optimization or debug levels, so split
CFLAGS handling into two parts. The first part, which will be
overridden by user environment variables, sets the default optimization
and debug level for the project. The second part then applies values
that should always be used.
Also, move CPPFLAGS and LDFLAGS to their respective variables.
Makefile | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/Makefile b/Makefile
index 3425c5f..65308d1 100644
--- a/Makefile
+++ b/Makefile
@@ -93,9 +93,15 @@ PYTHON_CONFIG=python-config
PYTHON_CFLAGS=$(shell $(PYTHON_CONFIG) --cflags)
PYTHON_LDFLAGS=$(shell $(PYTHON_CONFIG) --ldflags)
-CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -fno-strict-aliasing -O2 -Wall -Werror -g $(PYTHON_CFLAGS) $(PYTHON_LDFLAGS)
+CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include
+# Allow user to pick optimization, choose whether warnings are fatal,
+# and choose debugging information level.
+CFLAGS?=-O2 -Werror -g
+# Force these settings
+CFLAGS+= -fPIC -fno-strict-aliasing -Wall $(PYTHON_CFLAGS)
+LDFLAGS+= $(PYTHON_LDFLAGS)
ifneq "$(PLUGIN_PYTHONPATH)" ""
- CFLAGS+= -DPLUGIN_PYTHONPATH='"$(PLUGIN_PYTHONPATH)"'
+ CPPFLAGS+= -DPLUGIN_PYTHONPATH='"$(PLUGIN_PYTHONPATH)"'
endif
all: autogenerated-config.h testcpybuilder test-suite testcpychecker
@@ -103,7 +109,7 @@ all: autogenerated-config.h testcpybuilder test-suite testcpychecker
plugin: autogenerated-config.h python.so
python.so: $(PLUGIN_OBJECT_FILES)
- $(CC) $(CFLAGS) -shared $^ -o $@
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $^ -o $@
clean:
rm -f *.so *.o