about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-01-17 16:00:11 +0100
committerhexcoder- <heiko@hexco.de>2020-01-17 16:00:11 +0100
commit3671d7eb8a9dddc5be29ae5e3d4ba7669a898e53 (patch)
treef00b5195f1964297b6ed37fe31f84a08361a050b
parentbd58094dbc87463680a54d99ffcff7ae2a591353 (diff)
downloadafl++-3671d7eb8a9dddc5be29ae5e3d4ba7669a898e53.tar.gz
fixes for gcc 5.5 (does not understand -march=native) on NetBSD
-rw-r--r--Makefile8
1 files changed, 6 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 56b77999..d208f509 100644
--- a/Makefile
+++ b/Makefile
@@ -44,11 +44,15 @@ else
  endif
 endif
 
-CFLAGS     ?= -O3 -funroll-loops -march=native
+CFLAGS     ?= -O3 -funroll-loops
 CFLAGS     += -Wall -g -Wno-pointer-sign -I include/ \
               -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
               -DDOC_PATH=\"$(DOC_PATH)\" -Wno-unused-function
 
+ifeq "$(shell echo 'int main() {return 0; }' | $(CC) -x c - -march=native -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
+	CFLAGS     += -march=native
+endif
+
 AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c)
 
 ifneq "($filter %3.7m, $(shell python3.7m-config --includes 2>/dev/null)" ""
@@ -253,7 +257,7 @@ radamsa: src/third_party/libradamsa/libradamsa.so
 	cp src/third_party/libradamsa/libradamsa.so .
 
 src/third_party/libradamsa/libradamsa.so: src/third_party/libradamsa/libradamsa.c src/third_party/libradamsa/radamsa.h
-	$(MAKE) -C src/third_party/libradamsa/
+	$(MAKE) -C src/third_party/libradamsa/ CFLAGS="$(CFLAGS)"
 
 afl-fuzz: include/afl-fuzz.h $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o $(COMM_HDR) | test_x86
 	$(CC) $(CFLAGS) $(CFLAGS_FLTO) $(AFL_FUZZ_FILES) src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o -o $@ $(PYFLAGS) $(LDFLAGS)