aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-10-06 20:56:39 +0200
committerMattias Andrée <maandree@kth.se>2019-10-06 20:59:47 +0200
commit41edeba76c45645a5ae4601b9ef2207f597a53be (patch)
tree4c21e957b4938de4c0fecbe0ed3ce080ca9867a7
parentSimplify (diff)
downloadlibred-41edeba76c45645a5ae4601b9ef2207f597a53be.tar.gz
libred-41edeba76c45645a5ae4601b9ef2207f597a53be.tar.bz2
libred-41edeba76c45645a5ae4601b9ef2207f597a53be.tar.xz
Add .so file
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2a747f0..7033e6d 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,10 @@
CONFIGFILE = config.mk
include $(CONFIGFILE)
-all: libred.a
+VERSION_MAJOR = 1
+VERSION = 1.0
+
+all: libred.a libred.so
solar.o: solar.c libred.h
blackbody.o: blackbody.c 10deg-xy.i 10deg-rgb.i libred.h
@@ -19,17 +22,26 @@ generate-table: generate-table.c blackbody.c 10deg-xy.i libred.h
.c.o:
$(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+.c.lo:
+ $(CC) -fPIC -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+
libred.a: solar.o blackbody.o
$(AR) rc $@ $?
$(AR) s $@
-install: libred.a
+libred.so: solar.lo blackbody.lo
+ $(CC) -shared -Wl,-soname,libred.so.$(VERSION_MAJOR) -o $@ $(LDFLAGS) solar.lo blackbody.lo
+
+install: libred.a libred.so
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man0"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3"
mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7"
cp -- libred.a "$(DESTDIR)$(PREFIX)/lib"
+ cp -- libred.so "$(DESTDIR)$(PREFIX)/lib/libred.so.$(VERSION_MAJOR)"
+ ln -sf -- libred.so.$(VERSION_MAJOR) "$(DESTDIR)$(PREFIX)/lib/libred.so.$(VERSION)"
+ ln -sf -- libred.so.$(VERSION_MAJOR) "$(DESTDIR)$(PREFIX)/lib/libred.so"
cp -- libred.h "$(DESTDIR)$(PREFIX)/include"
cp -- libred.h.0 "$(DESTDIR)$(MANPREFIX)/man0"
cp -- libred_check_timetravel.3 libred_get_colour.3 libred_solar_elevation.3 "$(DESTDIR)$(MANPREFIX)/man3"
@@ -37,6 +49,9 @@ install: libred.a
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libred.a"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libred.so.$(VERSION_MAJOR)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libred.so.$(VERSION)"
+ -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libred.so"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libred.h"
-rm -f -- "$(DESTDIR)$(MANPREFIX)/man0/libred.h.0"
-rm -f -- "$(DESTDIR)$(MANPREFIX)/man3/libred_check_timetravel.3"
@@ -48,6 +63,6 @@ clean:
-rm -f -- generate-table *.i *.o *.a *.lo *.su *.so
.SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .c .o .lo
.PHONY: all check install uninstall clean