aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-06-06 14:08:07 +0200
committerMattias Andrée <maandree@kth.se>2017-06-06 14:08:07 +0200
commitc87ef93e800862f42458a9b987397e9f4d46f49c (patch)
treecdad3b0b5f712e04c041d667de8bc9698d5852f7 /Makefile
parentRemove a much of stuff, change license, and add support for float and long double (diff)
downloadlibcolour-c87ef93e800862f42458a9b987397e9f4d46f49c.tar.gz
libcolour-c87ef93e800862f42458a9b987397e9f4d46f49c.tar.bz2
libcolour-c87ef93e800862f42458a9b987397e9f4d46f49c.tar.xz
Makefile: add install and uninstall
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 28 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index acfc5b5..bde589b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
.POSIX:
-include config.mk
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
+
+SO_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
OBJ =\
float.o\
@@ -15,7 +18,7 @@ TEMPLATES =\
libcolour-template.c
-all: libcolour.a libcolour.so.$(VERSION_MAJOR).$(VERSION_MINOR) test
+all: libcolour.a libcolour.so.$(SO_VERSION) test
float.o: float.c $(TEMPLATES) $(HDR)
@@ -42,7 +45,7 @@ libcolour.a: $(OBJ)
$(AR) rc $@ $?
$(AR) -s $@
-libcolour.so.$(VERSION_MAJOR).$(VERSION_MINOR): $(OBJ:.o=.pic.o)
+libcolour.so.$(SO_VERSION): $(OBJ:.o=.pic.o)
$(CC) -shared -Wl,-soname,libcolour.so.$(VERSION_MAJOR) -o $@ $(LDFLAGS) $^
@@ -53,10 +56,31 @@ test: test.o libcolour.a
$(CC) -o $@ $^ $(LDFLAGS)
+install:
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
+ mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
+ cp -- libcolour.h "$(DESTDIR)$(PREFIX)/include/libcolour.h"
+ chmod -- 644 "$(DESTDIR)$(PREFIX)/include/libcolour.h"
+ cp -- libcolour.a "$(DESTDIR)$(PREFIX)/lib/libcolour.a"
+ chmod -- 644 "$(DESTDIR)$(PREFIX)/lib/libcolour.a"
+ cp -- libcolour.so.$(SO_VERSION) "$(DESTDIR)$(PREFIX)/lib/libcolour.so.$(SO_VERSION)"
+ chmod -- 755 "$(DESTDIR)$(PREFIX)/lib/libcolour.so.$(SO_VERSION)"
+ ln -sf -- libcolour.so.$(SO_VERSION) "$(DESTDIR)$(PREFIX)/lib/libcolour.so.$(VERSION_MAJOR)"
+ ln -sf -- libcolour.so.$(SO_VERSION) "$(DESTDIR)$(PREFIX)/lib/libcolour.so"
+
+
+uninstall:
+ -rm -- "$(DESTDIR)$(PREFIX)/include/libcolour.h"
+ -rm -- "$(DESTDIR)$(PREFIX)/lib/libcolour.a"
+ -rm -- "$(DESTDIR)$(PREFIX)/lib/libcolour.so.$(SO_VERSION)"
+ -rm -- "$(DESTDIR)$(PREFIX)/lib/libcolour.so.$(VERSION_MAJOR)"
+ -rm -- "$(DESTDIR)$(PREFIX)/lib/libcolour.so"
+
+
check: test
./test
clean:
-rm -- *.o *.a *.so *.so.* test
-.PHONY: all clean check
+.PHONY: all clean check install uninstall