Work in progress on simplifying instantiation.
This commit is contained in:
parent
8bff482066
commit
d12c36aa2a
|
@ -1,21 +1,21 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@
|
||||
# @NAME@_BUILT
|
||||
# @CNAME@
|
||||
# @CNAME@_BUILT
|
||||
#
|
||||
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
if [ -z ${@CNAME@_BUILT} ]
|
||||
then
|
||||
@NAME@="obj/@NAME@"
|
||||
@CNAME@="obj/@NAME@"
|
||||
EXTRAS="@TODO@" # cflags, libs
|
||||
|
||||
echo "Building application ${@NAME@}..."
|
||||
echo "Building application ${@CNAME@}..."
|
||||
|
||||
do_cmd source src/@NAME@/build.monolithic || return 1
|
||||
|
||||
MODIFIED=0
|
||||
for test in ${MONOLITHIC_TESTS} ${SRC}
|
||||
do
|
||||
if [ ${test} -nt ${@NAME@} ]
|
||||
if [ ${test} -nt ${@CNAME@} ]
|
||||
then
|
||||
MODIFIED=1
|
||||
break
|
||||
|
@ -33,7 +33,7 @@ then
|
|||
print_success "Application up to date"
|
||||
fi
|
||||
|
||||
@NAME@_BUILT=1
|
||||
@CNAME@_BUILT=1
|
||||
|
||||
fi
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ build_dir_tree "${BINDIR}" || return 1
|
|||
|
||||
# install binary
|
||||
echo "Installing binaries into '${BINDIR}'"
|
||||
install_file "${@NAME@}" "${BINDIR}" 0755 || return 1
|
||||
install_file "${@CNAME@}" "${BINDIR}" 0755 || return 1
|
||||
print_success "Done"
|
||||
|
||||
# kate: @KATE_MODELINE@
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@_MONOLITHIC
|
||||
# @CNAME@_MONOLITHIC
|
||||
#
|
||||
|
||||
SRC="obj/@NAME@.cpp"
|
||||
MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
|
||||
|
||||
if [ -z "${@NAME@_MONOLITHIC}" ]
|
||||
if [ -z "${@CNAME@_MONOLITHIC}" ]
|
||||
then
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.cpp)"
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
|
||||
make_monolithic ${SRC} C || return 1
|
||||
|
||||
@NAME@_MONOLITHIC=1
|
||||
@CNAME@_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -4,22 +4,8 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e src/${NAME} ]
|
||||
then
|
||||
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."
|
||||
do_parameter_subst
|
||||
true
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
if [ $# -ne 2 ]
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need HEADER_NAME."
|
||||
print_failure "Wrong number of arguments after module; need HEADER_NAME."
|
||||
echo "HEADER_NAME is the name of the header file."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -8,12 +8,6 @@ fi
|
|||
HEADER_NAME=$1
|
||||
shift
|
||||
|
||||
if [ -e src/${NAME} ]
|
||||
then
|
||||
print_failure "src/${NAME} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
|
||||
then
|
||||
echo "Warning: your module name does not begin with 'lib'. You will"
|
||||
|
@ -23,15 +17,7 @@ else
|
|||
NAMEMINUSL="-l$(echo ${NAME} | sed -e 's,^lib,,')"
|
||||
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_parameter_subst NAMEMINUSL HEADER_NAME
|
||||
|
||||
true
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
if [ $# -ne 2 ]
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need HEADER_NAME."
|
||||
print_failure "Wrong number of arguments after module; need HEADER_NAME."
|
||||
echo "HEADER_NAME is the name of the header file."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -8,12 +8,6 @@ fi
|
|||
HEADER_NAME=$1
|
||||
shift
|
||||
|
||||
if [ -e src/${NAME} ]
|
||||
then
|
||||
print_failure "src/${NAME} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(echo ${NAME} | cut -b1-3)" != "lib" ]
|
||||
then
|
||||
echo "Warning: your module name does not begin with 'lib'. You will"
|
||||
|
@ -23,15 +17,7 @@ else
|
|||
NAMEMINUSL="-l$(echo ${NAME} | sed -e 's,^lib,,')"
|
||||
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_parameter_subst NAMEMINUSL HEADER_NAME
|
||||
|
||||
true
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
|
|
|
@ -69,7 +69,19 @@ do_parameter_subst() {
|
|||
|
||||
|
||||
|
||||
if [ -e "src/${NAME}" ]
|
||||
then
|
||||
print_failure "Module 'src/${NAME}' already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Instantiating module 'src/${NAME}'..."
|
||||
do_cmd cp -r ${TEMPLATE} src/${NAME} || exit 1
|
||||
do_cmd cd src/${NAME} || exit 1
|
||||
do_cmd rm instantiate || exit 1
|
||||
|
||||
do_cmd source ${TEMPLATE}/instantiate || exit 1
|
||||
|
||||
print_success "Module instantiated"
|
||||
grep -r "@TODO@" .
|
||||
true
|
||||
|
|
Loading…
Reference in New Issue