Author: Lars Müller Subject: Build libiniparser as shared library --- iniparser-2.15/Makefile +++ iniparser-2.15/Makefile 2006-04-11 17:59:16 @@ -4,12 +4,16 @@ # Compiler settings CC = gcc -CFLAGS = -O3 +CFLAGS = -O3 -fPIC # Ar settings to build the library AR = ar ARFLAGS = rcv +SHLD = ${CC} ${CFLAGS} +LDSHFLAGS = -shared -Wl,-Bsymbolic -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib +LDFLAGS = -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib + # Set RANLIB to ranlib on systems that require it (Sun OS < 4, Mac OSX) # RANLIB = ranlib RANLIB = true @@ -34,12 +38,16 @@ OBJS = $(SRCS:.c=.o) -default: libiniparser.a +default: libiniparser.a libiniparser.so libiniparser.a: $(OBJS) @($(AR) $(ARFLAGS) libiniparser.a $(OBJS)) @($(RANLIB) libiniparser.a) +libiniparser.so: $(OBJS) + @$(SHLD) $(LDSHFLAGS) -o $@.0 $(OBJS) $(LDFLAGS) \ + -Wl,-soname=`basename $@`.0 + clean: $(RM) $(OBJS)