blob: 92b703a71aeacd163f1a9fac5d3790edb975b82b [file] [log] [blame]
swissChili35558852022-07-02 18:15:45 -07001#!/bin/sh
2
3# Jay MaKe
4
5dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
6root="$(dirname $dir)"
7jmkscript="$root/share/jmk/jmk.tcl"
8options=""
9
10disable_gtags=false
11
swissChili0db97752022-07-29 21:09:16 -070012cc=cc
13ld=ld
14asm=as
15
16while getopts "hD:c:a:l:" arg; do
swissChili35558852022-07-02 18:15:45 -070017 case $arg in
18 h) echo "Please read the JMK manual for more information." ;;
19 D) options="$options $(echo $OPTARG | sed 's/=/ /')" ;;
swissChili0db97752022-07-29 21:09:16 -070020 c) cc="$OPTARG" ;;
21 a) ld="$OPTARG" ;;
22 l) asm="$OPTARG" ;;
swissChili35558852022-07-02 18:15:45 -070023 ?) echo "Invalid argument"
24 exit 1 ;;
25 esac
26done
27
swissChili9b46c902022-07-10 15:48:46 -070028echo "Options: {$options }"
swissChili35558852022-07-02 18:15:45 -070029
30for file in $(find -name Jmk2); do
31 echo "$file" > /dev/stderr
32 outdir="$(dirname $file)"
33 cat - $file << EOF | tclsh - $options > "$outdir/Makefile"
34source {$root/share/jmk/jmk.tcl}
swissChili0db97752022-07-29 21:09:16 -070035set cc {$cc}
36set ld {$ld}
37set asm {$asm}
swissChili35558852022-07-02 18:15:45 -070038set root {$root}
swissChili56cf8172022-07-30 18:47:48 -070039set jmk_build_cmd {$0 $*}
swissChili35558852022-07-02 18:15:45 -070040set jmk_build_dir {$(pwd)}
swissChilie4229a22023-01-01 15:59:53 -050041set jmk_makefile_dir {$PWD/$outdir}
swissChili35558852022-07-02 18:15:45 -070042cd {$outdir}
43array set options {$options}
swissChili9b46c902022-07-10 15:48:46 -070044source {$root/share/jmk/multiplat.jmk}
swissChili35558852022-07-02 18:15:45 -070045EOF
46done