Further work in progress on build system -- port over test modules.

This commit is contained in:
Laurence Withers 2006-07-26 19:30:26 +01:00
commit 6f0cbc059d
7 changed files with 57 additions and 50 deletions

View file

@ -1,25 +1,28 @@
if [ $# -ne 0 ]
if [ $# -lt 1 ]
then
print_failure "Unexpected extra parameters."
print_failure "You must specify the library modules to link against."
exit 1
fi
if [ -e src/${NAME} ]
then
print_failure "src/${NAME} already exists."
exit 1
fi
TEST_LIBS=$@
for lib in ${TEST_LIBS}
do
cname="$(get_cname ${lib})"
LINK_LIBS="\${${cname}} ${LINK_LIBS}"
if [ ! -e ../${lib}/build.lib ]
then
print_failure "src/${lib} is not a library"
exit 1
fi
echo "Instantiating module src/${NAME}..."
# HACK -- we need to extract the library's header name
do_cmd export ${cname}_MONOLITHIC="1"
do_cmd source ../${lib}/build.monolithic || exit 1
TEST_HEADERS="#include \"${HDR}\"\n${TEST_HEADERS}"
done
do_cmd mkdir src/${NAME} || exit 1
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
do_cmd cd src/${NAME} || exit 1
do_cmd rm instantiate || exit 1
do_cmd find . -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1
do_cmd grep "@TODO@" * || exit 1
print_success "Module instantiated."
do_parameter_subst TEST_LIBS LINK_LIBS TEST_HEADERS
true
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4