aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-10-06 21:01:04 +0200
committerMattias Andrée <maandree@kth.se>2019-10-06 21:01:04 +0200
commit0444313a156322557cf9aad9333317ce9585221a (patch)
tree21b604f77759a102f4d7addf43a90b681bc3dd07 /Makefile
parentSimplify (diff)
downloadlibclut-0444313a156322557cf9aad9333317ce9585221a.tar.gz
libclut-0444313a156322557cf9aad9333317ce9585221a.tar.bz2
libclut-0444313a156322557cf9aad9333317ce9585221a.tar.xz
Add .so file
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4ed58b0..9230325 100644
--- a/Makefile
+++ b/Makefile
@@ -3,15 +3,24 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
-all: libclut.a
+VERSION_MAJOR = 1
+VERSION = 1.2
+
+all: libclut.a libclut.so
libclut.o: libclut.c libclut.h
$(CC) -c -o $@ libclut.c $(CPPFLAGS) $(CFLAGS)
+libclut.lo: libclut.c libclut.h
+ $(CC) -fPIC -c -o $@ libclut.c $(CPPFLAGS) $(CFLAGS)
+
libclut.a: libclut.o
$(AR) rc $@ libclut.o
$(AR) s $@
+libclut.so: libclut.lo
+ $(CC) -shared -Wl,-soname,libclut.so.$(VERSION_MAJOR) -o $@ $(LDFLAGS) libclut.lo
+
test.o: test.c libclut.h
$(CC) -c -o $@ test.c $(CPPFLAGS) $(CFLAGS)
@@ -21,17 +30,23 @@ test: test.o libclut.a
check: test
./test
-install: libclut.a
+install: libclut.a libclut.so
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
cp -- libclut.a "$(DESTDIR)$(PREFIX)/lib"
+ cp -- libclut.so "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(VERSION_MAJOR)"
+ ln -sf -- libclut.so.$(VERSION_MAJOR) "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(VERSION)"
+ ln -sf -- libclut.so.$(VERSION_MAJOR) "$(DESTDIR)$(PREFIX)/lib/libclut.so"
cp -- libclut.h "$(DESTDIR)$(PREFIX)/include"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.a"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(VERSION_MAJOR)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(VERSION)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libclut.h"
clean:
- -rm -f -- *.o *.a test
+ -rm -f -- *.o *.a *.so *.lo *.su test
.PHONY: all check install uninstall clean