vlc/modules/genmf

71 lines
1.7 KiB
Bash
Executable File

#! /bin/sh
## genmf file for the VLC media player
##
## Copyright (C) 2005-2007 the VideoLAN team
##
## Authors: Sam Hocevar <sam@zoy.org>
## Rémi Denis-Courmont <rem # videolan # org>
cd $(dirname "$0")/.. || exit 1
while test "$1"
do
printf "."
dir="$1"
modf="modules/${dir}/Modules.am"
if ! test -f "$modf"; then
echo "$modf does not exist!" >&2
exit 1
fi
makf="modules/${dir}/Makefile.am"
basedir="`echo "${dir}" | cut -f1 -d/`"
mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | sort | uniq | xargs`"
plugins="`sed -n -e 's/^.*lib\([^ ]*\)_plugin\.la.*/\1/p' < "${modf}" | sort | uniq | xargs`"
libvlc_ltlibs=""
extra_ltlibs=""
for mod in $mods
do
case " ${plugins} " in
*\ ${mod}\ *)
;;
*)
libvlc_ltlibs="${libvlc_ltlibs} \$(LTLIB${mod})"
extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la"
;;
esac
done
rm -f "${makf}" && cat > "${makf}" << EOF
# ${makf} automatically generated from ${modf} by $0
# DO NOT EDIT THIS FILE DIRECTLY! See Modules.am instead.
basedir = ${basedir}
dir = ${dir}
mods = ${mods}
libvlc_LTLIBRARIES = ${libvlc_ltlibs}
EXTRA_LTLIBRARIES = ${extra_ltlibs}
include \$(top_srcdir)/modules/common.am
EOF
for mod in $mods
do
cat >> "${makf}" << EOF
# The ${mod} plugin
lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
# Force per-target objects:
lib${mod}_plugin_la_CFLAGS = \$(AM_CFLAGS)
lib${mod}_plugin_la_CXXFLAGS = \$(AM_CXXFLAGS)
lib${mod}_plugin_la_OBJCFLAGS = \$(AM_OBJCFLAGS)
# Set LIBADD and DEPENDENCIES manually:
lib${mod}_plugin_la_LIBADD = \$(AM_LIBADD)
lib${mod}_plugin_la_DEPENDENCIES = \$(top_srcdir)/src/libvlccore.sym
EOF
done
shift
done
printf "\n"