Major work in progress on build system module instantiation.
This commit is contained in:
parent
9e8d1e4c15
commit
11f2baa34b
|
@ -8,4 +8,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,7 @@ then
|
|||
|
||||
echo "Building application ${@NAME@}..."
|
||||
|
||||
source src/cppapp/build.monolithic
|
||||
source src/@NAME@/build.monolithic
|
||||
|
||||
MODIFIED=0
|
||||
for test in ${MONOLITHIC_TESTS} ${SRC}
|
||||
|
@ -36,3 +36,6 @@ then
|
|||
@NAME@_BUILT=1
|
||||
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -7,3 +7,6 @@ build_dir_tree "${BINDIR}" || return 1
|
|||
echo "Installing binaries into '${BINDIR}'"
|
||||
install_file "${@NAME@}" "${BINDIR}" 0755 || return 1
|
||||
print_success "Done"
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -13,3 +13,6 @@ then
|
|||
@NAME@_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -14,8 +14,12 @@ echo "Instantiating module src/${NAME}..."
|
|||
|
||||
do_cmd mkdir src/${NAME} || exit 1
|
||||
do_cmd cp ${TEMPLATE}/* src/${NAME} || exit 1
|
||||
do_cmd rm src/${NAME}/instantiate || exit 1
|
||||
|
||||
do_cmd find src/${NAME} -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || 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;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* @P@/src/cpplib/BottomHeader.h
|
||||
/* @P@/src/@NAME@/BottomHeader.h
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
|
@ -8,4 +8,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
/* @P@/src/cpplib/TopHeader.h
|
||||
/* @P@/src/@NAME@/TopHeader.h
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_@PC@
|
||||
#define HEADER_@PC@
|
||||
#ifndef HEADER_@CNAME@
|
||||
#define HEADER_@CNAME@
|
||||
|
||||
// standard includes, or includes needed for type declarations
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/* @P@/src/cpplib/TopSource.cpp
|
||||
/* @P@/src/@NAME@/TopSource.cpp
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
#include "@HEADER_NAME@"
|
||||
#include "@HEADER@"
|
||||
|
||||
// Below are all the includes used throughout the library.
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/cpplib/build.lib
|
||||
source src/@NAME@/build.lib
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/cpplib/build.install-lib
|
||||
source src/@NAME@/build.install-lib
|
||||
|
|
|
@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
|
|||
|
||||
# install library
|
||||
echo "Installing libraries into '${LIBDIR}'"
|
||||
install_file ${LIBCPP} ${LIBDIR} 0755 || return 1
|
||||
BASE="${LIBCPP_BASE}.so"
|
||||
install_file ${@NAME@} ${LIBDIR} 0755 || return 1
|
||||
BASE="${@NAME@_BASE}.so"
|
||||
MAJOR="${BASE}.${SOMAJOR}"
|
||||
MINOR="${MAJOR}.${SOMINOR}"
|
||||
MICRO="${MINOR}.${SOMICRO}"
|
||||
|
@ -17,8 +17,8 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
|
|||
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
|
||||
|
||||
# install header
|
||||
echo "Installing header file '${LIBCPP_HEADER}' into ${INCLUDEDIR}"
|
||||
install_header ${LIBCPP_HEADER} ${INCLUDEDIR} 0644 || return 1
|
||||
echo "Installing header file '${@NAME@_HEADER}' into ${INCLUDEDIR}"
|
||||
install_header ${@NAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
|
||||
|
||||
# install pkgconfig file
|
||||
echo "Installing package config file into ${PKGCONFDIR}"
|
||||
|
@ -28,7 +28,9 @@ do_cmd_redir ${PKGCONFFILE} sed \
|
|||
-e "s,@VERSION@,${VERSION}," \
|
||||
-e "s,@LIBDIR@,${FINALLIBDIR}," \
|
||||
-e "s,@INCLUDEDIR@,${FINALINCLUDEDIR}," \
|
||||
src/cpplib/pkgconf.in
|
||||
src/@NAME@/pkgconf.in
|
||||
do_cmd chmod 0644 ${PKGCONFFILE}
|
||||
print_success "Done"
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# LIBCPP
|
||||
# LIBCPP_BUILT
|
||||
# LIBCPP_HEADER
|
||||
# LIBCPP_BASE
|
||||
# @NAME@
|
||||
# @NAME@_BUILT
|
||||
# @NAME@_HEADER
|
||||
# @NAME@_BASE
|
||||
|
||||
if [ -z ${LIBCPP_BUILT} ]
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
@NAME@_BASE=@NAME@
|
||||
source src/@NAME@/soversion
|
||||
|
||||
LIB_BASE="@P@"
|
||||
LIB="obj/${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
|
||||
SO_LIBS="-lstdc++ -lc"
|
||||
@NAME@="obj/${@NAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
|
||||
SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags
|
||||
|
||||
echo "Building library ${LIB}..."
|
||||
echo "Building library ${@NAME@}..."
|
||||
|
||||
source src/cpplib/build.monolithic
|
||||
source src/@NAME@/build.monolithic
|
||||
|
||||
MODIFIED=0
|
||||
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
|
||||
do
|
||||
if [ ${test} -nt ${LIB} ]
|
||||
if [ ${test} -nt ${@NAME@} ]
|
||||
then
|
||||
MODIFIED=1
|
||||
break
|
||||
|
@ -29,10 +30,10 @@ then
|
|||
then
|
||||
echo " Compiling"
|
||||
|
||||
SONAME="${LIB_BASE}.so.${SOMAJOR}.${SOMINOR}"
|
||||
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${LIB}" \
|
||||
SONAME="${@NAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
|
||||
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@NAME@}" \
|
||||
-Wl,-soname,${SONAME} \
|
||||
${SRC} ${SO_LIBS} || return 1
|
||||
${SRC} ${SO_EXTRA} || return 1
|
||||
|
||||
# make tests work
|
||||
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1
|
||||
|
@ -42,9 +43,9 @@ then
|
|||
print_success "Library up to date"
|
||||
fi
|
||||
|
||||
LIBCPP=${LIB}
|
||||
LIBCPP_BUILT=1
|
||||
LIBCPP_HEADER=${HDR}
|
||||
LIBCPP_BASE=${LIB_BASE}
|
||||
@NAME@_BUILT=1
|
||||
@NAME@_HEADER=${HDR}
|
||||
|
||||
fi
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# LIBCPP_MONOLITHIC
|
||||
# @NAME@_MONOLITHIC
|
||||
|
||||
if [ -z "${LIBCPP_MONOLITHIC}" ]
|
||||
if [ -z "${@NAME@_MONOLITHIC}" ]
|
||||
then
|
||||
SRC="obj/lib.cpp"
|
||||
HDR="obj/@HEADER_NAME@"
|
||||
|
||||
MONOLITHIC_TESTS="src/cpplib/build.lib src/cpplib/build.monolithic"
|
||||
MONOLITHIC_SOURCE="$(echo src/cpplib/{TopHeader,BottomHeader}.h)"
|
||||
MONOLITHIC_TESTS="src/@NAME@/build.lib src/@NAME@/build.monolithic"
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/{TopHeader,BottomHeader}.h)"
|
||||
make_monolithic ${HDR} C || return 1
|
||||
|
||||
MONOLITHIC_SOURCE="$(echo src/cpplib/TopSource.cpp)"
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
|
||||
make_monolithic ${SRC} C || return 1
|
||||
|
||||
LIBCPP_MONOLITHIC=1
|
||||
@NAME@_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
|
||||
fi
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
if [ $# -ne 2 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need CNAME HEADER_NAME."
|
||||
echo "CNAME is the C identifier version of the module name."
|
||||
echo "HEADER_NAME is the name of the header file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CNAME=$1
|
||||
shift
|
||||
HEADER_NAME=$1
|
||||
shift
|
||||
|
||||
if [ -e src/${NAME} ]
|
||||
then
|
||||
print_failure "src/${NAME} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ]
|
||||
then
|
||||
echo "Warning: your module name does not begin with 'lib'. You will"
|
||||
echo "have to fix up your pkgconfig file manually, etc."
|
||||
NAMEMINUSL="@TODO@"
|
||||
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_cmd find . -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@CNAME@,${CNAME},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@NAMEMINUSL@,${NAMEMINUSL},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@HEADER_NAME@,${HEADER_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;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -1,4 +1,4 @@
|
|||
# @P@/src/lib/cpplib/pkgconf.in
|
||||
# @P@/src/lib/@NAME@/pkgconf.in
|
||||
#
|
||||
# Metadata file for pkg-config
|
||||
# ( http://www.freedesktop.org/software/pkgconfig/ )
|
||||
|
@ -16,5 +16,5 @@ Version: @VERSION@
|
|||
Requires:
|
||||
|
||||
# Compilation information
|
||||
Libs: -L@LIBDIR@ @PMINUSL@
|
||||
Libs: -L@LIBDIR@ @NAMEMINUSL@
|
||||
Cflags: -I@INCLUDEDIR@
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
source src/tests/build.tests
|
||||
source src/@NAME@/build.tests
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# TESTS_BUILT
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
build_target lib
|
||||
LIBS="${LIBCPP}"
|
||||
build_target @LIBS@
|
||||
|
||||
if [ -z ${TESTS_BUILT} ]
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
echo "Building test programs..."
|
||||
do_cmd mkdir -p obj/tests || return 1
|
||||
|
||||
for SRC in src/tests/*.cpp
|
||||
LIBS=""
|
||||
for lib in @LIBS@
|
||||
do
|
||||
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')"
|
||||
LIBS="${LIBS} ${!${lib}}"
|
||||
done
|
||||
EXTRAS="" # @TODO@ libs, cflags
|
||||
|
||||
echo "Building test programs..."
|
||||
do_cmd mkdir -p obj/@NAME@ || return 1
|
||||
|
||||
for SRC in src/@NAME@/*.cpp
|
||||
do
|
||||
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.cpp$,,')"
|
||||
MODIFIED=0
|
||||
for file in ${LIBCPP} ${SRC}
|
||||
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
|
||||
do
|
||||
if [ ${file} -nt ${TEST} ]
|
||||
then
|
||||
|
@ -25,7 +31,7 @@ then
|
|||
|
||||
if [ ${MODIFIED} -ne 0 ]
|
||||
then
|
||||
do_cmd ${CXX} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} || return 1
|
||||
do_cmd ${CXX} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} || return 1
|
||||
print_success "Built ${TEST}"
|
||||
else
|
||||
print_success "${TEST} is up to date"
|
||||
|
@ -34,6 +40,8 @@ then
|
|||
|
||||
print_success "All tests built"
|
||||
|
||||
TESTS_BUILT=1
|
||||
@NAME@_BUILT=1
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
if [ $# -lt 1 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need LIBS."
|
||||
echo "LIBS are the library module names for these test programs."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LIBS="$@"
|
||||
|
||||
for lib in ${LIBS}
|
||||
do
|
||||
if [ ! -e src/${lib} ]
|
||||
then
|
||||
print_failure "src/${lib} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
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 find . -type f -exec sed -e "s,@LIBS@,${LIBS},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;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -1,10 +1,10 @@
|
|||
/* @P@/src/tests/???.cpp
|
||||
/* @P@/src/@NAME@/???.cpp
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
#include "@HEADER_NAME@"
|
||||
@TODO@ includes
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -39,4 +39,5 @@ 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
|
||||
*/
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# APPC
|
||||
# APPC_BUILT
|
||||
# @NAME@
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
if [ -z ${APPC_BUILT} ]
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
APP="obj/@P@"
|
||||
LIBS=""
|
||||
@NAME@="obj/@NAME@"
|
||||
EXTRAS="@TODO@" # cflags, libs
|
||||
|
||||
echo "Building application ${APP}..."
|
||||
echo "Building application ${@NAME@}..."
|
||||
|
||||
source src/capp/build.monolithic
|
||||
source src/@NAME@/build.monolithic
|
||||
|
||||
MODIFIED=0
|
||||
for test in ${MONOLITHIC_TESTS} ${SRC}
|
||||
do
|
||||
if [ ${test} -nt ${APP} ]
|
||||
if [ ${test} -nt ${@NAME@} ]
|
||||
then
|
||||
MODIFIED=1
|
||||
break
|
||||
|
@ -24,17 +24,18 @@ then
|
|||
|
||||
if [ ${MODIFIED} -ne 0 ]
|
||||
then
|
||||
echo " Compiling"
|
||||
echo " Compiling..."
|
||||
|
||||
do_cmd ${CC} ${CFLAGS} -o "${APP}" \
|
||||
${SRC} ${LIBS} || return 1
|
||||
do_cmd ${CC} ${CFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1
|
||||
|
||||
print_success "Application built"
|
||||
else
|
||||
print_success "Application up to date"
|
||||
fi
|
||||
|
||||
APPC=${APP}
|
||||
APPC_BUILT=1
|
||||
@NAME@_BUILT=1
|
||||
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/capp/build.app
|
||||
source src/@NAME@/build.app
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/capp/build.install-app
|
||||
source src/@NAME@/build.install-app
|
||||
|
|
|
@ -5,5 +5,8 @@ build_dir_tree "${BINDIR}" || return 1
|
|||
|
||||
# install binary
|
||||
echo "Installing binaries into '${BINDIR}'"
|
||||
install_file "${APPC}" "${BINDIR}" 0755 || return 1
|
||||
install_file "${@NAME@}" "${BINDIR}" 0755 || return 1
|
||||
print_success "Done"
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# APPC_MONOLITHIC
|
||||
# @NAME@_MONOLITHIC
|
||||
#
|
||||
|
||||
if [ -z "${APPC_MONOLITHIC}" ]
|
||||
if [ -z "${@NAME@_MONOLITHIC}" ]
|
||||
then
|
||||
SRC="obj/app.c"
|
||||
SRC="obj/@NAME@.c"
|
||||
|
||||
MONOLITHIC_TESTS="src/capp/build.app src/capp/build.monolithic"
|
||||
MONOLITHIC_SOURCE="$(echo src/capp/TopHeader.h) $(echo src/capp/TopSource.c)"
|
||||
MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.c)"
|
||||
make_monolithic ${SRC} C || return 1
|
||||
|
||||
APPC_MONOLITHIC=1
|
||||
@NAME@_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
if [ $# -ne 0 ]
|
||||
then
|
||||
print_failure "Too many arguments. None required for this module."
|
||||
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."
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -1 +1,3 @@
|
|||
source src/clib/build.lib
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
source src/clib/build.install-lib
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -32,3 +32,5 @@ do_cmd_redir ${PKGCONFFILE} sed \
|
|||
do_cmd chmod 0644 ${PKGCONFFILE}
|
||||
print_success "Done"
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -48,3 +48,5 @@ then
|
|||
LIBC_BASE=${LIB_BASE}
|
||||
|
||||
fi
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -16,3 +16,5 @@ then
|
|||
LIBC_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
|
||||
fi
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
if [ $# -ne 2 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need CNAME HEADER_NAME."
|
||||
echo "CNAME is the C identifier version of the module name."
|
||||
echo "HEADER_NAME is the name of the header file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CNAME=$1
|
||||
shift
|
||||
HEADER_NAME=$1
|
||||
shift
|
||||
|
||||
if [ -e src/${NAME} ]
|
||||
then
|
||||
print_failure "src/${NAME} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(echo ${NAME} | cut -b1-3)" -ne "lib" ]
|
||||
then
|
||||
echo "Warning: your module name does not begin with 'lib'. You will"
|
||||
echo "have to fix up your pkgconfig file manually, etc."
|
||||
NAMEMINUSL="@TODO@"
|
||||
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_cmd find . -type f -exec sed -e "s,@NAME@,${NAME},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@CNAME@,${CNAME},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@NAMEMINUSL@,${NAMEMINUSL},g" -i {} \; || exit 1
|
||||
do_cmd find . -type f -exec sed -e "s,@HEADER_NAME@,${HEADER_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;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -1 +1,3 @@
|
|||
source src/tests/build.tests
|
||||
source src/@NAME@/build.tests
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# TESTS_BUILT
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
build_target lib
|
||||
LIBS="${LIBCPP}"
|
||||
build_target @LIBS@
|
||||
|
||||
if [ -z ${TESTS_BUILT} ]
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
echo "Building test programs..."
|
||||
do_cmd mkdir -p obj/tests || return 1
|
||||
|
||||
for SRC in src/tests/*.cpp
|
||||
LIBS=""
|
||||
for lib in @LIBS@
|
||||
do
|
||||
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')"
|
||||
LIBS="${LIBS} ${!${lib}}"
|
||||
done
|
||||
EXTRAS="" # @TODO@ libs, cflags
|
||||
|
||||
echo "Building test programs..."
|
||||
do_cmd mkdir -p obj/@NAME@ || return 1
|
||||
|
||||
for SRC in src/@NAME@/*.c
|
||||
do
|
||||
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.c$,,')"
|
||||
MODIFIED=0
|
||||
for file in ${LIBCPP} ${SRC}
|
||||
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
|
||||
do
|
||||
if [ ${file} -nt ${TEST} ]
|
||||
then
|
||||
|
@ -25,7 +31,7 @@ then
|
|||
|
||||
if [ ${MODIFIED} -ne 0 ]
|
||||
then
|
||||
do_cmd ${CXX} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} || return 1
|
||||
do_cmd ${CC} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} || return 1
|
||||
print_success "Built ${TEST}"
|
||||
else
|
||||
print_success "${TEST} is up to date"
|
||||
|
@ -34,6 +40,8 @@ then
|
|||
|
||||
print_success "All tests built"
|
||||
|
||||
TESTS_BUILT=1
|
||||
@NAME@_BUILT=1
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
if [ $# -lt 1 ]
|
||||
then
|
||||
print_failure "Not enough arguments after module; need LIBS."
|
||||
echo "LIBS are the library module names for these test programs."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LIBS="$@"
|
||||
|
||||
for lib in ${LIBS}
|
||||
do
|
||||
if [ ! -e src/${lib} ]
|
||||
then
|
||||
print_failure "src/${lib} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
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 find . -type f -exec sed -e "s,@LIBS@,${LIBS},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;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -1,19 +1,19 @@
|
|||
/* @P@/src/tests/???.cpp
|
||||
/* @P@/src/@NAME@/???.c
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
#include "@HEADER_NAME@"
|
||||
@TODO@ includes
|
||||
|
||||
#include <iostream>
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if(argc == 2 && !strcmp(argv[1], "--print-summary")) {
|
||||
std::cout << "One line summary.\n";
|
||||
printf("One line summary.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -22,21 +22,12 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
int ret = 0;
|
||||
try {
|
||||
// TODO
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
ret = 1;
|
||||
}
|
||||
catch(...) {
|
||||
std::cerr << "Unknown exception caught." << std::endl;
|
||||
ret = 1;
|
||||
}
|
||||
// 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
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @P@/src/docs/Doxyfile.in
|
||||
# @P@/src/@NAME@/Doxyfile.in
|
||||
#
|
||||
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
# COPYING for more information / terms of license.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* @P@/src/docs/MainPage.dox
|
||||
/* @P@/src/@NAME@/MainPage.dox
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
|
@ -10,4 +10,5 @@
|
|||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/docs/build.docs
|
||||
source src/@NAME@/build.docs
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# DOCS_BUILT
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} $(echo src/docs/*.dox)"
|
||||
MONOLITHIC_@NAME@="${MONOLITHIC_DOC} $(echo src/@NAME@/*.dox)"
|
||||
build_target monolithic
|
||||
|
||||
if [ -z ${DOCS_BUILT} ]
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
echo "Building documentation with Doxygen..."
|
||||
|
||||
DOXYFILE=obj/Doxyfile
|
||||
DOXYFILE=obj/Doxyfile.@NAME@
|
||||
|
||||
if [ ! -e ${DOXYFILE} ]
|
||||
then
|
||||
|
@ -19,7 +19,7 @@ then
|
|||
fi
|
||||
|
||||
MODIFIED=0
|
||||
for file in ${MONOLITHIC_DOC}
|
||||
for file in ${MONOLITHIC_@NAME@}
|
||||
do
|
||||
if [ ${file} -nt html/index.html ]
|
||||
then
|
||||
|
@ -36,6 +36,8 @@ then
|
|||
print_success "Documentation is up to date"
|
||||
fi
|
||||
|
||||
DOCS_BUILT=1
|
||||
@NAME@_BUILT=1
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -1 +1 @@
|
|||
source src/docs/build.install-docs
|
||||
source src/@NAME@/build.install-docs
|
||||
|
|
|
@ -17,3 +17,5 @@ do
|
|||
done
|
||||
|
||||
print_success "Documentation installed"
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
if [ $# -ne 0 ]
|
||||
then
|
||||
print_failure "Too many arguments. None required for this module."
|
||||
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."
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -0,0 +1,12 @@
|
|||
/* @P@/src/capp/TopHeader.h
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
// standard includes, or includes needed for type declarations
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
|
@ -0,0 +1,12 @@
|
|||
/* @P@/src/capp/TopSource.c
|
||||
*
|
||||
* (c)2006, Laurence Withers. Released under the GNU GPL. See file
|
||||
* COPYING for more information / terms of license.
|
||||
*/
|
||||
|
||||
// Below are all the includes used throughout the application.
|
||||
|
||||
/* options for text editors
|
||||
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
vim: expandtab:ts=4:sw=4
|
||||
*/
|
|
@ -0,0 +1 @@
|
|||
source src/@NAME@/build.firmware
|
|
@ -0,0 +1,45 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
# HACK -- this should probably be in the top-level makefile
|
||||
[ -z "${SDCC}" ] && SDCC=sdcc
|
||||
[ -z "${SDCCFLAGS}" ] && SDCCFLAGS="@TODO@"
|
||||
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
@NAME@="obj/@NAME@.hex"
|
||||
EXTRAS="@TODO@" # cflags, libs
|
||||
|
||||
echo "Building firmware ${@NAME@}..."
|
||||
|
||||
source src/@NAME@/build.monolithic
|
||||
|
||||
MODIFIED=0
|
||||
for test in ${MONOLITHIC_TESTS} ${SRC}
|
||||
do
|
||||
if [ ${test} -nt ${@NAME@} ]
|
||||
then
|
||||
MODIFIED=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${MODIFIED} -ne 0 ]
|
||||
then
|
||||
echo " Compiling..."
|
||||
|
||||
do_cmd ${SDCC} ${SDCCFLAGS} -o "${@NAME@}" ${SRC} ${EXTRAS} || return 1
|
||||
|
||||
print_success "Firmware built"
|
||||
else
|
||||
print_success "Firmware up to date"
|
||||
fi
|
||||
|
||||
@NAME@_BUILT=1
|
||||
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -0,0 +1 @@
|
|||
source src/@NAME@/build.install-firmware
|
|
@ -0,0 +1,12 @@
|
|||
build_target app
|
||||
|
||||
# make paths (this is for Gentoo in particular)
|
||||
build_dir_tree "${HEXDIR}" || return 1
|
||||
|
||||
# install binary
|
||||
echo "Installing firmware into '${HEXDIR}'"
|
||||
install_file "${@NAME@}" "${HEXDIR}" 0755 || return 1
|
||||
print_success "Done"
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -0,0 +1,18 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@_MONOLITHIC
|
||||
#
|
||||
|
||||
if [ -z "${@NAME@_MONOLITHIC}" ]
|
||||
then
|
||||
SRC="obj/@NAME@.c"
|
||||
|
||||
MONOLITHIC_TESTS="src/@NAME@/build.app src/@NAME@/build.monolithic"
|
||||
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopHeader.h) $(echo src/@NAME@/TopSource.c)"
|
||||
make_monolithic ${SRC} C || return 1
|
||||
|
||||
@NAME@_MONOLITHIC=1
|
||||
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
|
||||
fi
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
|
@ -0,0 +1,25 @@
|
|||
if [ $# -ne 0 ]
|
||||
then
|
||||
print_failure "Too many arguments. None required for this module."
|
||||
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."
|
||||
|
||||
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
|
||||
# vim: expandtab:ts=4:sw=4
|
Loading…
Reference in New Issue