lw-build-system/skel/scripts/module-create.sh

47 lines
872 B
Bash
Raw Normal View History

#!/bin/bash
# @P@/scripts/module-create.sh
#
# (c)2006, Laurence Withers. Released under the GNU GPL. See file
# COPYING for more information / terms of license.
#
# Creates a new source module.
# Get the directory of the repository (needed to include functions file)
cd $(dirname $0)
cd $(dirname $(pwd))
[ -z "${VERBOSE}" ] && VERBOSE="0"
source scripts/functions.sh || exit 1
# Get arguments.
if [ $# -lt 3 ]
then
echo "Usage: scripts/module-create.sh <lang> <type> <name> [args]"
echo " available modules:"
for i in scripts/build.*
do
echo $i | sed "s,scripts/build\.\([^.]*\)\.\(.*\), lang: \1 type: \2,"
done
exit 1
fi
LANG=$1
shift
TYPE=$1
shift
NAME=$1
shift
TEMPLATE=scripts/build.${LANG}.${TYPE}
if [ ! -e ${TEMPLATE}/instantiate ]
then
echo "No such module type."
exit 1
fi
source ${TEMPLATE}/instantiate