mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-26 07:49:05 +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,9 +23,12 @@ esac
|
||||||
}
|
}
|
||||||
local -a targs
|
local -a targs
|
||||||
local -a flags
|
local -a flags
|
||||||
|
local j=-j$(autoload -Uz nproc >/dev/null 2>&1 ; nproc)
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
-j*) j=$1; shift ;;
|
||||||
-*|*=*) flags+=($1); shift ;;
|
-*|*=*) flags+=($1); shift ;;
|
||||||
|
o/*) flags+=($1); shift ;; # cheat; passthru
|
||||||
*) targs+=($1); shift ;;
|
*) targs+=($1); shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -33,4 +36,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 $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…
Add table
Reference in a new issue