]> git.sesse.net Git - vlc/blob - modules/common.am
Allow building plugins through autotools-builtin means...
[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 =
10 libvlcdir = $(libdir)/vlc/$(basedir)
11 EXTRA_DIST = Modules.am
12 BUILT_SOURCES =
13 CLEANFILES = $(BUILT_SOURCES)
14
15 include $(srcdir)/Modules.am
16
17 if HAVE_PLUGINS
18 LTLIBVLC = $(top_builddir)/src/libvlc.la
19
20 AM_CFLAGS = `$(VLC_CONFIG) --cflags plugin $@`
21 AM_CXXFLAGS = `$(VLC_CONFIG) --cxxflags plugin $@`
22 AM_OBJCFLAGS = `$(VLC_CONFIG) --objcflags plugin $@`
23 AM_LDFLAGS = -rpath '$(libvlcdir)' \
24         -avoid-version -module -no-undefined \
25         -shrext $(LIBEXT) \
26          `$(VLC_CONFIG) --ldflags plugin $@`
27 AM_LIBADD = `$(VLC_CONFIG) -libs plugin $@` $(LTLIBVLC)
28
29 if HAVE_COMPILER_EXPORT
30 AM_LDFLAGS += -export-dynamic
31 else
32 AM_LDFLAGS += -export-symbol-regex ^vlc_entry
33 endif
34 endif
35
36 all: all-modules
37
38 nice:
39         $(top_builddir)/compile
40
41 # Find out which modules were enabled and tell make to build them
42 all-modules:
43         @set fnord $$MAKEFLAGS; amf=$$2; targets=`\
44         z=$$($(VLC_CONFIG) --list plugin); for mod in $(mods); do case "$$z " in *\ $${mod}\ *) echo lib$${mod}_plugin.la;; esac; done; \
45         `; case "$$targets" in *lib*) $(MAKE) $(AM_MAKEFLAGS) $$targets || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \
46         test -z "$$fail"
47
48 if MAINTAINER_MODE
49 $(srcdir)/Makefile.am: $(srcdir)/Modules.am $(top_srcdir)/modules/genmf
50         cd \$(top_srcdir) && \$(SHELL) modules/genmf $(dir)
51 endif
52
53 mostlyclean-local:
54         -rm -f -- *.la
55
56 ### automake creates libvlcdir after running install-*-local
57 ### so we have to create it ourselves first
58 install-exec-local: all-modules
59         @if test -z "$(libvlc_LTLIBRARIES)"; then \
60           z=$$($(VLC_CONFIG) --list plugin); \
61           m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
62           test -z "$$m" || \
63             $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" install-libvlcLTLIBRARIES || exit $$? ; \
64         fi
65
66 uninstall-local:
67         @if test -z "$(libvlc_LTLIBRARIES)"; then \
68           z=$$($(VLC_CONFIG) --list plugin); \
69           m=`for mod in $(mods); do case "$$z " in *\ $${mod}\ *) printf " lib$${mod}_plugin.la" ;; esac; done` ; \
70           test -z "$$m" || \
71             $(MAKE) $(AM_MAKEFLAGS) libvlc_LTLIBRARIES="$$m" uninstall-libvlcLTLIBRARIES || exit $$?; \
72         fi
73