[PATCH] Build a shared library.
Fabian Greffrath
fabian at greffrath.com
Thu Jun 10 09:22:54 UTC 2010
---
librtmp/Makefile | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/librtmp/Makefile b/librtmp/Makefile
index 88fd611..bc5b939 100644
--- a/librtmp/Makefile
+++ b/librtmp/Makefile
@@ -28,12 +28,17 @@ INCDIR=$(DESTDIR)$(incdir)
LIBDIR=$(DESTDIR)$(libdir)
MANDIR=$(DESTDIR)$(mandir)
-all: librtmp.a
+LIBRARY=librtmp.a
+LIBRARY_SO=librtmp.so
+LIBRARY_SO_VER=librtmp.so.0
+
+all: $(LIBRARY) $(LIBRARY_SO)
clean:
- rm -f *.o *.a
+ rm -f *.a *.lo *.o *.so *.so.*
-librtmp.a: rtmp.o log.o amf.o hashswf.o parseurl.o
+# Static library
+$(LIBRARY): rtmp.o log.o amf.o hashswf.o parseurl.o
$(AR) rs $@ $?
log.o: log.c log.h Makefile
@@ -42,13 +47,34 @@ amf.o: amf.c amf.h bytes.h log.h Makefile
hashswf.o: hashswf.c http.h rtmp.h rtmp_sys.h Makefile
parseurl.o: parseurl.c rtmp.h rtmp_sys.h log.h Makefile
+%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+# shared library
+$(LIBRARY_SO_VER): rtmp.lo log.lo amf.lo hashswf.lo parseurl.lo
+ $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $?
+
+$(LIBRARY_SO): $(LIBRARY_SO_VER)
+ ln -sf $? $@
+
+log.lo: log.c log.h Makefile
+rtmp.lo: rtmp.c rtmp.h rtmp_sys.h handshake.h dh.h log.h amf.h Makefile
+amf.lo: amf.c amf.h bytes.h log.h Makefile
+hashswf.lo: hashswf.c http.h rtmp.h rtmp_sys.h Makefile
+parseurl.lo: parseurl.c rtmp.h rtmp_sys.h log.h Makefile
+
+%.lo: %.c
+ $(CC) $(CFLAGS) -fPIC -o $@ -c $<
+
librtmp.pc: librtmp.pc.in Makefile
sed -e "s;@prefix@;$(prefix);" -e "s;@VERSION@;$(VERSION);" \
-e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" librtmp.pc.in > $@
-install: librtmp.a librtmp.pc
+install: $(LIBRARY) $(LIBRARY_SO) librtmp.pc
-mkdir -p $(INCDIR) $(LIBDIR)/pkgconfig $(MANDIR)/man3
cp amf.h http.h log.h rtmp.h $(INCDIR)
- cp librtmp.a $(LIBDIR)
+ cp $(LIBRARY) $(LIBDIR)
+ cp $(LIBRARY_SO) $(LIBDIR)
+ cp $(LIBRARY_SO_VER) $(LIBDIR)
cp librtmp.pc $(LIBDIR)/pkgconfig
cp librtmp.3 $(MANDIR)/man3
--
1.7.1
--------------060006080805060801020301--
More information about the pkg-multimedia-maintainers
mailing list