Description: Use LDFLAGS & CPPFLAGS to enable hardening
Author: Michael R. Crusoe <crusoe@ucdavis.edu>
--- trinityrnaseq.orig/Chrysalis/Makefile
+++ trinityrnaseq/Chrysalis/Makefile
@@ -308,7 +308,7 @@
 endif
 
 # Linking control (e.g. to link templates):
-SYS_LINK	=
+SYS_LINK	=  $(LDFLAGS)
 
 # Required libraries:
 SYS_LIBS	= -lm -pthread
@@ -380,7 +380,8 @@
 		$(SYS_LANG) \
 		$(SYS_INCS) \
 		$(OMP_OPTIONS) \
-		$(PTHREAD_OPTIONS)
+		$(PTHREAD_OPTIONS) \
+		$(CPPFLAGS)
 
 LINK_OPTIONS	= \
 		$(SYS_DEBUG) \
@@ -466,7 +467,7 @@
 # How to compile C++ files:
 .cc.o:
 	@ mkdir -p $(OBJ)/${@D}
-	$(CPLUSPLUS) $(CPPC) -c $(SRC)/$*.cc -o $(OBJ)/$*.o
+	$(CPLUSPLUS) $(CXXFLAGS) $(CPPC) -c $(SRC)/$*.cc -o $(OBJ)/$*.o
 
 ##############################################################################
 ## ADDITIONAL TARGETS:
--- trinityrnaseq.orig/trinity-plugins/fstrozzi-Fastool-7c3e034f05/Makefile
+++ trinityrnaseq/trinity-plugins/fstrozzi-Fastool-7c3e034f05/Makefile
@@ -1,8 +1,7 @@
-CC     = gcc
-CFLAGS = -O2 -std=c99 -Werror
+CFLAGS += -O2 -std=c99 -Werror
 
 all:kseq.h fastool.c
-	$(CC) $(CFLAGS) fastool.c -o fastool
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) fastool.c -o fastool
 
 clean:
 	rm -f *.o fastool
--- trinityrnaseq.orig/trinity-plugins/slclust/src/Makefile
+++ trinityrnaseq/trinity-plugins/slclust/src/Makefile
@@ -17,11 +17,8 @@
 # use ${LIBDIR} defined above if appropriate
 LIBS           = 
 
-# How they are invoked on the compile line (eg: -lspecial)
-LLIBS          =
-
 # Local additions for the CFLAG options
-LOCAL_CFLAGS   = -Wall 
+LOCAL_CXXFLAGS   = -Wall 
 #-static
 
 
@@ -34,20 +31,11 @@
 INCLUDE       = ${PROJECT_ROOT}/include
 
 DEBUG         = DEBUG
-CFLAGS        = -I${INCLUDE} ${LOCAL_CFLAGS}
-CC            = g++ ${CFLAGS}
+CXXFLAGS        += -I${INCLUDE} ${LOCAL_CXXFLAGS}
 
 MAKEFILE      = Makefile
 
 
-# Suffix rules
-
-.cc.o:
-	${CC} -c $<
-
-.cpp.o:
-	${CC} -c $<
-
 # Target dependencies
 
 
@@ -59,12 +47,13 @@
 
 
 clean :
-	rm -f ${OBJS} core a.out *~ \#* ${EXECUTABLE} ${MAKEFILE}.bak
+	rm -f ${OBJS} core a.out *~ \#* ${EXECUTABLE} ${MAKEFILE}.bak \
+		${BIN}/${EXECUTABLE}
 
 
 ${OBJ} : ${MAKEFILE}
 
 ${EXECUTABLE} : ${OBJS}
-	${CC} ${OBJS} ${LIBS} -o ${EXECUTABLE}	
+	${CXX} ${LDFLAGS} ${OBJS} ${LIBS} -o ${EXECUTABLE}	
 	chmod 755 ${EXECUTABLE}
 
