From e81e89e9c49867cb9c3baf8dcb99bbb8ca856f41 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 3 Apr 2015 17:51:17 +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 | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 893d8f3..50019f8 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,17 @@ WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include STD = c99 + # Build rules +.PHONY: default +default: command + .PHONY: all -all: bin/exec-as +all: command + +.PHONY: command +command: bin/exec-as bin/exec-as: obj/exec-as.o @@ -58,6 +65,38 @@ obj/%.o: src/%.c $(CC) -std=$(STD) $(WARN) $(OPTIMISE) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +# Install rules + +.PHONY: install +install: install-base + +.PHONY: install-base +install-base: install-command install-license + +.PHONY: install-command +install-command: bin/exec-as + install -dm755 -- "$(DESTDIR)$(BINDIR)" + install -m755 bin/exec-as -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + +.PHONY: install-license +install-license: COPYING LICENSE + install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + install -m644 $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + + + +# Uninstall rules + +.PHONY: uninstall +uninstall: + -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" + -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" + -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + + + # Clean rules .PHONY: clean -- cgit v1.2.3-70-g09d2