From b293b11fc8d9934a9251279c045608afd49400f1 Mon Sep 17 00:00:00 2001 From: Nathan Sketch Date: Mon, 8 Mar 2021 10:24:49 +1300 Subject: Update Makefile with PREFIX, DESTDIR and man page This commit updates the Makefile to use PREFIX more conventionally, rather than directly as the path to the bin directory. It also adds the traditional DESTDIR override to move installation elsewhere. The man page will be installed inside share/man, or MANPREFIX if specified. --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fea0d36..547d19d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -PREFIX = $(HOME)/.local/bin +PREFIX = $(HOME)/.local +MANPREFIX = $(PREFIX)/share/man all: dragon @@ -6,5 +7,12 @@ dragon: dragon.c $(CC) --std=c99 -Wall $(DEFINES) dragon.c -o dragon `pkg-config --cflags gtk+-3.0` `pkg-config --libs gtk+-3.0` install: dragon - mkdir -p $(PREFIX) - cp dragon $(PREFIX) + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f dragon $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/dragon + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + cp -f dragon.1 $(DESTDIR)$(MANPREFIX)/man1/dragon.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dragon.1 + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/dragon $(DESTDIR)$(MANPREFIX)/man1/dragon.1 -- cgit