Further work in progress on build system -- port over test modules.
This commit is contained in:
parent
2e63a2f2fe
commit
6f0cbc059d
|
@ -2,11 +2,11 @@
|
|||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
#@TODO@ build_target libs || return 1
|
||||
build_target @TEST_LIBS@ || return 1
|
||||
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
if [ -z ${@CNAME@_BUILT} ]
|
||||
then
|
||||
LIBS="" # @TODO@ internal libs
|
||||
LIBS="@LINK_LIBS@"
|
||||
EXTRAS="" # @TODO@ libs, cflags
|
||||
|
||||
echo "Building test programs..."
|
||||
|
@ -36,7 +36,7 @@ then
|
|||
|
||||
print_success "All tests built"
|
||||
|
||||
@NAME@_BUILT=1
|
||||
@CNAME@_BUILT=1
|
||||
fi
|
||||
|
||||
# kate: @KATE_MODELINE@
|
||||
|
|
|
@ -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} ]
|
||||
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/${NAME} already exists."
|
||||
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
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
* http://www.gnu.org/copyleft/gpl.html for details.
|
||||
*/
|
||||
|
||||
@TODO@ includes
|
||||
|
||||
@TEST_HEADERS@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
@ -39,6 +38,6 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
kate: @KATE_MODELINE@
|
||||
vim: @VIM_MODELINE@
|
||||
*/
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
#@TODO@ build_target libs || return 1
|
||||
build_target @TEST_LIBS@ || return 1
|
||||
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
if [ -z ${@CNAME@_BUILT} ]
|
||||
then
|
||||
LIBS="" # @TODO@ internal libs
|
||||
LIBS="@LINK_LIBS@"
|
||||
EXTRAS="" # @TODO@ libs, cflags
|
||||
|
||||
echo "Building test programs..."
|
||||
do_cmd mkdir -p obj/tests || return 1
|
||||
|
||||
for SRC in src/@NAME@/*.c
|
||||
for SRC in src/@NAME@/*.cpp
|
||||
do
|
||||
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.c$,,')"
|
||||
MODIFIED=0
|
||||
|
@ -36,7 +36,7 @@ then
|
|||
|
||||
print_success "All tests built"
|
||||
|
||||
@NAME@_BUILT=1
|
||||
@CNAME@_BUILT=1
|
||||
fi
|
||||
|
||||
# kate: @KATE_MODELINE@
|
||||
|
|
|
@ -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} ]
|
||||
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/${NAME} already exists."
|
||||
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
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
* http://www.gnu.org/copyleft/gpl.html for details.
|
||||
*/
|
||||
|
||||
@TODO@ includes
|
||||
|
||||
#include "stdio.h"
|
||||
@TEST_HEADERS@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
|
@ -23,12 +22,13 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
int ret = 0;
|
||||
|
||||
// TODO
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
kate: @KATE_MODELINE@
|
||||
vim: @VIM_MODELINE@
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
cd $(dirname $0)
|
||||
cd $(dirname $(pwd))
|
||||
P=$(basename $(pwd))
|
||||
TOP=$(pwd)
|
||||
[ -z "${VERBOSE}" ] && VERBOSE="0"
|
||||
source scripts/functions.sh || exit 1
|
||||
|
||||
|
@ -76,6 +77,7 @@ then
|
|||
fi
|
||||
|
||||
cleanup() {
|
||||
cd ${TOP}
|
||||
rm -rf "src/${NAME}"
|
||||
print_failure "Removed 'src/${NAME}'"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue