From 1744e42270fcf78eeecc19bc374e7e116ff6e4d9 Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Mon, 5 Feb 2007 13:05:10 +0000 Subject: [PATCH] Upgrade to new build system --- README | 6 ++++-- config | 2 +- make.sh | 33 +++++++++++++++++++++++---------- scripts/.gitignore | 2 ++ src/docs/Doxyfile.in | 2 +- src/tests/template | 2 +- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/README b/README index f62f76a..32f7d62 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ libCStreamedXML http://www.lwithers.me.uk/projects/libCStreamedXML/ ======================================================================== -(c)2006, Laurence Withers, . +(c)2006-2007, Laurence Withers, . Released under the GNU GPLv2. See file COPYING or http://www.gnu.org/copyleft/gpl.html for details. @@ -11,6 +11,8 @@ To build: ./make.sh To install: ./make.sh install This library has no dependencies other than the C library. -You might want to edit 'config' first. +You might want to edit 'config' first. You might also want to set +'INSTALL_PREFIX', which is prepended onto the destination of any +installed file. @TODO@ diff --git a/config b/config index 0851087..39ed0bd 100644 --- a/config +++ b/config @@ -2,7 +2,7 @@ # kate: replace-trailing-space-save true; space-indent true; tab-width 4; # vim: expandtab:ts=4:sw=4 # -# (c)2006, Laurence Withers, . +# (c)2007, Laurence Withers, . # Released under the GNU GPLv2. See file COPYING or # http://www.gnu.org/copyleft/gpl.html for details. # diff --git a/make.sh b/make.sh index a0be209..92ca9b3 100755 --- a/make.sh +++ b/make.sh @@ -1,7 +1,7 @@ #!/bin/bash # libCStreamedXML/make.sh # -# (c)2006, Laurence Withers, . +# (c)2006-2007, Laurence Withers, . # Released under the GNU GPLv2. See file COPYING or # http://www.gnu.org/copyleft/gpl.html for details. # @@ -48,6 +48,8 @@ OUTPUT_DIRS="obj html" # MONOLITHIC_TESTS if any file mentioned in this list is newer # than the output file, then we recreate it # MONOLITHIC_SOURCE a list (in order) of the source files +# MONOLITHIC_OPTIONS will #define the options to match the respective +# environment variables. # # Recognised formats are: # none no special processing happens before each file @@ -68,18 +70,21 @@ make_monolithic() { # extract options HASHLINE=0 VERDEFINE=0 + HASHDEFINE=0 if [ "$2" == "C" ] then HASHLINE=1 VERDEFINE=1 + HASHDEFINE=1 elif [ "$2" == "Ch" ] then HASHLINE=1 + HASHDEFINE=1 elif [ "$2" == "none" ] then - HASHLINE=0 # dummy command + HASHLINE=0 # dummy command else - print_failure "make_monolithic() called with unknown format $2" + print_failure "make_monolithic() called with unknown format $2" return 1 fi @@ -115,6 +120,14 @@ make_monolithic() { do_cmd_redir ${MONOLITHIC_OUT} echo "#define VEREXTRA \"${VEREXTRA}\"" || return 1 fi + if [ ${HASHDEFINE} -ne 0 ] + then + for opt in ${MONOLITHIC_OPTIONS} + do + do_cmd_redir ${MONOLITHIC_OUT} echo "#define ${opt} ${!opt}" || return 1 + done + fi + for FILE in ${MONOLITHIC_SOURCE} do if [ ${HASHLINE} -ne 0 ] @@ -142,7 +155,7 @@ build_dir_tree() { return 1 fi - local DIR="$1" + local DIR="${INSTALL_PREFIX}$1" # if the directory already exists, return success [ -d "${DIR}" ] && return 0 @@ -180,8 +193,8 @@ build_dir_tree() { # second is the destination. The third is the octal mode. install_file() { # figure out if $2 is a directory or not - DEST_FILE="$2" - [ -d "$2" ] && DEST_FILE="$2/$(basename $1)" + DEST_FILE="${INSTALL_PREFIX}$2" + [ -d "$2" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)" echo " Installing: '$1' -> '$2'" do_cmd cp -fP "$1" "${DEST_FILE}" || return 1 @@ -195,8 +208,8 @@ install_file() { # This will install a header file. It is basically similar to # install_file(), only we strip out the #line directives. install_header() { - DEST_FILE="$2" - [ -d "$2" ] && DEST_FILE="$2/$(basename $1)" + DEST_FILE="${INSTALL_PREFIX}$2" + [ -d "$2" ] && DEST_FILE="${INSTALL_PREFIX}$2/$(basename $1)" echo " Installing header: '$1' -> '$2'" do_cmd rm -f ${DEST_FILE} || exit 1 @@ -212,9 +225,9 @@ install_header() { # second the symlink's source filename, and the third is the directory # in which to create the symlink. install_symlink() { - echo " Installing symlink: '$3/$2' -> '$1'" + echo " Installing symlink: '$3/$2' -> '${INSTALL_PREFIX}$1'" - ( do_cmd cd $3; ln -sf $2 $1 ) || return 1 + ( do_cmd cd $3; ln -sf $2 ${INSTALL_PREFIX}$1 ) || return 1 return 0 } diff --git a/scripts/.gitignore b/scripts/.gitignore index 8e5e559..1cb5480 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,12 +1,14 @@ build.app.c build.app.c++ build.app.c++-qt +build.app.sh build.docs.doxygen build.files.none build.firmware.gpasm build.firmware.sdcc build.lib.c build.lib.c++ +build.module.c build.tests.c build.tests.c++ module-create.sh diff --git a/src/docs/Doxyfile.in b/src/docs/Doxyfile.in index 59aa2c8..3c06eea 100644 --- a/src/docs/Doxyfile.in +++ b/src/docs/Doxyfile.in @@ -1,6 +1,6 @@ # libCStreamedXML/src/docs/Doxyfile.in # -# (c)2006, Laurence Withers, . +# (c)2007, Laurence Withers, . # Released under the GNU GPLv2. See file COPYING or # http://www.gnu.org/copyleft/gpl.html for details. # diff --git a/src/tests/template b/src/tests/template index b47ab10..9e7165c 100644 --- a/src/tests/template +++ b/src/tests/template @@ -1,6 +1,6 @@ /* libCStreamedXML/src/tests/???.c * - * (c)2006, Laurence Withers, . + * (c)2007, Laurence Withers, . * Released under the GNU GPLv2. See file COPYING or * http://www.gnu.org/copyleft/gpl.html for details. */