about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 15 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index d6a0829..df078b0 100644
--- a/Makefile
+++ b/Makefile
@@ -8,12 +8,9 @@
 # SPDX-License-Identifier: AGPL-3.0-or-later
 
 .POSIX:
-.PHONY: all clean install
-
-CXXFLAGS += -std=c++11 -Wextra -Werror
-LDFLAGS ?= -fPIC
-LDLIBS += -ldyninstAPI
+.PHONY: all clean install uninstall
 
+VERSION ::= 1.0.0
 PREFIX ?= /usr/local
 BINDIR ::= $(DESTDIR)$(PREFIX)/bin
 LIBDIR ::= $(DESTDIR)$(PREFIX)/lib
@@ -23,19 +20,26 @@ DYNINST_LIB ?= $(LIBDIR)
 # Override to . for local development
 AFL_DYNINST_LIB ?= $(LIBDIR)
 
+CPPFLAGS = -DPROG=\"afl-dyninst\" -DVERSION=\"$(VERSION)\"\
+	-DAFL_DYNINST_LIB=\"$(AFL_DYNINST_LIB)/libafldyninst.so\"\
+	-DDYNINSTAPI_RT_LIB=\"$(DYNINST_LIB)/libdyninstAPI_RT.so\"
+CXXFLAGS += -std=c++11 -Wextra -Werror
+LDFLAGS ?= -fPIC
+LDLIBS += -ldyninstAPI
+
 BIN ::= afl-dyninst afl-dyninst-env
 LIB ::= libafldyninst.so
 
 all: $(BIN) $(LIB)
 
-afl-dyninst: afl-dyninst.cc afl-dyninst.h
+afl-dyninst: afl-dyninst.cc
 
-afl-dyninst%: afl-dyninst%.m4
+afl-dyninst-env: afl-dyninst-env.m4
 	m4 -D AFL_DYNINST_LIB=$(AFL_DYNINST_LIB)\
 		-D DYNINST_LIB=$(DYNINST_LIB) $< > $@
 
 %.so: %.cc
-	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -shared $< -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $< -o $@
 
 clean:
 	rm -f $(BIN) $(LIB)
@@ -47,3 +51,6 @@ $(BINDIR)/%: %
 
 $(LIBDIR)/%: %
 	install -Dm 644 $< $@
+
+uninstall:
+	rm -f $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%)