build shared library
authorSascha Steinbiss <sascha@steinbiss.name>
Sat, 14 Dec 2024 18:47:40 +0000 (19:47 +0100)
committerAndreas Tille <tille@debian.org>
Sat, 14 Dec 2024 18:47:40 +0000 (19:47 +0100)
Last-Update: 2016-01-08

Upstream only builds a static library, this adds a shared one.

Gbp-Pq: Name make_shared_lib

Makefile

index edda713e556b0e89fee4903aa24a51fb9ec96ed1..1e11a07abacf103cb89d35c0c7d86aa8a7b7d09c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC=                    gcc
-CFLAGS=                -g -Wall -O2 -Wno-unused-function #-fno-inline-functions -fno-inline-functions-called-once
+CFLAGS=                -g -Wall -O2 -fPIC  #-fno-inline-functions -fno-inline-functions-called-once
 CPPFLAGS=
 INCLUDES=      
 OBJS=          kthread.o misc.o \
@@ -8,13 +8,14 @@ OBJS=         kthread.o misc.o \
                        unitig.o mag.o bubble.o ksw.o
 PROG=          fml-asm
 LIBS=          -lm -lz -lpthread
+SONUMBER=0
 
 .SUFFIXES:.c .o
 
 .c.o:
                $(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@
 
-all:$(PROG)
+all:$(PROG) libfml.so.$(SONUMBER)
 
 fml-asm:libfml.a example.o
                $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS)
@@ -22,6 +23,10 @@ fml-asm:libfml.a example.o
 libfml.a:$(OBJS)
                $(AR) -csru $@ $(OBJS)
 
+libfml.so.$(SONUMBER): $(OBJS)
+               $(CC) -shared -o $@ $(OBJS) -fPIC -Wl,-soname,libfml.so.$(SONUMBER) $(LIBS) $(LDFLAGS)
+
+
 clean:
                rm -fr gmon.out *.o ext/*.o a.out $(PROG) *~ *.a *.dSYM session*