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