]> git.sesse.net Git - vlc/blob - modules/common.am
Put common modules Makefiles stuff to an include file
[vlc] / modules / common.am
1 # Common code for VLC modules/.../Makefile.am
2 #
3 # Copyright (C) 2005-2007 the VideoLAN team
4 # Copyright (C) 2005-2008 RĂ©mi Denis-Courmont
5 #
6 # Authors: Sam Hocevar <sam@zoy.org>
7
8 NULL =
9 SUFFIXES = _plugin$(LIBEXT) _plugin.la
10
11 libvlcdir = $(libdir)/vlc/$(basedir)
12 libvlc_LTLIBRARIES =
13 EXTRA_DIST = Modules.am
14 BUILT_SOURCES =
15 CLEANFILES =
16
17 include $(srcdir)/Modules.am
18
19 if HAVE_PLUGINS
20 LTLIBVLC = $(top_builddir)/src/libvlc.la
21
22 AM_LDFLAGS = -rpath '$(libvlcdir)' \
23         -avoid-version -module -no-undefined \
24         -shrext $(LIBEXT)
25 if HAVE_COMPILER_EXPORT
26 AM_LDFLAGS += -export-dynamic
27 else
28 AM_LDFLAGS += -export-symbol-regex ^vlc_entry
29 endif
30 AM_LIBADD = $(LTLIBVLC)
31 endif
32
33 all: all-modules
34
35 nice:
36         $(top_builddir)/compile
37
38 # Find out which modules were enabled and tell make to build them
39 all-modules:
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; \
43         test -z "$$fail"
44
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)" ;; \
53         esac ; \
54         echo $$ld $< $$ldfl ; \
55         $$ld $< $$ldfl
56
57 if MAINTAINER_MODE
58 $(srcdir)/Makefile.am: $(srcdir)/Modules.am $(top_srcdir)/modules/genmf
59         cd \$(top_srcdir) && \$(SHELL) modules/genmf ${dir}
60 endif
61
62 mostlyclean-local:
63         -rm -f -- *.la
64
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` ; \
71           test -z "$$m" || \
72             $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" install-libvlcLTLIBRARIES || exit $$? ; \
73         fi
74
75 uninstall-local:
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` ; \
79           test -z "$$m" || \
80             $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" uninstall-libvlcLTLIBRARIES || exit $$?; \
81         fi
82