From 0444313a156322557cf9aad9333317ce9585221a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 6 Oct 2019 21:01:04 +0200 Subject: Add .so file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 21 ++++++++++++++++++--- 1 file 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 -- cgit v1.2.3-70-g09d2