From: Michael R. Crusoe Subject: improve the build hardening Forwarded: https://github.com/stamatak/standard-RAxML/pull/50 --- a/Makefile.AVX.PTHREADS.gcc +++ b/Makefile.AVX.PTHREADS.gcc @@ -3,8 +3,11 @@ CC = gcc -CFLAGS := -D_USE_PTHREADS -D__SIM_SSE3 -O2 -D_GNU_SOURCE -msse3 -fomit-frame-pointer -funroll-loops -D__AVX #-Wall -pedantic -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast +CFLAGS += -D_USE_PTHREADS -D__SIM_SSE3 -O2 -D_GNU_SOURCE -fomit-frame-pointer -funroll-loops -D__AVX #-Wall -pedantic -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast +ifeq (amd64,$(shell dpkg-architecture -q DEB_TARGET_ARCH_CPU)) + CFLAGS += -mavx -msse3 +endif LIBRARIES = -lm -pthread @@ -20,10 +23,10 @@ raxmlHPC-PTHREADS-AVX : $(objs) $(CC) -o raxmlHPC-PTHREADS-AVX $(objs) $(LIBRARIES) $(LDFLAGS) avxLikelihood.o : avxLikelihood.c $(GLOBAL_DEPS) - $(CC) $(CFLAGS) -mavx -c -o avxLikelihood.o avxLikelihood.c + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o avxLikelihood.o avxLikelihood.c fastDNAparsimony.o : fastDNAparsimony.c $(GLOBAL_DEPS) - $(CC) $(CFLAGS) -mavx -c -o fastDNAparsimony.o fastDNAparsimony.c + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o fastDNAparsimony.o fastDNAparsimony.c #rev_functions.o : rev_functions.c $(GLOBAL_DEPS) rmqs.o : rmqs.c $(GLOBAL_DEPS) @@ -49,7 +52,7 @@ ancestralStates.o : ancestralStates.c $( mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) eigen.o : eigen.c $(GLOBAL_DEPS) - $(CC) -c -o eigen.o eigen.c + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o eigen.o eigen.c clean : $(RM) *.o raxmlHPC-PTHREADS-AVX --- a/Makefile.PTHREADS.gcc +++ b/Makefile.PTHREADS.gcc @@ -10,7 +10,7 @@ else ifeq ($(ARCH), aarch64) ARCH_CFLAGS= endif -CFLAGS = -D_GNU_SOURCE -fomit-frame-pointer -funroll-loops -O2 -D_USE_PTHREADS $(ARCH_CFLAGS) #-Wall -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast +CFLAGS += -D_GNU_SOURCE -fomit-frame-pointer -funroll-loops -O2 -D_USE_PTHREADS $(ARCH_CFLAGS) #-Wall -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast LIBRARIES = -lm -pthread @@ -51,8 +51,8 @@ ancestralStates.o : ancestralStates.c $( mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) eigen.o : eigen.c $(GLOBAL_DEPS) - $(CC) -c -o eigen.o eigen.c + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o eigen.o eigen.c clean : $(RM) *.o raxmlHPC-PTHREADS -dev : raxmlHPC-PTHREADS \ No newline at end of file +dev : raxmlHPC-PTHREADS --- a/Makefile.SSE3.PTHREADS.gcc +++ b/Makefile.SSE3.PTHREADS.gcc @@ -10,7 +10,7 @@ else ifeq ($(ARCH), aarch64) ARCH_CFLAGS= endif -CFLAGS = -D_USE_PTHREADS -D__SIM_SSE3 -D_GNU_SOURCE $(ARCH_CFLAGS) -O2 -fomit-frame-pointer -funroll-loops #-Wall -pedantic -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast +CFLAGS += -D_USE_PTHREADS -D__SIM_SSE3 -D_GNU_SOURCE $(ARCH_CFLAGS) -O2 -fomit-frame-pointer -funroll-loops #-Wall -pedantic -Wunused-parameter -Wredundant-decls -Wreturn-type -Wswitch-default -Wunused-value -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wimport -Wunused -Wunused-function -Wunused-label -Wno-int-to-pointer-cast -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-sign -Wextra -Wredundant-decls -Wunused -Wunused-function -Wunused-parameter -Wunused-value -Wunused-variable -Wformat -Wformat-nonliteral -Wparentheses -Wsequence-point -Wuninitialized -Wundef -Wbad-function-cast LIBRARIES = -lm -pthread @@ -48,11 +48,11 @@ fastDNAparsimony.o : fastDNAparsimony.c fastSearch.o : fastSearch.c $(GLOBAL_DEPS) leaveDropping.o : leaveDropping.c $(GLOBAL_DEPS) ancestralStates.o : ancestralStates.c $(GLOBAL_DEPS) - mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) +mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) eigen.o : eigen.c $(GLOBAL_DEPS) - $(CC) -c -o eigen.o eigen.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o eigen.o eigen.c clean : $(RM) *.o raxmlHPC-PTHREADS-SSE3 -dev : raxmlHPC-PTHREADS-SSE3 \ No newline at end of file +dev : raxmlHPC-PTHREADS-SSE3