parent
488acd9d07
commit
2d34b1f5bc
1 changed files with 24 additions and 0 deletions
|
|
@ -21,10 +21,23 @@ do
|
||||||
optosname=$2
|
optosname=$2
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--parallel)
|
||||||
|
parallel=$2
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
--extraBuildArgs)
|
--extraBuildArgs)
|
||||||
extraBuildArgs=" $2"
|
extraBuildArgs=" $2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-h | --help)
|
||||||
|
echo "Options:"
|
||||||
|
echo " --os <OS>"
|
||||||
|
echo " --cpu <CPU architecture>"
|
||||||
|
echo " --osname <name> Additional OS specification (used for Android)"
|
||||||
|
echo " --extraBuildArgs <args> Additional arguments passed to the compiler"
|
||||||
|
echo " --parallel <number> Multiprocess build. Requires GNU parallel"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--) # End of all options
|
--) # End of all options
|
||||||
shift
|
shift
|
||||||
break;
|
break;
|
||||||
|
|
@ -39,7 +52,15 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
parallel="${parallel:-0}"
|
||||||
CC="${CC:-gcc}"
|
CC="${CC:-gcc}"
|
||||||
|
if [ "$parallel" -gt 1 ]; then
|
||||||
|
if ! command -v sem > /dev/null; then
|
||||||
|
echo "Error: GNU parallel is required to use --parallel"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CC="sem -j $parallel --id $$ ${CC}"
|
||||||
|
fi
|
||||||
COMP_FLAGS="${CPPFLAGS:-} ${CFLAGS:-} ?{c.ccompiler.flags}$extraBuildArgs"
|
COMP_FLAGS="${CPPFLAGS:-} ${CFLAGS:-} ?{c.ccompiler.flags}$extraBuildArgs"
|
||||||
LINK_FLAGS="${LDFLAGS:-} ?{c.linker.flags}"
|
LINK_FLAGS="${LDFLAGS:-} ?{c.linker.flags}"
|
||||||
PS4=""
|
PS4=""
|
||||||
|
|
@ -222,6 +243,9 @@ case $myos in
|
||||||
$CC $COMP_FLAGS -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")}
|
$CC $COMP_FLAGS -Ic_code -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
||||||
# end for
|
# end for
|
||||||
|
if [ "$parallel" -gt 0 ]; then
|
||||||
|
sem --wait --id $$
|
||||||
|
fi
|
||||||
$CC -o ?{"$binDir/" & toLowerAscii(c.name)} ?linkCmd $LINK_FLAGS
|
$CC -o ?{"$binDir/" & toLowerAscii(c.name)} ?linkCmd $LINK_FLAGS
|
||||||
;;
|
;;
|
||||||
# end for
|
# end for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue