1 # Common code for VLC modules/.../Makefile.am
3 # Copyright (C) 2005-2007 the VideoLAN team
4 # Copyright (C) 2005-2008 RĂ©mi Denis-Courmont
6 # Authors: Sam Hocevar <sam@zoy.org>
9 SUFFIXES = _plugin$(LIBEXT) _plugin.la
11 libvlcdir = $(libdir)/vlc/$(basedir)
13 EXTRA_DIST = Modules.am
17 include $(srcdir)/Modules.am
20 LTLIBVLC = $(top_builddir)/src/libvlc.la
22 AM_LDFLAGS = -rpath '$(libvlcdir)' \
23 -avoid-version -module -no-undefined \
25 if HAVE_COMPILER_EXPORT
26 AM_LDFLAGS += -export-dynamic
28 AM_LDFLAGS += -export-symbol-regex ^vlc_entry
30 AM_LIBADD = $(LTLIBVLC)
36 $(top_builddir)/compile
38 # Find out which modules were enabled and tell make to build them
40 @set fnord $$MAKEFLAGS; amf=$$2; targets=`\
41 z=$$($(VLC_CONFIG) --list plugin); for mod in $(mods); do case "$$z " in *\ $${mod}\ *) echo lib$${mod}_plugin.la;; esac; done; \
42 `; case "$$targets" in *lib*) $(MAKE) $(AM_MAKEFLAGS) $$targets || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \
45 # Build a plugin with the adequate linker and linker's flags
46 _plugin.la_plugin$(LIBEXT):
47 @mod="$*" ; mod=$${mod#lib} ; \
48 ldfl="`$(VLC_CONFIG) --libs plugin $$mod` $(LIBVLC) -u $(SYMPREF)$(VLC_ENTRY)" ; \
49 case `$(VLC_CONFIG) --linkage $$mod` in \
50 c++) ld="$(CXXLINK)" ;; \
51 objc) ld="$(OBJCLINK)" ;; \
52 c|*) ld="$(LINK)" ;; \
54 echo $$ld $< $$ldfl ; \
58 $(srcdir)/Makefile.am: $(srcdir)/Modules.am $(top_srcdir)/modules/genmf
59 cd \$(top_srcdir) && \$(SHELL) modules/genmf ${dir}
65 ### automake creates libvlcdir after running install-*-local
66 ### so we have to create it ourselves first
67 install-exec-local: all-modules
68 @if test -z "$(libvlc_LTLIBRARIES)"; then \
69 z=$$($(VLC_CONFIG) --list plugin); \
70 m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
72 $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" install-libvlcLTLIBRARIES || exit $$? ; \
76 @if test -z "$(libvlc_LTLIBRARIES)"; then \
77 z=$$($(VLC_CONFIG) --list plugin); \
78 m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
80 $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" uninstall-libvlcLTLIBRARIES || exit $$?; \