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