mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-16 11:54:58 +00:00
mmake gets smarter
`o/$mode/*` is passed through as-is. `o/*` other than `$mode` has `$mode` inserted. `*` has `o/$mode/` prepended. Really leveraging zsh default tab completion here; if you have built things with `MODE=` you can leverage that for perfect tab completion in other modes.
This commit is contained in:
parent
c11c105270
commit
dd57c685aa
1 changed files with 7 additions and 6 deletions
|
@ -3,7 +3,7 @@
|
||||||
# fpath+=($COSMO/tool/zsh)
|
# fpath+=($COSMO/tool/zsh)
|
||||||
# autoload -Uz mmake
|
# autoload -Uz mmake
|
||||||
# e.g.:
|
# e.g.:
|
||||||
# mmake tiny -j8 ape/ape.elf
|
# mmake tiny ape/ape.elf
|
||||||
local mode
|
local mode
|
||||||
case $1 in
|
case $1 in
|
||||||
(m|MODE)=*)
|
(m|MODE)=*)
|
||||||
|
@ -26,10 +26,11 @@ local -a flags
|
||||||
local j
|
local j
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
-j*) j=$1; shift ;;
|
-j*) j=$1; shift ;;
|
||||||
-*|*=*) flags+=($1); shift ;;
|
-*|*=*) flags+=($1); shift ;;
|
||||||
o/*) flags+=($1); shift ;; # cheat; passthru
|
o/$mode/*) targs+=($1); shift ;;
|
||||||
*) targs+=($1); shift ;;
|
o/*) targs+=(o/$mode/${1#*/}); shift ;;
|
||||||
|
*) targs+=(o/$mode/$1); shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
[[ -z $j ]] && {
|
[[ -z $j ]] && {
|
||||||
|
@ -40,4 +41,4 @@ local make
|
||||||
[[ -x /opt/cosmocc/bin/make ]] && make=/opt/cosmocc/bin/make
|
[[ -x /opt/cosmocc/bin/make ]] && make=/opt/cosmocc/bin/make
|
||||||
[[ -z $make ]] && make=build/bootstrap/make.com
|
[[ -z $make ]] && make=build/bootstrap/make.com
|
||||||
( set -x
|
( set -x
|
||||||
exec $make $j $flags MODE=$mode ${(@)targs/#/o/$mode/} )
|
exec $make $j $flags MODE=$mode $targs )
|
||||||
|
|
Loading…
Add table
Reference in a new issue