1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: build shared library
Upstream only builds a static library, this adds a shared one.
Author: Sascha Steinbiss <sascha@steinbiss.name>
Last-Update: 2016-01-08
--- 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 @@
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 @@
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*
|