# Build recipe # # SPDX-FileCopyrightText: 2016 Aleksandar Nikolic # SPDX-FileCopyrightText: 2018-2020 Marc "van Hauser" Heuse # SPDX-License-Identifier: Apache-2.0 # # SPDX-FileCopyrightText: 2024 Nguyễn Gia Phong # SPDX-License-Identifier: AGPL-3.0-or-later .POSIX: .PHONY: all clean install CXXFLAGS += -std=c++11 -Wextra -Werror LDFLAGS ?= -fPIC LDLIBS += -ldyninstAPI PREFIX ?= /usr/local BINDIR ::= $(DESTDIR)$(PREFIX)/bin LIBDIR ::= $(DESTDIR)$(PREFIX)/lib # Override on non-FHS environments DYNINST_LIB ?= $(LIBDIR) # Override to . for local development AFL_DYNINST_LIB ?= $(LIBDIR) BIN ::= afl-dyninst afl-dyninst-env LIB ::= libafldyninst.so all: $(BIN) $(LIB) afl-dyninst: afl-dyninst.cc afl-dyninst.h afl-dyninst%: afl-dyninst%.m4 m4 -D AFL_DYNINST_LIB=$(AFL_DYNINST_LIB)\ -D DYNINST_LIB=$(DYNINST_LIB) $< > $@ %.so: %.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -shared $< -o $@ clean: rm -f $(BIN) $(LIB) install: $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%) $(BINDIR)/%: % install -Dm 755 $< $@ $(LIBDIR)/%: % install -Dm 644 $< $@