Subject: add Debian hardening flags
Description: add hardening
Author: Olivier Sallou <osallou@debian.org>
Last-Updated: 2014-08-18
Forwarded: no
--- a/kissreads/Makefile
+++ b/kissreads/Makefile
@@ -20,11 +20,16 @@
 # optimized flags
 
 #CFLAGS=-Wall -O3 -L/../thirdparty/zlib/build/ -lz
-CFLAGS= -O3 -L../thirdparty/zlib/build/ -lz
+CFLAGS= -O3 -lz
 CFLAGS+=$(MYFLAGS)
 
 #LDFLAGS+=-Wall -lm -O3 -L../thirdparty/zlib/build/ -lz
-LDFLAGS+= -lm -O3 -L../thirdparty/zlib/build/ -lz
+LDFLAGS+= -lm -O3 -lz
+
+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
 #CFLAGS		+=-Wall -g -lz -fopenmp
--- a/kissreads_graph/makefile
+++ b/kissreads_graph/makefile
@@ -6,6 +6,9 @@
 #CFLAGS=  -g -L../thirdparty/zlib/build -lz -std=c++11 -DMINIA_IS_IN_PARENT_FOLDER
 #CFLAGS=  -g -L../thirdparty/zlib/build -lz -DMINIA_IS_IN_PARENT_FOLDER
 CFLAGS+= -D_FILE_OFFSET_BITS=64
+CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS) -O3 -lz -DMINIA_IS_IN_PARENT_FOLDER -D_FILE_OFFSET_BITS=64
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
 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) 
 all: $(EXEC)
@@ -49,7 +52,7 @@
 all: $(EXEC)
 
 kissreads_graph:  $(OBJ) KissReadsGraph.cpp
-	$(CC) -o $@ $^ $(CFLAGS)
+	$(CC) -o $@ $^ $(CFLAGS)  $(LDFLAGS)
 
 %.o: %.cpp %.h
 	$(CC) -o $@ -c $< $(CFLAGS)
--- a/mapsembler2_extend/makefile
+++ b/mapsembler2_extend/makefile
@@ -51,6 +51,11 @@
 	endif
 endif
 
+CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
+
+
 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  
 OBJ= $(SRC:.cpp=.o) 
 all: $(EXEC)
@@ -105,7 +110,7 @@
 
 mapsembler_extend:  $(OBJ) $(OBJ2) mapsembler_extend.cpp
 #mapsembler:  $(OBJ) $(OBJ2) test.cpp
-	$(CC) -o $@ $^ $(CFLAGS) 
+	$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
 
 %.o: %.cpp %.h 
 	$(CC) -o $@ -c $< $(CFLAGS)
--- a/mapsembler2_extremities/CMakeLists.txt
+++ b/mapsembler2_extremities/CMakeLists.txt
@@ -2,6 +2,7 @@
 
 cmake_minimum_required(VERSION 2.6)
 
+
 ################################################################################
 # Define cmake modules directory
 ################################################################################
