1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Author: Andreas Tille <tille@debian.org>
LastUpdated: Wed, 23 Oct 2013 10:43:20 +0200
Description: Propagate Debian hardening options into build system
This is most probably not the most elegant way, but when simply
setting CFLAGS in debian/rules they simply override the CFLAGS
setting inside the sequence of Makefiles which leads to a loss of
DEFINES and INCDIRS which are needed to build properly
--- a/Makefile
+++ b/Makefile
@@ -155,11 +155,11 @@ $(RHOSTS):
@ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config
$(PASSTHRUS):
- @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@
- @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config
+ @ $(MAKE) -s TOP=$(CURDIR) DEB_CFLAGS="$(DEB_CFLAGS)" DEB_LDFLAGS="$(DEB_LDFLAGS)" -f build/Makefile.env $@
+ @ $(MAKE) -s TOP=$(CURDIR) DEB_CFLAGS="$(DEB_CFLAGS)" DEB_LDFLAGS="$(DEB_LDFLAGS)" -f build/Makefile.env rebuild-dirlinks config
$(REPORTS):
- @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@
+ @ $(MAKE) -s TOP=$(CURDIR) DEB_CFLAGS="$(DEB_CFLAGS)" DEB_LDFLAGS="$(DEB_LDFLAGS)" -f build/Makefile.env $@
.PHONY: $(PASSTHRUS) $(RHOSTS) $(REPORTS)
--- a/build/Makefile.env
+++ b/build/Makefile.env
@@ -356,9 +356,9 @@ DLLX ?= $(SHLX)
ARCHDEFS = -D_ARCH_BITS=__SIZEOF_POINTER__*__CHAR_BIT__ -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX)
# default tool parameters
-CFLAGS = -std=c11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
-CPFLAGS = -std=c++11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
-LDFLAGS = $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT) $(LDPATHS)
+CFLAGS = $(DEB_CFLAGS) -std=c11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
+CPFLAGS = $(DEB_CXXFLAGS) -std=c++11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
+LDFLAGS = $(DEB_LDFLAGS) $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT) $(LDPATHS)
#-------------------------------------------------------------------------------
# runtests
|