about summary refs log tree commit diff
path: root/gcc_plugin/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'gcc_plugin/Makefile')
-rw-r--r--gcc_plugin/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc_plugin/Makefile b/gcc_plugin/Makefile
index 1ee18b82..98ddffd4 100644
--- a/gcc_plugin/Makefile
+++ b/gcc_plugin/Makefile
@@ -24,9 +24,12 @@ PREFIX      ?= /usr/local
 HELPER_PATH  = $(PREFIX)/lib/afl
 BIN_PATH     = $(PREFIX)/bin
 
+VERSION     = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
+
 CFLAGS      ?= -O3 -g -funroll-loops
 CFLAGS      += -Wall -I../include -D_FORTIFY_SOURCE=2 -Wno-pointer-sign \
                -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
+               -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
 
 CXXFLAGS    ?= -O3 -g -funroll-loops
 CXXEFLAGS   := $(CXXFLAGS) -Wall -D_FORTIFY_SOURCE=2
@@ -37,6 +40,9 @@ CXX         ?= g++
 PLUGIN_FLAGS = -fPIC -fno-rtti -I"$(shell $(CC) -print-file-name=plugin)/include"
 HASH=\#
 
+GCCVER    = $(shell $(CC) --version 2>/dev/null | awk 'NR == 1 {print $$NF}')
+GCCBINDIR = $(shell dirname `which $(CC)` 2>/dev/null )
+
 ifeq "$(shell echo '$(HASH)include <sys/ipc.h>@$(HASH)include <sys/shm.h>@int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1"
 	SHMAT_OK=1
 else