Further work on the module instantiation scripts.

This commit is contained in:
Laurence Withers 2006-07-25 20:19:46 +01:00
parent d12c36aa2a
commit 7d02fbde09
5 changed files with 16 additions and 24 deletions

View File

@ -26,7 +26,7 @@ then
then then
echo " Compiling..." echo " Compiling..."
do_cmd ${CXX} ${CFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1 do_cmd ${CXX} ${CFLAGS} -o "${@CNAME@}" ${SRC} ${EXTRAS} || return 1
print_success "Application built" print_success "Application built"
else else

View File

@ -26,7 +26,7 @@ then
then then
echo " Compiling..." echo " Compiling..."
do_cmd ${CC} ${CFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1 do_cmd ${CC} ${CFLAGS} -o "${@CNAME@}" ${SRC} ${EXTRAS} || return 1
print_success "Application built" print_success "Application built"
else else

View File

@ -7,7 +7,7 @@ MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
if [ -z "${@NAME@_MONOLITHIC}" ] if [ -z "${@NAME@_MONOLITHIC}" ]
then then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.c)" MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.c)"
make_monolithic ${SRC} C || return 1 make_monolithic ${SRC} C || return 1
@NAME@_MONOLITHIC=1 @NAME@_MONOLITHIC=1

View File

@ -4,22 +4,8 @@ then
exit 1 exit 1
fi fi
if [ -e src/${NAME} ] do_parameter_subst
then true
print_failure "src/${NAME} already exists."
exit 1
fi
echo "Instantiating module src/${NAME}..."
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."
# kate: replace-trailing-space-save true; space-indent true; tab-width 4; # kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4 # vim: expandtab:ts=4:sw=4

View File

@ -75,12 +75,18 @@ then
exit 1 exit 1
fi fi
echo "Instantiating module 'src/${NAME}'..." cleanup() {
do_cmd cp -r ${TEMPLATE} src/${NAME} || exit 1 rm -rf "src/${NAME}"
do_cmd cd src/${NAME} || exit 1 print_failure "Removed 'src/${NAME}'"
do_cmd rm instantiate || exit 1 exit 1
}
do_cmd source ${TEMPLATE}/instantiate || exit 1 echo "Instantiating module 'src/${NAME}'..."
do_cmd cp -rL ${TEMPLATE} src/${NAME} || cleanup
do_cmd cd src/${NAME} || cleanup
do_cmd rm instantiate || cleanup
( source ../../${TEMPLATE}/instantiate ) || cleanup
print_success "Module instantiated" print_success "Module instantiated"
grep -r "@TODO@" . grep -r "@TODO@" .