blob: 4bb9e1c6ec585bec5829ea45ced8deb66a989e61 [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}
39set jmk_build_cmd {$0}
40set jmk_build_dir {$(pwd)}
41cd {$outdir}
42array set options {$options}
swissChili9b46c902022-07-10 15:48:46 -070043source {$root/share/jmk/multiplat.jmk}
swissChili35558852022-07-02 18:15:45 -070044EOF
45done