changeset 105:5e2b0806b098

scripts/mk-component.sh make_version(): allow filename to be different
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 05 Oct 2016 18:46:25 +0000
parents 27a4235405c6
children 72b8a6a15d46
files scripts/mk-component.sh
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/mk-component.sh	Tue Oct 04 18:24:05 2016 +0000
+++ b/scripts/mk-component.sh	Wed Oct 05 18:46:25 2016 +0000
@@ -38,14 +38,22 @@
 # shell functions to be used in the recipes
 
 make_version() {
-	if [ $# != 1 ]
-	then
-		echo "Error: make_version takes 1 argument" 1>&2
+	case $# in
+	    1)
+		echo "$1_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile
+		echo "	../../scripts/make-version.sh $1 > $1_version.c" \
+			>> $BUILD_DIR/$LIBNAME/Makefile
+		;;
+	    2)
+		echo "$2_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile
+		echo "	../../scripts/make-version.sh $1 > $2_version.c" \
+			>> $BUILD_DIR/$LIBNAME/Makefile
+		;;
+	    *)
+		echo "Error: make_version takes 1 or 2 arguments" 1>&2
 		exit 1
-	fi
-	echo "$1_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile
-	echo "	../../scripts/make-version.sh $1 > $1_version.c" \
-		>> $BUILD_DIR/$LIBNAME/Makefile
+		;;
+	esac
 	echo >> $BUILD_DIR/$LIBNAME/Makefile
 }