From d8fde23bf25074d7f812b956d21cdcc36a348c28 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 29 Aug 2018 18:41:58 +0200 Subject: Makefile: 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 | 14 +++++++++++++- config.mk | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4b538cd..4d22b69 100644 --- a/Makefile +++ b/Makefile @@ -77,10 +77,22 @@ libsimple.a: $(OBJ) check: $(TESTS) @set -e; for t in $(TESTS); do printf '%s\n' "./$$t"; $(CHECK_PREFIX) "./$$t"; done +install: libsimple.a + mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" + mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + cp -- libsimple.a "$(DESTDIR)$(PREFIX)/lib" + cp -- libsimple.h "$(DESTDIR)$(PREFIX)/include" + cp -- libsimple-arg.h "$(DESTDIR)$(PREFIX)/include" + +uninstall: + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libsimple.a" + -rm -f -- "$(DESTDIR)$(PREFIX)/include/libsimple.h" + -rm -f -- "$(DESTDIR)$(PREFIX)/include/libsimple-arg.h" + clean: -rm -rf -- *.o *.su *.a *.so *.so.* *.gch *.gcda *.gcno *.gcov *.lo *.test .SUFFIXES: .SUFFIXES: .test .test.o .o .c -.PHONY: all check clean +.PHONY: all check install uninstall clean diff --git a/config.mk b/config.mk index 2751186..7a1e97a 100644 --- a/config.mk +++ b/config.mk @@ -1,3 +1,6 @@ +PREFIX = /usr +MANPREFIX = $(PREFIX)/share/man + CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 CFLAGS = -std=c99 -Wall -Wextra -O2 $(CPPFLAGS) LDFLAGS = -s -- cgit v1.2.3-70-g09d2