parallel compilation

This commit is contained in:
Timerix22 2022-06-11 15:10:45 +03:00
parent 2e3f16905b
commit a475b0d73c

View File

@ -21,19 +21,20 @@ function compile {
print "${BLUE}args: ${GRAY}$args\n" print "${BLUE}args: ${GRAY}$args\n"
local sources=$5 local sources=$5
print "${BLUE}sources: ${GRAY}$sources\n" print "${BLUE}sources: ${GRAY}$sources\n"
local error=0 local compilation_error=0
for srcfile in $sources for srcfile in $sources
do do (
local object="$OBJDIR/$(basename $srcfile).o" local object="$OBJDIR/$(basename $srcfile).o"
#print "$BLUE$object\n"
if ! $($cmp -std=$std $warn $args -c -o $object $srcfile) if ! $($cmp -std=$std $warn $args -c -o $object $srcfile)
then then
print "${RED}some error happened\n" print "${RED}some error happened\n"
error=1 compilation_error=1
fi fi
done ) & done
wait
if [ $error != 0 ] if [ $compilation_error != 0 ]
then then
exit 1 exit 1
fi fi
@ -42,7 +43,7 @@ function compile {
# (args, sources) # (args, sources)
function compile_c { function compile_c {
print "${CYAN}-------------[compile_c]--------------\n" print "${CYAN}-------------[compile_c]--------------\n"
compile $CMP_C $STD_C "$WARN_C " "$1" "$2" compile $CMP_C $STD_C "$WARN_C" "$1" "$2"
} }
# (args, sources) # (args, sources)