[rtmpdump] r512 - trunk/librtmp/Makefile

hyc subversion at mplayerhq.hu
Thu Jun 17 21:13:45 CEST 2010


Author: hyc
Date: Thu Jun 17 21:13:44 2010
New Revision: 512

Log:
Simple rules for shared lib, v2.2f

Modified:
   trunk/librtmp/Makefile

Modified: trunk/librtmp/Makefile
==============================================================================
--- trunk/librtmp/Makefile	Thu Jun 17 20:42:04 2010	(r511)
+++ trunk/librtmp/Makefile	Thu Jun 17 21:13:44 2010	(r512)
@@ -1,4 +1,4 @@
-VERSION=v2.2e
+VERSION=v2.2f
 
 prefix=/usr/local
 
@@ -14,12 +14,27 @@ DEF_GNUTLS=-DUSE_GNUTLS
 DEF_=-DNO_CRYPTO
 REQ_GNUTLS=gnutls
 REQ_OPENSSL=libssl,libcrypto
+LIB_GNUTLS=-lgnutls -lgcrypt
+LIB_OPENSSL=-lssl -lcrypto
+LIB_POLARSSL=-lpolarssl
+CRYPTO_LIB=$(LIB_$(CRYPTO))
 CRYPTO_REQ=$(REQ_$(CRYPTO))
 CRYPTO_DEF=$(DEF_$(CRYPTO))
 
+SHARED=SO
+SODEF_=
+SODEF_SO=-fPIC
+SOLIB_=
+SOLIB_SO=librtmp.so
+SOINST_=
+SOINST_SO=install_so
+SO_DEF=$(SODEF_$(SHARED))
+SO_LIB=$(SOLIB_$(SHARED))
+SO_INST=$(SOINST_$(SHARED))
+
 DEF=-DRTMPDUMP_VERSION=\"$(VERSION)\" $(CRYPTO_DEF) $(XDEF)
 OPT=-O2
-CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT)
+CFLAGS=-Wall $(XCFLAGS) $(INC) $(DEF) $(OPT) $(SO_DEF)
 
 incdir=$(prefix)/include/librtmp
 libdir=$(prefix)/lib
@@ -28,14 +43,22 @@ INCDIR=$(DESTDIR)$(incdir)
 LIBDIR=$(DESTDIR)$(libdir)
 MANDIR=$(DESTDIR)$(mandir)
 
-all:	librtmp.a
+OBJS=rtmp.o log.o amf.o hashswf.o parseurl.o
+
+all:	librtmp.a $(SO_LIB)
 
 clean:
 	rm -f *.o *.a
 
-librtmp.a: rtmp.o log.o amf.o hashswf.o parseurl.o
+librtmp.a: $(OBJS)
 	$(AR) rs $@ $?
 
+librtmp.so.0: $(OBJS)
+	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB)
+
+librtmp.so: librtmp.so.0
+	ln -sf $? $@
+
 log.o: log.c log.h Makefile
 rtmp.o: rtmp.c rtmp.h rtmp_sys.h handshake.h dh.h log.h amf.h Makefile
 amf.o: amf.c amf.h bytes.h log.h Makefile
@@ -46,9 +69,15 @@ 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:	install_base $(SO_INST)
+
+install_base:	librtmp.a librtmp.pc
 	-mkdir -p $(INCDIR) $(LIBDIR)/pkgconfig $(MANDIR)/man3
 	cp amf.h http.h log.h rtmp.h $(INCDIR)
 	cp librtmp.a $(LIBDIR)
 	cp librtmp.pc $(LIBDIR)/pkgconfig
 	cp librtmp.3 $(MANDIR)/man3
+
+install_so:	librtmp.so.0
+	cp librtmp.so.0 $(LIBDIR)
+	cd $(LIBDIR); ln -sf librtmp.so.0 librtmp.so


More information about the rtmpdump mailing list