From 1fe6579eb183c8762c6ce41fc2ace742c8f5a5c9 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 5 Nov 2024 12:47:14 +0900 Subject: Rework afl-dyninst's CLI It is now compatible with help2man, hence the new barebone manual page. --- Makefile | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index df078b0..9c7135c 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,14 @@ VERSION ::= 1.0.0 PREFIX ?= /usr/local BINDIR ::= $(DESTDIR)$(PREFIX)/bin LIBDIR ::= $(DESTDIR)$(PREFIX)/lib +MANDIR ::= $(DESTDIR)$(PREFIX)/share/man # Override on non-FHS environments DYNINST_LIB ?= $(LIBDIR) # Override to . for local development AFL_DYNINST_LIB ?= $(LIBDIR) -CPPFLAGS = -DPROG=\"afl-dyninst\" -DVERSION=\"$(VERSION)\"\ +CPPFLAGS = -DVERSION=\"$(VERSION)\"\ -DAFL_DYNINST_LIB=\"$(AFL_DYNINST_LIB)/libafldyninst.so\"\ -DDYNINSTAPI_RT_LIB=\"$(DYNINST_LIB)/libdyninstAPI_RT.so\" CXXFLAGS += -std=c++11 -Wextra -Werror @@ -29,8 +30,9 @@ LDLIBS += -ldyninstAPI BIN ::= afl-dyninst afl-dyninst-env LIB ::= libafldyninst.so +MAN ::= afl-dyninst.1 -all: $(BIN) $(LIB) +all: $(BIN) $(LIB) $(MAN) afl-dyninst: afl-dyninst.cc @@ -41,10 +43,13 @@ afl-dyninst-env: afl-dyninst-env.m4 %.so: %.cc $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $< -o $@ +%.1: % + help2man --no-info --output=$@ `realpath $<` + clean: - rm -f $(BIN) $(LIB) + rm -f $(BIN) $(LIB) $(MAN) -install: $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%) +install: $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%) $(MAN:%.1:$(MANDIR)/man1/%.1) $(BINDIR)/%: % install -Dm 755 $< $@ @@ -52,5 +57,10 @@ $(BINDIR)/%: % $(LIBDIR)/%: % install -Dm 644 $< $@ +$(MANDIR)/man1/%.1 : %.1 + install -Dm 644 $< $@ + uninstall: - rm -f $(BIN:%=$(BINDIR)/%) $(LIB:%=$(LIBDIR)/%) + rm -f $(BIN:%=$(BINDIR)/%) + rm -f $(LIB:%=$(LIBDIR)/%) + rm -f $(MAN:%.1:$(MANDIR)/man1/%.1) -- cgit 1.4.1