Create a local copy of the scripts directory.
The idea is to move the build system out of the project tree as much as possible. This has two benefits: - it does not add any baggage to somebody who just wants to compile the project, and doesn't want to create any new modules, - it means that project trees don't have to be updated every time a change is made to the module instantiation stuff.
This commit is contained in:
parent
201586b051
commit
87272247fb
65 changed files with 1561 additions and 0 deletions
13
scripts/build.sdcc.firmware/TopHeader.h
Normal file
13
scripts/build.sdcc.firmware/TopHeader.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* @P@/src/capp/TopHeader.h
|
||||
*
|
||||
* (c)2006, @AUTHOR@, <@EMAIL@>.
|
||||
* Released under the GNU GPLv2. See file COPYING or
|
||||
* http://www.gnu.org/copyleft/gpl.html for details.
|
||||
*/
|
||||
|
||||
// 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
|
||||
*/
|
||||
13
scripts/build.sdcc.firmware/TopSource.c
Normal file
13
scripts/build.sdcc.firmware/TopSource.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* @P@/src/capp/TopSource.c
|
||||
*
|
||||
* (c)2006, @AUTHOR@, <@EMAIL@>.
|
||||
* Released under the GNU GPLv2. See file COPYING or
|
||||
* http://www.gnu.org/copyleft/gpl.html for details.
|
||||
*/
|
||||
|
||||
// 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
|
||||
*/
|
||||
1
scripts/build.sdcc.firmware/build.default
Normal file
1
scripts/build.sdcc.firmware/build.default
Normal file
|
|
@ -0,0 +1 @@
|
|||
source src/@NAME@/build.firmware
|
||||
41
scripts/build.sdcc.firmware/build.firmware
Normal file
41
scripts/build.sdcc.firmware/build.firmware
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@
|
||||
# @NAME@_BUILT
|
||||
#
|
||||
|
||||
if [ -z ${@NAME@_BUILT} ]
|
||||
then
|
||||
@NAME@="obj/@NAME@.hex"
|
||||
EXTRAS="@TODO@" # cflags, libs
|
||||
|
||||
echo "Building firmware ${@NAME@}..."
|
||||
|
||||
do_cmd source src/@NAME@/build.monolithic || return 1
|
||||
|
||||
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
|
||||
1
scripts/build.sdcc.firmware/build.install
Normal file
1
scripts/build.sdcc.firmware/build.install
Normal file
|
|
@ -0,0 +1 @@
|
|||
source src/@NAME@/build.install-firmware
|
||||
12
scripts/build.sdcc.firmware/build.install-firmware
Normal file
12
scripts/build.sdcc.firmware/build.install-firmware
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
build_target @NAME@
|
||||
|
||||
# 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
|
||||
18
scripts/build.sdcc.firmware/build.monolithic
Normal file
18
scripts/build.sdcc.firmware/build.monolithic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# These are external variables, and shouldn't clash with anything else
|
||||
# @NAME@_MONOLITHIC
|
||||
#
|
||||
|
||||
SRC="obj/@NAME@.c"
|
||||
MONOLITHIC_TESTS="src/@NAME@/build.firmware src/@NAME@/build.monolithic"
|
||||
|
||||
if [ -z "${@NAME@_MONOLITHIC}" ]
|
||||
then
|
||||
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
|
||||
25
scripts/build.sdcc.firmware/instantiate
Normal file
25
scripts/build.sdcc.firmware/instantiate
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue