loader: Upgrade pop/push pack headers from latest wine git to fix compilation on...
[vlc/vlc-acra.git] / modules / genmf
blob156b8862b69f044e87266ad34c1f45c471438e7c
1 #! /bin/sh
3 ## genmf file for the VLC media player
4 ##
5 ## Copyright (C) 2005-2007 the VideoLAN team
6 ##
7 ## Authors: Sam Hocevar <sam@zoy.org>
8 ## RĂ©mi Denis-Courmont <rem # videolan # org>
10 cd $(dirname "$0")/.. || exit 1
12 while test "$1"
14 printf "."
15 dir="$1"
16 modf="modules/${dir}/Modules.am"
17 makf="modules/${dir}/Makefile.am"
18 basedir="`echo "${dir}" | cut -f1 -d/`"
19 # automake will not recurse for make dist if we don't define SUBDIRS = .
20 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
21 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
22 extra_ltlibs=""
23 for mod in $mods
25 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la"
26 done
27 rm -f "${makf}" && cat > "${makf}" << EOF
28 # ${makf} automatically generated from ${modf} by bootstrap
29 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
31 basedir = ${basedir}
32 mods = ${mods}
34 NULL =
35 libvlc_LTLIBRARIES =
36 EXTRA_DIST = Modules.am
37 BUILT_SOURCES =
38 CLEANFILES =
39 SUBDIRS = ${subdirs}
40 SUFFIXES = _plugin\$(LIBEXT) _plugin.la
42 libvlcdir = \$(libdir)/vlc/\$(basedir)
44 EXTRA_LTLIBRARIES = ${extra_ltlibs}
46 include Modules.am
48 if HAVE_PLUGINS
49 LTLIBVLC = \$(top_builddir)/src/libvlc.la
51 AM_LDFLAGS = -rpath '\$(libvlcdir)' -avoid-version \\
52 -module -no-undefined -shrext \$(LIBEXT)
53 if HAVE_COMPILER_EXPORT
54 AM_LDFLAGS += -export-dynamic
55 else
56 AM_LDFLAGS += -export-symbol-regex ^vlc_entry
57 endif
58 AM_LIBADD = \$(LTLIBVLC)
59 endif
61 all: all-modules
63 nice:
64 \$(top_builddir)/compile
66 # Find out which modules were enabled and tell make to build them
67 all-modules:
68 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
69 z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin.la;; esac; done; \\
70 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
71 test -z "\$\$fail"
73 # Build a plugin with the adequate linker and linker's flags
74 _plugin.la_plugin\$(LIBEXT):
75 @mod="\$*" ; mod=\$\${mod#lib} ; \
76 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBVLC) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
77 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
78 c++) ld="\$(CXXLINK)" ;; \
79 objc) ld="\$(OBJCLINK)" ;; \
80 c|*) ld="\$(LINK)" ;; \
81 esac ; \
82 echo \$\$ld \$< \$\$ldfl ; \
83 \$\$ld \$< \$\$ldfl
85 if MAINTAINER_MODE
86 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/modules/genmf
87 cd \$(top_srcdir) && \$(SHELL) modules/genmf ${dir}
88 endif
90 mostlyclean-local:
91 -rm -f -- *.la
93 ### automake creates libvlcdir after running install-*-local
94 ### so we have to create it ourselves first
95 install-exec-local: all-modules
96 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
97 z=\$\$(\$(VLC_CONFIG) --list plugin); \
98 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) printf " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
99 test -z "\$\$m" || \
100 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
103 uninstall-local:
104 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
105 z=\$\$(\$(VLC_CONFIG) --list plugin); \
106 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) printf " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
107 test -z "\$\$m" || \
108 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
112 for mod in $mods
114 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
115 NODIST=''; else
116 NODIST='#'; fi
117 cat >> m4/private.m4 << EOF
118 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
120 # Generation of modules/**/Makefile.am
121 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
123 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
124 # the resulting file size.
125 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
126 # work properly with any automake version I tested.
127 cat >> "${makf}" << EOF
128 # The ${mod} plugin
131 cat >> "${makf}" << EOF
132 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
134 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
135 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
136 CLEANFILES += \$(nodist_SOURCES_${mod})
137 BUILT_SOURCES += \$(B${mod})
140 cat >> "${makf}" << EOF
141 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
142 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
143 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
144 lib${mod}_plugin_la_LDFLAGS = \$(AM_LDFLAGS) \\
145 \`\$(VLC_CONFIG) --ldflags plugin ${mod}\`
146 lib${mod}_plugin_la_LIBADD = \$(AM_LIBADD) \\
147 \`\$(VLC_CONFIG) -libs plugin ${mod}\`
148 # Automake does not understand \`...\` very well inside LIBADD...
149 lib${mod}_plugin_la_DEPENDENCIES = \$(AM_LIBADD)
151 done
153 shift
154 done
155 printf "\n"