diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Makefile b/Makefile index 305e0a1..d6a0829 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,49 @@ -# EDIT: path to dyninst binaries -DYNINST_ROOT = /usr/local +# Build recipe +# +# SPDX-FileCopyrightText: 2016 Aleksandar Nikolic <anikolich@sourcefire.com> +# SPDX-FileCopyrightText: 2018-2020 Marc "van Hauser" Heuse <vh@thc.org> +# SPDX-License-Identifier: Apache-2.0 +# +# SPDX-FileCopyrightText: 2024 Nguyễn Gia Phong <cnx@loang.net> +# SPDX-License-Identifier: AGPL-3.0-or-later -# EDIT: you must set this to your dyninst build directory -DYNINST_BUILD = /path/to/dyninst/build-directory -#DYNINST_BUILD = /prg/tmp/dyninst/build-10.0.1 +.POSIX: +.PHONY: all clean install -# EDIT: path to afl src if you do not set a symlink from ./afl to the afl directory -AFL_ROOT = ./afl +CXXFLAGS += -std=c++11 -Wextra -Werror +LDFLAGS ?= -fPIC +LDLIBS += -ldyninstAPI -# better dont touch these -DYNINST9=-lcommon -liberty -lboost_system -DYNINST10=-I$(DYNINST_BUILD)/tbb/src/TBB/src/include -lboost_system -ltbb +PREFIX ?= /usr/local +BINDIR ::= $(DESTDIR)$(PREFIX)/bin +LIBDIR ::= $(DESTDIR)$(PREFIX)/lib -# EDIT: set this to either DYNINST9 or DYNINST10 depending on what you installed -DYNINST_OPT = $(DYNINST10) +# Override on non-FHS environments +DYNINST_LIB ?= $(LIBDIR) +# Override to . for local development +AFL_DYNINST_LIB ?= $(LIBDIR) -# path to libelf and libdwarf -DEPS_ROOT = /usr/local +BIN ::= afl-dyninst afl-dyninst-env +LIB ::= libafldyninst.so -# where to install -INSTALL_ROOT = /usr/local +all: $(BIN) $(LIB) -#CXX = g++ -CXXFLAGS = -Wall -O3 -std=c++11 -g -O3 -std=c++11 -LIBFLAGS = -fpic -shared +afl-dyninst: afl-dyninst.cc afl-dyninst.h -CC = gcc -CFLAGS = -Wall -O3 -g -std=gnu99 +afl-dyninst%: afl-dyninst%.m4 + m4 -D AFL_DYNINST_LIB=$(AFL_DYNINST_LIB)\ + -D DYNINST_LIB=$(DYNINST_LIB) $< > $@ -all: afl-dyninst libAflDyninst.so +%.so: %.cc + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -shared $< -o $@ -afl-dyninst: afl-dyninst.o - $(CXX) $(CXXFLAGS) -L$(DYNINST_ROOT)/lib -L$(DEPS_ROOT)/lib -o afl-dyninst afl-dyninst.o $(DYNINST_OPT) -ldyninstAPI - -libAflDyninst.so: libAflDyninst.cpp - $(CXX) -O3 -std=c++11 $(LIBFLAGS) -I$(AFL_ROOT) -I$(DYNINST_ROOT)/include -I$(DEPS_ROOT)/include libAflDyninst.cpp -o libAflDyninst.so +clean: + rm -f $(BIN) $(LIB) -afl-dyninst.o: afl-dyninst.cpp - $(CXX) $(CXXFLAGS) $(DYNINST_OPT) -I$(DEPS_ROOT)/include -I$(DYNINST_ROOT)/include -c afl-dyninst.cpp +install: $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%) -clean: - rm -f afl-dyninst *.so *.o +$(BINDIR)/%: % + install -Dm 755 $< $@ -install: all - install -d $(INSTALL_ROOT)/bin - install -d $(INSTALL_ROOT)/lib - install afl-dyninst afl-dyninst.sh afl-fuzz-dyninst.sh $(INSTALL_ROOT)/bin - install libAflDyninst.so $(INSTALL_ROOT)/lib +$(LIBDIR)/%: % + install -Dm 644 $< $@ |