| 1 |
From: Michael R. Crusoe <[email protected]> |
| 2 |
Subject: improve the build hardening |
| 3 |
Forwarded: https://github.com/stamatak/standard-RAxML/pull/50 |
| 4 |
--- a/Makefile.AVX.PTHREADS.gcc |
| 5 |
+++ b/Makefile.AVX.PTHREADS.gcc |
| 6 |
@@ -3,8 +3,11 @@ |
| 7 |
|
| 8 |
CC = gcc |
| 9 |
|
| 10 |
-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 |
| 11 |
+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 |
| 12 |
|
| 13 |
+ifeq (amd64,$(shell dpkg-architecture -q DEB_TARGET_ARCH_CPU)) |
| 14 |
+ CFLAGS += -mavx -msse3 |
| 15 |
+endif |
| 16 |
|
| 17 |
LIBRARIES = -lm -pthread |
| 18 |
|
| 19 |
@@ -20,10 +23,10 @@ raxmlHPC-PTHREADS-AVX : $(objs) |
| 20 |
$(CC) -o raxmlHPC-PTHREADS-AVX $(objs) $(LIBRARIES) $(LDFLAGS) |
| 21 |
|
| 22 |
avxLikelihood.o : avxLikelihood.c $(GLOBAL_DEPS) |
| 23 |
- $(CC) $(CFLAGS) -mavx -c -o avxLikelihood.o avxLikelihood.c |
| 24 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o avxLikelihood.o avxLikelihood.c |
| 25 |
|
| 26 |
fastDNAparsimony.o : fastDNAparsimony.c $(GLOBAL_DEPS) |
| 27 |
- $(CC) $(CFLAGS) -mavx -c -o fastDNAparsimony.o fastDNAparsimony.c |
| 28 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o fastDNAparsimony.o fastDNAparsimony.c |
| 29 |
|
| 30 |
#rev_functions.o : rev_functions.c $(GLOBAL_DEPS) |
| 31 |
rmqs.o : rmqs.c $(GLOBAL_DEPS) |
| 32 |
@@ -49,7 +52,7 @@ ancestralStates.o : ancestralStates.c $( |
| 33 |
mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) |
| 34 |
|
| 35 |
eigen.o : eigen.c $(GLOBAL_DEPS) |
| 36 |
- $(CC) -c -o eigen.o eigen.c |
| 37 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o eigen.o eigen.c |
| 38 |
clean : |
| 39 |
$(RM) *.o raxmlHPC-PTHREADS-AVX |
| 40 |
|
| 41 |
--- a/Makefile.PTHREADS.gcc |
| 42 |
+++ b/Makefile.PTHREADS.gcc |
| 43 |
@@ -10,7 +10,7 @@ else ifeq ($(ARCH), aarch64) |
| 44 |
ARCH_CFLAGS= |
| 45 |
endif |
| 46 |
|
| 47 |
-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 |
| 48 |
+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 |
| 49 |
|
| 50 |
|
| 51 |
LIBRARIES = -lm -pthread |
| 52 |
@@ -51,8 +51,8 @@ ancestralStates.o : ancestralStates.c $( |
| 53 |
mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) |
| 54 |
|
| 55 |
eigen.o : eigen.c $(GLOBAL_DEPS) |
| 56 |
- $(CC) -c -o eigen.o eigen.c |
| 57 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o eigen.o eigen.c |
| 58 |
clean : |
| 59 |
$(RM) *.o raxmlHPC-PTHREADS |
| 60 |
|
| 61 |
-dev : raxmlHPC-PTHREADS |
| 62 |
\ No newline at end of file |
| 63 |
+dev : raxmlHPC-PTHREADS |
| 64 |
--- a/Makefile.SSE3.PTHREADS.gcc |
| 65 |
+++ b/Makefile.SSE3.PTHREADS.gcc |
| 66 |
@@ -10,7 +10,7 @@ else ifeq ($(ARCH), aarch64) |
| 67 |
ARCH_CFLAGS= |
| 68 |
endif |
| 69 |
|
| 70 |
-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 |
| 71 |
+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 |
| 72 |
|
| 73 |
|
| 74 |
LIBRARIES = -lm -pthread |
| 75 |
@@ -48,11 +48,11 @@ fastDNAparsimony.o : fastDNAparsimony.c |
| 76 |
fastSearch.o : fastSearch.c $(GLOBAL_DEPS) |
| 77 |
leaveDropping.o : leaveDropping.c $(GLOBAL_DEPS) |
| 78 |
ancestralStates.o : ancestralStates.c $(GLOBAL_DEPS) |
| 79 |
- mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) |
| 80 |
+mem_alloc.o eigen.o : mem_alloc.c $(GLOBAL_DEPS) |
| 81 |
|
| 82 |
eigen.o : eigen.c $(GLOBAL_DEPS) |
| 83 |
- $(CC) -c -o eigen.o eigen.c |
| 84 |
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o eigen.o eigen.c |
| 85 |
clean : |
| 86 |
$(RM) *.o raxmlHPC-PTHREADS-SSE3 |
| 87 |
|
| 88 |
-dev : raxmlHPC-PTHREADS-SSE3 |
| 89 |
\ No newline at end of file |
| 90 |
+dev : raxmlHPC-PTHREADS-SSE3 |