blob: 92b703a71aeacd163f1a9fac5d3790edb975b82b [file] [log] [blame]
#!/bin/sh
# Jay MaKe
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
root="$(dirname $dir)"
jmkscript="$root/share/jmk/jmk.tcl"
options=""
disable_gtags=false
cc=cc
ld=ld
asm=as
while getopts "hD:c:a:l:" arg; do
case $arg in
h) echo "Please read the JMK manual for more information." ;;
D) options="$options $(echo $OPTARG | sed 's/=/ /')" ;;
c) cc="$OPTARG" ;;
a) ld="$OPTARG" ;;
l) asm="$OPTARG" ;;
?) echo "Invalid argument"
exit 1 ;;
esac
done
echo "Options: {$options }"
for file in $(find -name Jmk2); do
echo "$file" > /dev/stderr
outdir="$(dirname $file)"
cat - $file << EOF | tclsh - $options > "$outdir/Makefile"
source {$root/share/jmk/jmk.tcl}
set cc {$cc}
set ld {$ld}
set asm {$asm}
set root {$root}
set jmk_build_cmd {$0 $*}
set jmk_build_dir {$(pwd)}
set jmk_makefile_dir {$PWD/$outdir}
cd {$outdir}
array set options {$options}
source {$root/share/jmk/multiplat.jmk}
EOF
done