#!/bin/sh
SCRIPT=`basename $0`
+PATH=$PATH:`dirname $0`
die() {
- echo "Usage: $SCRIPT NAME"
- echo " where NAME.in is a file"
+ echo "Usage: $SCRIPT NAME(.in) TARGET"
+ echo " where NAME and TARGET is a file"
echo "$*"
exit 1
}
set -e
[ $# -eq 1 ] || die "Found $# ARGS not 1"
NAME=$1
-shift
-[ -f $NAME.in ] || die "No FILE $NAME.in"
-echo "$NAME: $NAME.in"
-echo ' sed -e \'
-for var in `findVars $NAME.in`
+TARGET=`dirname $NAME`/`basename $NAME .in`
+[ -f $NAME ] || die "No FILE $NAME"
+echo "include config.mk"
+echo
+echo "$TARGET: $NAME"
+echo ' sed \'
+for var in `findVars $NAME`
do
- echo ' "s%@@'$var'@@%$('$var')%g" \'
+ echo '-e s%@@'$var'@@%${'$var'}%g \'
done
-echo ' $< > $@'
+echo ' $< > $@'