- sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
- do
- LINKER="LINK"
- if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
- echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
- if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
- echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
- if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
- LINKER="CXXLINK"
- echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
- if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
- LINKER="OBJCLINK"
- echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
- if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
- echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
- if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
- PRIVATE='#'; else
- PRIVATE=''; fi
- if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
- NODIST=''; else
- NODIST='#'; fi
- cat >> configure.ac << EOF
-AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
-AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
-EOF
-# Generation of Modules.am
-# ~~~~~~~~~~~~~~~~~~~~~~~~
-# - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
-# S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
-# the resulting file size.
-# - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
-# does not seem to work properly with any automake version I tested.
- cat >> Modules.am << EOF
-# The ${mod} plugin
-
-if ${mod}_plugin
-if UNTRUE
-L_${mod}_p = ${dir}/lib${mod}_plugin.a
-endif
-D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
-${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
-endif
-if ${mod}_builtin
-L_${mod}_b = ${dir}/lib${mod}.a
-F_${mod}_b = \$(LDFLAGS_${mod})
-if BUILD_MOZILLA
-L_${mod}_pic = ${dir}/lib${mod}_pic.a
-endif
-${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
-endif
-
-L_builtin += \$(L_${mod}_b)
-L_builtin_pic += \$(L_${mod}_pic)
-LDFLAGS_builtin += \$(F_${mod}_b)
-${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
-PLUGIN_FILES += \$(D_${mod}_p)
-
-${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
-${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
-${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
-${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
-${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
-${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
-
-${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
-${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
-${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
-${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
-${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
-${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
-
-${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
-${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
-${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
-${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
-${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
-${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
-
-libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
-lib${mod}_DATA = \$(D_${mod}_p)
-
-lib${mod}dir = \$(libdir)/vlc/${topdir}
-${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
-${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
-${PRIVATE} \$(${LINKER}) \$(${sym}_lib${mod}_plugin_a_OBJECTS) -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})