swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Jay MaKe |
| 4 | |
| 5 | dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
| 6 | root="$(dirname $dir)" |
| 7 | jmkscript="$root/share/jmk/jmk.tcl" |
| 8 | options="" |
| 9 | |
| 10 | disable_gtags=false |
| 11 | |
swissChili | 0db9775 | 2022-07-29 21:09:16 -0700 | [diff] [blame] | 12 | cc=cc |
| 13 | ld=ld |
| 14 | asm=as |
| 15 | |
| 16 | while getopts "hD:c:a:l:" arg; do |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 17 | case $arg in |
| 18 | h) echo "Please read the JMK manual for more information." ;; |
| 19 | D) options="$options $(echo $OPTARG | sed 's/=/ /')" ;; |
swissChili | 0db9775 | 2022-07-29 21:09:16 -0700 | [diff] [blame] | 20 | c) cc="$OPTARG" ;; |
| 21 | a) ld="$OPTARG" ;; |
| 22 | l) asm="$OPTARG" ;; |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 23 | ?) echo "Invalid argument" |
| 24 | exit 1 ;; |
| 25 | esac |
| 26 | done |
| 27 | |
swissChili | 9b46c90 | 2022-07-10 15:48:46 -0700 | [diff] [blame] | 28 | echo "Options: {$options }" |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 29 | |
| 30 | for file in $(find -name Jmk2); do |
| 31 | echo "$file" > /dev/stderr |
| 32 | outdir="$(dirname $file)" |
| 33 | cat - $file << EOF | tclsh - $options > "$outdir/Makefile" |
| 34 | source {$root/share/jmk/jmk.tcl} |
swissChili | 0db9775 | 2022-07-29 21:09:16 -0700 | [diff] [blame] | 35 | set cc {$cc} |
| 36 | set ld {$ld} |
| 37 | set asm {$asm} |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 38 | set root {$root} |
| 39 | set jmk_build_cmd {$0} |
| 40 | set jmk_build_dir {$(pwd)} |
| 41 | cd {$outdir} |
| 42 | array set options {$options} |
swissChili | 9b46c90 | 2022-07-10 15:48:46 -0700 | [diff] [blame] | 43 | source {$root/share/jmk/multiplat.jmk} |
swissChili | 3555885 | 2022-07-02 18:15:45 -0700 | [diff] [blame] | 44 | EOF |
| 45 | done |