diff options
author | Mattias Andrée <maandree@kth.se> | 2021-09-08 20:54:25 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-09-08 20:54:25 +0200 |
commit | b73b10c4659994ec48f72f639bd308768764f2e8 (patch) | |
tree | 821dd8669fc881a02b9225623654466ce002361e /Makefile | |
parent | test: m + test separator removal (diff) | |
download | libnumtext-b73b10c4659994ec48f72f639bd308768764f2e8.tar.gz libnumtext-b73b10c4659994ec48f72f639bd308768764f2e8.tar.bz2 libnumtext-b73b10c4659994ec48f72f639bd308768764f2e8.tar.xz |
Add dynamic library
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 29 |
1 files changed, 24 insertions, 5 deletions
@@ -3,6 +3,16 @@ CONFIGFILE = config.mk include $(CONFIGFILE) +OS = linux +# linux = Linux +# macos = Mac OS +include $(OS).mk + +LIB_MAJOR = 1 +LIB_MINOR = 0 +LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) + + LANG =\ swedish @@ -11,6 +21,9 @@ OBJ =\ libnumtext_remove_separators.o\ $(LANG:=.o) +LOBJ =\ + $(OBJ:.o=.lo) + HDR =\ libnumtext.h\ common.h @@ -22,9 +35,9 @@ TEST_OBJ =\ $(TEST:=.o) -all: libnumtext.a +all: libnumtext.a libnumtext.$(LIBEXT) $(OBJ): $(HDR) -$(OBJ:.o=.lo): $(HDR) +$(LOBJ): $(HDR) $(TEST_OBJ): libnumtext.h $(TEST): libnumtext.a @@ -41,6 +54,9 @@ libnumtext.a: $(OBJ) @rm -f -- $@ $(AR) rc $@ $(OBJ) +libnumtext.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) + check: $(TEST) @set -e &&\ for t in $(TEST); do\ @@ -48,18 +64,21 @@ check: $(TEST) "./$$t" || exit 1;\ done -install: libnumtext.a +install: libnumtext.a libnumtext.$(LIBEXT) mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" mkdir -p -- "$(DESTDIR)$(PREFIX)/include" cp -- libnumtext.a "$(DESTDIR)$(PREFIX)/lib/" + cp -- libnumtext.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libnumtext.$(LIBMINOREXT)" + ln -sf -- libnumtext.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libnumtext.$(LIBMAJOREXT)" + ln -sf -- libnumtext.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libnumtext.$(LIBEXT)" cp -- libnumtext.h "$(DESTDIR)$(PREFIX)/include/" uninstall: - -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libnumtext.a" + -rm -f -- "$(DESTDIR)$(PREFIX)/lib/libnumtext".* -rm -f -- "$(DESTDIR)$(PREFIX)/include/libnumtext.h" clean: - -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda *.test + -rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda *.test *.dylib .SUFFIXES: .SUFFIXES: .lo .o .c .test .test.o |