From c56e689f589cda28553aa6866a97fb8e2e803874 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Tue, 24 Oct 2017 22:50:10 +0100 Subject: [PATCH] Makefile: use DESTDIR in the conventional way DESTDIR gets only used in the install target, so prefix doesn't get cluttered and can be used internally to reference file dependencies. e.g. if for example a DB would be used, the filename to the DB could be passed in CPPFLAGS like "-DDBPATH=$(PREFIX)/share/pixiewps.db". this doesn't happen at the moment, but it's good practice to follow the conventions. additionally, remove the "rm" command in the install target - running `make install` should never ever delete files from user's prefix. --- src/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index b8957e3..4c2646c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,7 @@ CRYPTO = mbedtls/sha256.c mbedtls/md.c mbedtls/md_wrap.c SOURCE = $(TARGET).c random_r.c $(CRYPTO) LIBS = -lpthread -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR = $(PREFIX)/bin all: @@ -15,12 +15,11 @@ debug: $(CC) $(CLFAGS) $(CPPFLAGS) -DDEBUG -o $(TARGET) $(SOURCE) $(LIBS) $(LDFLAGS) install: - rm -f $(BINDIR)/$(TARGET) install -d $(BINDIR) - install -m 755 $(TARGET) $(BINDIR) + install -m 755 $(TARGET) $(DESTDIR)$(BINDIR) uninstall: - rm -f $(BINDIR)/$(TARGET) + rm -f $(DESTDIR)$(BINDIR)/$(TARGET) clean: rm -f $(TARGET)