Subject: add Debian hardening flags
Description: add hardening
Author: Olivier Sallou <osallou@debian.org>
Last-Updated: 2014-08-18
Forwarded: no
Index: mapsembler2_pipeline/kissreads/Makefile
===================================================================
--- mapsembler2_pipeline.orig/kissreads/Makefile
+++ mapsembler2_pipeline/kissreads/Makefile
@@ -20,10 +20,14 @@ CC		=gcc
 # optimized flags
 
 #CFLAGS=-Wall -O3 -lz -fopenmp -DOMP #openmp is incompatiblre with clang #@!§
-CFLAGS= -O3 -lz -fopenmp -DOMP #openmp is incompatiblre with clang #@!
+#CFLAGS= -O3 -lz -fopenmp -DOMP #openmp is incompatiblre with clang #@!
 CFLAGS+=$(MYFLAGS)
 #LDFLAGS+=-Wall -lm -O3 -lz -DOMP -fopenmp#-fopenmp
-LDFLAGS+= -lm -O3 -lz -DOMP -fopenmp#-fopenmp
+#LDFLAGS+= -lm -O3 -lz -DOMP -fopenmp#-fopenmp
+
+CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -O3 -lz
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS) -lm -O3 -lz
 
 ## debug flags
 
Index: mapsembler2_pipeline/kissreads_graph/makefile
===================================================================
--- mapsembler2_pipeline.orig/kissreads_graph/makefile
+++ mapsembler2_pipeline/kissreads_graph/makefile
@@ -4,6 +4,9 @@ EXEC=kissreads_graph
 #Loader.cpp CFLAGS=  -g -lz -std=c++11 -DMINIA_IS_IN_PARENT_FOLDER
 #Loader.cpp 
 CFLAGS=  -O3 -lz -DMINIA_IS_IN_PARENT_FOLDER
+CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -O3 -lz -DMINIA_IS_IN_PARENT_FOLDER
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
 #CFLAGS=  -g -lz -DMINIA_IS_IN_PARENT_FOLDER
 SRC=block_allocator.cpp  DeBruijnGraph.cpp  Fragment.cpp  json.cpp  read_coherence_mapsembler/libchash.cpp     read_coherence_mapsembler/couple.cpp  read_coherence_mapsembler/misc_tools.cpp  read_coherence_mapsembler/read_groups.cpp read_coherence_mapsembler/consensus_common.cpp  read_coherence_mapsembler/list.cpp    read_coherence_mapsembler/read_coherence.cpp  read_coherence_mapsembler/interface_libchash.cpp commons.cpp ../minia/Kmer.cpp ../minia/Bank.cpp Loader.cpp ReadMapper.cpp
 OBJ= $(SRC:.cpp=.o) 
@@ -48,7 +51,7 @@ endif
 all: $(EXEC)
 
 kissreads_graph:  $(OBJ) KissReadsGraph.cpp
-	$(CC) -o $@ $^ $(CFLAGS)
+	$(CC) -o $@ $^ $(CFLAGS)  $(LDFLAGS)
 
 %.o: %.cpp %.h
 	$(CC) -lz -o $@ -c $< $(CFLAGS)
Index: mapsembler2_pipeline/mapsembler2_extend/makefile
===================================================================
--- mapsembler2_pipeline.orig/mapsembler2_extend/makefile
+++ mapsembler2_pipeline/mapsembler2_extend/makefile
@@ -3,6 +3,9 @@ EXEC=mapsembler_extend
 #CFLAGS=  -O4 -lz --std=gnu++0x
 #CFLAGS=  -g -lz -DMINIA_IS_IN_PARENT_FOLDER
 CFLAGS=  -O3 -lz -DMINIA_IS_IN_PARENT_FOLDER
+CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -O3 -lz -DMINIA_IS_IN_PARENT_FOLDER
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
 #CFLAGS=  -g -lz --std=gnu++0x -DMINIA_IS_IN_PARENT_FOLDER
 #CFLAGS=  -g -lz -DMINIA_IS_IN_PARENT_FOLDER
 SRC=../minia/Pool.cpp ../minia/Bank.cpp ../minia/Bloom.cpp ../minia/Hash16.cpp ../minia/Terminator.cpp ../minia/Kmer.cpp ../minia/Traversal.cpp ../minia/LinearCounter.cpp ../minia/Set.cpp ../minia/Utils.cpp ../minia/SortingCount.cpp ../minia/Debloom.cpp ../minia/OAHash.cpp commons.cpp IterativeExtensions.cpp Fragment_Bank.cpp Fragment.cpp GraphOutput.cpp  
@@ -49,7 +52,7 @@ all: $(EXEC)
 
 mapsembler_extend:  $(OBJ) $(OBJ2) mapsembler_extend.cpp
 #mapsembler:  $(OBJ) $(OBJ2) test.cpp
-	$(CC) -o $@ $^ $(CFLAGS) 
+	$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
 
 %.o: %.cpp %.h 
 	$(CC) -lz -o $@ -c $< $(CFLAGS)
Index: mapsembler2_pipeline/mapsembler2_extremities/CMakeLists.txt
===================================================================
--- mapsembler2_pipeline.orig/mapsembler2_extremities/CMakeLists.txt
+++ mapsembler2_pipeline/mapsembler2_extremities/CMakeLists.txt
@@ -2,6 +2,7 @@ project(mapsembler2_extremities)
 
 cmake_minimum_required(VERSION 2.6)
 
+
 ################################################################################
 # Define cmake modules directory
 ################################################################################
