mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
mmake: -j$(nproc), passthrough o//
Now `mmake o/ape/ape.elf` works.
This commit is contained in:
parent
2b315626f3
commit
b08b92248b
2 changed files with 24 additions and 3 deletions
|
@ -23,14 +23,17 @@ esac
|
|||
}
|
||||
local -a targs
|
||||
local -a flags
|
||||
local j=-j$(autoload -Uz nproc >/dev/null 2>&1 ; nproc)
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-*|*=*) flags+=($1); shift ;;
|
||||
*) targs+=($1); shift ;;
|
||||
-j*) j=$1; shift ;;
|
||||
-*|*=*) flags+=($1); shift ;;
|
||||
o/*) flags+=($1); shift ;; # cheat; passthru
|
||||
*) targs+=($1); shift ;;
|
||||
esac
|
||||
done
|
||||
local make
|
||||
[[ -x /opt/cosmocc/bin/make ]] && make=/opt/cosmocc/bin/make
|
||||
[[ -z $make ]] && make=build/bootstrap/make.com
|
||||
( set -x
|
||||
exec $make $flags MODE=$mode ${(@)targs/#/o/$mode/} )
|
||||
exec $make $j $flags MODE=$mode ${(@)targs/#/o/$mode/} )
|
||||
|
|
18
tool/zsh/nproc
Normal file
18
tool/zsh/nproc
Normal file
|
@ -0,0 +1,18 @@
|
|||
[[ -x $(whence -p nproc) ]] && {
|
||||
command nproc && {
|
||||
unfunction nproc
|
||||
return
|
||||
}
|
||||
}
|
||||
[[ -x $(which sysctl) ]] && {
|
||||
nproc() {
|
||||
sysctl -n hw.ncpu
|
||||
}
|
||||
nproc && return
|
||||
}
|
||||
# TODO other platforms
|
||||
echo nproc: no implementation found >&2
|
||||
nproc() {
|
||||
echo 2
|
||||
}
|
||||
nproc
|
Loading…
Reference in a new issue