changeset 106:5ba0bee90efa

build system: new configuration naming mechanism
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 23 Jul 2018 16:38:50 +0000
parents 5c4db73d289a
children b882091ebb68
files configure-gcc.sh configure-tms470.sh gcc/makefile-body tms470/makefile-frags/link-steps
diffstat 4 files changed, 96 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/configure-gcc.sh	Mon Jul 23 07:01:39 2018 +0000
+++ b/configure-gcc.sh	Mon Jul 23 16:38:50 2018 +0000
@@ -52,8 +52,6 @@
 
 . "targets/$TARGET.conf"
 
-BUILD_DIR="build-$TARGET-gcc"
-
 # settings derived from the target-defined DSP version
 
 case "$DSP" in
@@ -90,6 +88,8 @@
 SERIAL_DYNAMIC_SWITCH=0
 TR_BAUD_CONFIG=TR_BAUD_115200
 
+SUFFIX=
+
 # allow the user to override these defaults
 
 shift
@@ -99,6 +99,48 @@
 	shift
 done
 
+# validate key settings and build configuration name
+
+case "$SRVC" in
+	0)
+		CONFIG_NAME=vo
+		;;
+	1)
+		CONFIG_NAME=fd
+		;;
+	2)
+		CONFIG_NAME=da
+		;;
+	*)
+		echo "Error: SRVC=$SRVC setting is invalid" 1>&2
+		exit 1
+esac
+
+case "$GPRS" in
+	0)
+		;;
+	1)
+		CONFIG_NAME=gprs
+		;;
+	*)
+		echo "Error: GPRS=$GPRS setting is invalid" 1>&2
+		exit 1
+esac
+
+case "$FCHG_STATE" in
+	0)
+		;;
+	1)
+		CONFIG_NAME="$CONFIG_NAME-chg"
+		;;
+	*)
+		echo "Error: FCHG_STATE=$FCHG_STATE setting is invalid" 1>&2
+		exit 1
+esac
+
+CONFIG_NAME="$CONFIG_NAME$SUFFIX-gcc"
+BUILD_DIR="build-$TARGET-$CONFIG_NAME"
+
 echo "Building firmware for target $TARGET in $BUILD_DIR"
 
 if [ "$clean_flag" = 1 ]
@@ -264,7 +306,9 @@
 
 # generate the top level Makefile!
 
-helpers/makeline def TARGET $TARGET > $BUILD_DIR/Makefile
+helpers/makeline def CONFIG_NAME $CONFIG_NAME > $BUILD_DIR/Makefile
+echo >> $BUILD_DIR/Makefile
+helpers/makeline def TARGET $TARGET >> $BUILD_DIR/Makefile
 echo >> $BUILD_DIR/Makefile
 helpers/makeline def SUBDIR $SUBDIR >> $BUILD_DIR/Makefile
 echo >> $BUILD_DIR/Makefile
--- a/configure-tms470.sh	Mon Jul 23 07:01:39 2018 +0000
+++ b/configure-tms470.sh	Mon Jul 23 16:38:50 2018 +0000
@@ -47,8 +47,6 @@
 
 . "targets/$TARGET.conf"
 
-BUILD_DIR="build-$TARGET-tms470"
-
 # settings derived from the target-defined DSP version
 
 case "$DSP" in
@@ -85,6 +83,8 @@
 SERIAL_DYNAMIC_SWITCH=0
 TR_BAUD_CONFIG=TR_BAUD_115200
 
+SUFFIX=
+
 # allow the user to override these defaults
 
 shift
@@ -94,6 +94,48 @@
 	shift
 done
 
+# validate key settings and build configuration name
+
+case "$SRVC" in
+	0)
+		CONFIG_NAME=vo
+		;;
+	1)
+		CONFIG_NAME=fd
+		;;
+	2)
+		CONFIG_NAME=da
+		;;
+	*)
+		echo "Error: SRVC=$SRVC setting is invalid" 1>&2
+		exit 1
+esac
+
+case "$GPRS" in
+	0)
+		;;
+	1)
+		CONFIG_NAME=gprs
+		;;
+	*)
+		echo "Error: GPRS=$GPRS setting is invalid" 1>&2
+		exit 1
+esac
+
+case "$FCHG_STATE" in
+	0)
+		;;
+	1)
+		CONFIG_NAME="$CONFIG_NAME-chg"
+		;;
+	*)
+		echo "Error: FCHG_STATE=$FCHG_STATE setting is invalid" 1>&2
+		exit 1
+esac
+
+CONFIG_NAME="$CONFIG_NAME$SUFFIX-470"
+BUILD_DIR="build-$TARGET-$CONFIG_NAME"
+
 echo "Building firmware for target $TARGET in $BUILD_DIR"
 
 if [ "$clean_flag" = 1 ]
@@ -305,7 +347,9 @@
 
 # generate the top level Makefile!
 
-helpers/makeline def SUBDIR $SUBDIR > $BUILD_DIR/Makefile
+helpers/makeline def CONFIG_NAME $CONFIG_NAME > $BUILD_DIR/Makefile
+echo >> $BUILD_DIR/Makefile
+helpers/makeline def SUBDIR $SUBDIR >> $BUILD_DIR/Makefile
 echo >> $BUILD_DIR/Makefile
 helpers/makeline def LIBS $LIBS >> $BUILD_DIR/Makefile
 echo >> $BUILD_DIR/Makefile
--- a/gcc/makefile-body	Mon Jul 23 07:01:39 2018 +0000
+++ b/gcc/makefile-body	Mon Jul 23 16:38:50 2018 +0000
@@ -27,7 +27,7 @@
 	${CC} -c ${CFLAGS} $<
 
 build_date.c:	${LIBS} bootentry-flash.o bootentry-xram.o ramvecs.o Makefile
-	../helpers/build-date gcc > $@
+	../helpers/build-date ${CONFIG_NAME} > $@
 
 build_date.o:	build_date.c
 	${CC} -c ${CFLAGS} build_date.c
--- a/tms470/makefile-frags/link-steps	Mon Jul 23 07:01:39 2018 +0000
+++ b/tms470/makefile-frags/link-steps	Mon Jul 23 16:38:50 2018 +0000
@@ -1,5 +1,5 @@
 build_date.c:	${LIBS}
-	../helpers/build-date TMS470 > $@
+	../helpers/build-date ${CONFIG_NAME} > $@
 
 build_date.obj:	build_date.c
 	../tms470/toolwrap/cl470 -q -c -me -mt -o -pw2 -x -mw build_date.c