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_CFLAGS = `$(VLC_CONFIG) --cflags plugin $@`
23 AM_CXXFLAGS = `$(VLC_CONFIG) --cxxflags plugin $@`
24 AM_OBJCFLAGS = `$(VLC_CONFIG) --objcflags plugin $@`
25 AM_LDFLAGS = -rpath '$(libvlcdir)' \
26 -avoid-version -module -no-undefined \
28 `$(VLC_CONFIG) --ldflags plugin $@`
29 AM_LIBADD = $(LTLIBVLC)
31 if HAVE_COMPILER_EXPORT
32 AM_LDFLAGS += -export-dynamic
34 AM_LDFLAGS += -export-symbol-regex ^vlc_entry
41 $(top_builddir)/compile
43 # Find out which modules were enabled and tell make to build them
45 @set fnord $$MAKEFLAGS; amf=$$2; targets=`\
46 z=$$($(VLC_CONFIG) --list plugin); for mod in $(mods); do case "$$z " in *\ $${mod}\ *) echo lib$${mod}_plugin.la;; esac; done; \
47 `; case "$$targets" in *lib*) $(MAKE) $(AM_MAKEFLAGS) $$targets || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \
50 # Build a plugin with the adequate linker and linker's flags
51 _plugin.la_plugin$(LIBEXT):
52 @mod="$*" ; mod=$${mod#lib} ; \
53 ldfl="`$(VLC_CONFIG) --libs plugin $$mod` $(LIBVLC) -u $(SYMPREF)$(VLC_ENTRY)" ; \
54 case `$(VLC_CONFIG) --linkage $$mod` in \
55 c++) ld="$(CXXLINK)" ;; \
56 objc) ld="$(OBJCLINK)" ;; \
57 c|*) ld="$(LINK)" ;; \
59 echo $$ld $< $$ldfl ; \
63 $(srcdir)/Makefile.am: $(srcdir)/Modules.am $(top_srcdir)/modules/genmf
64 cd \$(top_srcdir) && \$(SHELL) modules/genmf ${dir}
70 ### automake creates libvlcdir after running install-*-local
71 ### so we have to create it ourselves first
72 install-exec-local: all-modules
73 @if test -z "$(libvlc_LTLIBRARIES)"; then \
74 z=$$($(VLC_CONFIG) --list plugin); \
75 m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
77 $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" install-libvlcLTLIBRARIES || exit $$? ; \
81 @if test -z "$(libvlc_LTLIBRARIES)"; then \
82 z=$$($(VLC_CONFIG) --list plugin); \
83 m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
85 $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" uninstall-libvlcLTLIBRARIES || exit $$?; \