Further work in progress.

This commit is contained in:
Laurence Withers 2006-07-24 22:37:26 +01:00
parent 7a3fbaec1f
commit 587981015f
15 changed files with 86 additions and 92 deletions

View File

@ -4,7 +4,7 @@
* COPYING for more information / terms of license.
*/
#include "@HEADER@"
#include "@HEADER_NAME@"
// Below are all the includes used throughout the library.

View File

@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so"
install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
@ -17,12 +17,12 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.pc
PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \

View File

@ -1,25 +1,25 @@
# These are external variables, and shouldn't clash with anything else
# @PNAME@
# @PNAME@_BUILT
# @PNAME@_HEADER
# @PNAME@_BASE
# @CNAME@
# @CNAME@_BUILT
# @CNAME@_HEADER
# @CNAME@_BASE
if [ -z ${@PNAME@_BUILT} ]
if [ -z ${@CNAME@_BUILT} ]
then
@PNAME@_BASE=@NAME@
@CNAME@_BASE=@NAME@
source src/@NAME@/soversion
@NAME@="obj/${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
@CNAME@="obj/${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_EXTRA="-lstdc++ -lc" # @TODO@ libs, cflags
echo "Building library ${@PNAME@}..."
echo "Building library ${@CNAME@}..."
source src/@NAME@/build.monolithic
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do
if [ ${test} -nt ${@PNAME@} ]
if [ ${test} -nt ${@CNAME@} ]
then
MODIFIED=1
break
@ -30,21 +30,21 @@ then
then
echo " Compiling"
SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \
SONAME="${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CXX} ${CFLAGS} -shared -fpic -o "${@CNAME@}" \
-Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || return 1
# make tests work
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1
do_cmd ln -sf $(basename ${@CNAME@}) obj/${SONAME} || return 1
print_success "Library built"
else
print_success "Library up to date"
fi
@PNAME@_BUILT=1
@PNAME@_HEADER=${HDR}
@CNAME@_BUILT=1
@CNAME@_HEADER=${HDR}
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,7 +1,7 @@
# These are external variables, and shouldn't clash with anything else
# @PNAME@_MONOLITHIC
# @CNAME@_MONOLITHIC
if [ -z "${@PNAME@_MONOLITHIC}" ]
if [ -z "${@CNAME@_MONOLITHIC}" ]
then
SRC="obj/@NAME@.cpp"
HDR="obj/@HEADER_NAME@"
@ -13,7 +13,7 @@ then
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
make_monolithic ${SRC} C || return 1
@PNAME@_MONOLITHIC=1
@CNAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -0,0 +1,13 @@
# @P@/src/@NAME@/soversion
#
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0

View File

@ -2,23 +2,19 @@
# @NAME@_BUILT
#
build_target @LIBS@
#@TODO@ build_target libs
if [ -z ${@NAME@_BUILT} ]
then
LIBS=""
for lib in @LIBS@
do
LIBS="${LIBS} ${!${lib}}"
done
LIBS="" # @TODO@ internal libs
EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..."
do_cmd mkdir -p obj/@NAME@ || return 1
do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.cpp
do
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.cpp$,,')"
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.cpp$,,')"
MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do

View File

@ -1,21 +1,9 @@
if [ $# -lt 1 ]
if [ $# -ne 0 ]
then
print_failure "Not enough arguments after module; need LIBS."
echo "LIBS are the library module names for these test programs."
print_failure "Unexpected extra parameters."
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."
@ -30,7 +18,6 @@ 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."

View File

@ -1,11 +1,11 @@
/* @P@/src/clib/TopHeader.h
/* @P@/src/@NAME@/TopHeader.h
*
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.
*/
#ifndef HEADER_lib@PC@
#define HEADER_lib@PC@
#ifndef HEADER_@CNAME@
#define HEADER_@CNAME@
// standard includes, or includes needed for type declarations

View File

@ -1,4 +1,4 @@
/* @P@/src/clib/TopSource.c
/* @P@/src/@NAME@@NAME@/TopSource.c
*
* (c)@YEAR@, @AUTHOR@. Released under the GNU GPL. See file
* COPYING for more information / terms of license.

View File

@ -7,8 +7,8 @@ build_dir_tree "${INCLUDEDIR}" || return 1
# install library
echo "Installing libraries into '${LIBDIR}'"
install_file ${@PNAME@} ${LIBDIR} 0755 || return 1
BASE="${@PNAME@_BASE}.so"
install_file ${@CNAME@} ${LIBDIR} 0755 || return 1
BASE="${@CNAME@_BASE}.so"
MAJOR="${BASE}.${SOMAJOR}"
MINOR="${MAJOR}.${SOMINOR}"
MICRO="${MINOR}.${SOMICRO}"
@ -17,12 +17,12 @@ install_symlink "${MAJOR}" "${MINOR}" "${LIBDIR}"
install_symlink "${BASE}" "${MAJOR}" "${LIBDIR}"
# install header
echo "Installing header file '${@PNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@PNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
echo "Installing header file '${@CNAME@_HEADER}' into ${INCLUDEDIR}"
install_header ${@CNAME@_HEADER} ${INCLUDEDIR} 0644 || return 1
# install pkgconfig file
echo "Installing package config file into ${PKGCONFDIR}"
PKGCONFFILE=${PKGCONFDIR}/@PNAME@.pc
PKGCONFFILE=${PKGCONFDIR}/@CNAME@.pc
do_cmd rm -f ${PKGCONFFILE}
do_cmd_redir ${PKGCONFFILE} sed \
-e "s,@VERSION@,${VERSION}," \

View File

@ -1,25 +1,25 @@
# These are external variables, and shouldn't clash with anything else
# @PNAME@
# @PNAME@_BUILT
# @PNAME@_HEADER
# @PNAME@_BASE
# @CNAME@
# @CNAME@_BUILT
# @CNAME@_HEADER
# @CNAME@_BASE
if [ -z ${@PNAME@_BUILT} ]
if [ -z ${@CNAME@_BUILT} ]
then
@PNAME@_BASE=@NAME@
@CNAME@_BASE=@NAME@
source src/@NAME@/soversion
@NAME@="obj/${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
@CNAME@="obj/${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}.${SOMICRO}"
SO_EXTRA="-lc" # @TODO@ libs, cflags
echo "Building library ${@PNAME@}..."
echo "Building library ${@CNAME@}..."
source src/@NAME@/build.monolithic
MODIFIED=0
for test in ${MONOLITHIC_TESTS} ${HDR} ${SRC}
do
if [ ${test} -nt ${@PNAME@} ]
if [ ${test} -nt ${@CNAME@} ]
then
MODIFIED=1
break
@ -30,21 +30,21 @@ then
then
echo " Compiling"
SONAME="${@PNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${@PNAME@}" \
SONAME="${@CNAME@_BASE}.so.${SOMAJOR}.${SOMINOR}"
do_cmd ${CC} ${CFLAGS} -shared -fpic -o "${@CNAME@}" \
-Wl,-soname,${SONAME} \
${SRC} ${SO_EXTRA} || return 1
# make tests work
do_cmd ln -sf $(basename ${LIB}) obj/${SONAME} || return 1
do_cmd ln -sf $(basename ${@CNAME@}) obj/${SONAME} || return 1
print_success "Library built"
else
print_success "Library up to date"
fi
@PNAME@_BUILT=1
@PNAME@_HEADER=${HDR}
@CNAME@_BUILT=1
@CNAME@_HEADER=${HDR}
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,7 +1,7 @@
# These are external variables, and shouldn't clash with anything else
# @PNAME@_MONOLITHIC
# @CNAME@_MONOLITHIC
if [ -z "${@PNAME@_MONOLITHIC}" ]
if [ -z "${@CNAME@_MONOLITHIC}" ]
then
SRC="obj/@NAME@.c"
HDR="obj/@HEADER_NAME@"
@ -10,10 +10,10 @@ then
MONOLITHIC_SOURCE="$(echo src/@NAME@/{TopHeader,BottomHeader}.h)"
make_monolithic ${HDR} C || return 1
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.cpp)"
MONOLITHIC_SOURCE="$(echo src/@NAME@/TopSource.c)"
make_monolithic ${SRC} C || return 1
@PNAME@_MONOLITHIC=1
@CNAME@_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -0,0 +1,13 @@
# @P@/src/@NAME@/soversion
#
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0

View File

@ -2,23 +2,19 @@
# @NAME@_BUILT
#
build_target @LIBS@
#@TODO@ build_target libs
if [ -z ${@NAME@_BUILT} ]
then
LIBS=""
for lib in @LIBS@
do
LIBS="${LIBS} ${!${lib}}"
done
LIBS="" # @TODO@ internal libs
EXTRAS="" # @TODO@ libs, cflags
echo "Building test programs..."
do_cmd mkdir -p obj/@NAME@ || return 1
do_cmd mkdir -p obj/tests || return 1
for SRC in src/@NAME@/*.c
do
TEST="obj/@NAME@/$(basename ${SRC} | sed -e 's,.c$,,')"
TEST="obj/tests/$(basename ${SRC} | sed -e 's,.c$,,')"
MODIFIED=0
for file in ${LIBS} ${SRC} src/@NAME@/build.tests
do

View File

@ -10,14 +10,3 @@ VERMAJOR=1
VERMINOR=0
VERMICRO=2
VEREXTRA=""
# SOMAJOR and SOMINOR are included in the library's soname. They need to
# be bumped on a binary-incompatible release. They are both single
# integers.
SOMAJOR=0
SOMINOR=0
# SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=0