shtools/zcsf/zmake
2022-01-14 14:49:25 +01:00

39 lines
574 B
Bash
Executable file

#!/bin/sh
fname=$(basename "$0")
usage() {
echo "$fname [option] [arguments]
Execute the zmakefile in the directory
If there is no zmakefile, uses the makefile instead
The zmakefile is a shell script
Options:
-h Display help
-C <path> Execute from this path"
}
path=.
if [ "$1" = "-h" ]
then
usage
exit 1
fi
if [ "$1" = "-C" ]
then
if [ $# -lt 2 ]
then
echo "Option -C needs an argument" >&2
exit 2
fi
path="$2"
shift 2
fi
cd "$path"
if [ -f Zmakefile ]
then sh Zmakefile $@
elif [ -f zmakefile ]
then sh zmakefile $@
else make $@
fi