$NetBSD: patch-src_Makefile,v 1.3 2014/12/09 14:37:06 khorben Exp $ Fixed DESTDIR support --- src/Makefile.orig 2013-12-27 10:39:49.000000000 +0000 +++ src/Makefile @@ -56,7 +56,8 @@ ifeq ($(PLATFORM_OS), Darwin) endif PROGS = readpe rva2ofs ofs2rva pehash pesec pescan pepack pestr pedis peres -SHAREDIR = $(datadir)/pev +MAN1DIR = $(DESTDIR)$(man1dir) +SHAREDIR = $(DESTDIR)$(datadir)/pev LIBPE = $(srcdir)/../lib/libpe LIBUDIS86 = $(srcdir)/../lib/libudis86 LIBFUZZY = $(srcdir)/../lib/libfuzzy @@ -68,6 +69,8 @@ MANDIR = $(srcdir)/../doc/manpages all: $(PROGS) +pepack: CPPFLAGS += -DPREFIX=\"$(prefix)\" + pesec: LDFLAGS += -lcrypto pesec: compat/strlcat.c @@ -85,13 +88,13 @@ pescan: LDFLAGS += -lm # Generic rule matching binary names and sources %: %.c - $(CC) $(CFLAGS) $(DFLAGS) output.c malloc_s.c $^ -o $@ $(LDFLAGS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(DFLAGS) output.c malloc_s.c $^ -o $@ $(LDFLAGS) install: installdirs for prog in $(PROGS); do \ - $(INSTALL_PROGRAM) -m 755 $$prog $(DEST); \ + $(INSTALL_PROGRAM) -m 755 $$prog $(DEST)/$$prog; \ $(CHK_FILE_EXISTS) $(MANDIR)/$$prog$(man1ext) && \ - gzip -c -9 $(MANDIR)/$$prog$(man1ext) > $(man1dir)/$$prog$(man1ext).gz || \ + gzip -c -9 $(MANDIR)/$$prog$(man1ext) > $(MAN1DIR)/$$prog$(man1ext).gz || \ echo -n; \ done # TODO: Should we copy it anyway if it already exists? @@ -99,13 +102,13 @@ install: installdirs installdirs: @$(CHK_DIR_EXISTS) $(DEST) || $(MKDIR) $(DEST) - @$(CHK_DIR_EXISTS) $(man1dir) || $(MKDIR) $(man1dir) + @$(CHK_DIR_EXISTS) $(MAN1DIR) || $(MKDIR) $(MAN1DIR) @$(CHK_DIR_EXISTS) $(SHAREDIR) || $(MKDIR) $(SHAREDIR) uninstall: for prog in $(PROGS); do \ $(RM) $(DEST)/$$prog; \ - $(RM) $(man1dir)/$$prog$(man1ext).gz; \ + $(RM) $(MAN1DIR)/$$prog$(man1ext).gz; \ done clean: