From 365dc51451c28f00e7693c931b1fa8866dd510ef Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 16 Aug 2014 13:01:30 +0200 Subject: add install and uninstall rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index fb30138..61162c5 100644 --- a/Makefile +++ b/Makefile @@ -8,27 +8,20 @@ PREFIX ?= /usr # The command path excluding prefix. BIN ?= /bin -# The library path excluding prefix. -LIB ?= /lib -# The executable library path excluding prefix. -LIBEXEC ?= /libexec # The resource path excluding prefix. DATA ?= /share # The command path including prefix. BINDIR ?= $(PREFIX)$(BIN) -# The library path including prefix. -LIBDIR ?= $(PREFIX)$(LIB) -# The executable library path including prefix. -LIBEXECDIR ?= $(PREFIX)$(LIBEXEC) # The resource path including prefix. DATADIR ?= $(PREFIX)$(DATA) -# The generic documentation path including prefix. -DOCDIR ?= $(DATADIR)/doc -# The info manual documentation path including prefix. -INFODIR ?= $(DATADIR)/info # The license base path including prefix. LICENSEDIR ?= $(DATADIR)/licenses +# The name of the command as it should be installed +COMMAND ?= timeprefix +# The name of the package as it should be installed +PKGNAME ?= timeprefix + # Optimisation level (and debug flags.) OPTIMISE = -Ofast @@ -63,6 +56,21 @@ obj/%.o: src/%.c $(CC) -std=$(STD) $(OPTIMISE) $(WARN) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +.PHONY: install +install: bin/timeprefix + install -dm755 -- "$(DESTDIR)$(BINDIR)" + install -m755 bin/timeprefix -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 LICENSE COPYING -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + +.PHONY: uninstall +uninstall: + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + + .PHONY: clean clean: -rm -r obj bin -- cgit v1.2.3-70-g09d2