commit 199e1c82c83a58b8343ba0e46a73c7fe9fe2bf0c
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Sat Mar 5 22:46:24 2016 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Sat Mar 5 22:46:24 2016 +0100
Makefile: add install and uninstall
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/Makefile b/Makefile
index 691e35f..2e8d2d5 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -64,7 +64,8 @@ INLINE_FUN =\
zsignum
OBJ = $(FUN:=.o) allocator.o
-MAN = $(foreach F,$(FUN) $(INLINE_FUN),man/$(F).3) man/libzahl.7
+MAN3 = $(FUN:=.3) $(INLINE_FUN:=.3)
+MAN7 = libzahl.7
all: libzahl.a
_AT_@ -84,7 +85,23 @@ test: test.c libzahl.a test-random.c
check: test
./test
+install: libzahl.a
+ mkdir -p -- "$(DESTDIR)$(EXECPREFIX)/lib"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
+ mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
+ cp -- libzahl.a "$(DESTDIR)$(EXECPREFIX)/lib"
+ cp -- zahl.h "$(DESTDIR)$(PREFIX)/include"
+ cp -- $(foreach M,$(MAN3),man/$(M)) "$(DESTDIR)$(MANPREFIX)/man3"
+ cp -- $(foreach M,$(MAN7),man/$(M)) "$(DESTDIR)$(MANPREFIX)/man7"
+
+uninstall:
+ rm -- "$(DESTDIR)$(EXECPREFIX)/lib/libzahl.a"
+ rm -- "$(DESTDIR)$(PREFIX)/include/zahl.h"
+ cd "$(DESTDIR)$(MANPREFIX)/man3" && rm $(MAN3)
+ cd "$(DESTDIR)$(MANPREFIX)/man7" && rm $(MAN7)
+
clean:
-rm -- *.o *.su *.a *.so test test-random.c 2>/dev/null
-.PHONY: all check clean
+.PHONY: all check clean install uninstall
diff --git a/config.mk b/config.mk
index 7544d18..9ffff50 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -2,7 +2,7 @@ VERSION = 0.0
PREFIX = /usr/local
EXECPREFIX = $(PREFIX)
-MANPREFIX = $(PREFIX)/shared/man
+MANPREFIX = $(PREFIX)/share/man
CC = cc
AR = ar
Received on Sat Mar 05 2016 - 22:46:35 CET
This archive was generated by hypermail 2.3.0
: Sat Mar 05 2016 - 22:48:14 CET