build: Use jobs to control xargs parallelism.

This commit is contained in:
Rémi Bernon 2021-05-28 10:50:59 +02:00 committed by Andrew Eikum
parent bdb6a31e8c
commit c1fc8283d1
2 changed files with 12 additions and 10 deletions

View file

@ -113,6 +113,8 @@ container-build:
all32 $(MAKECMDGOALS32): container-build
all64 $(MAKECMDGOALS64): container-build
else
J = $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
endif

View file

@ -55,32 +55,32 @@ ifneq ($(UNSTRIPPED_BUILD),)
$$(OBJ)/.$(1)-dist$(3):
@echo ":: installing $(3)bit $(1)..." >&2
mkdir -p $$($(2)_LIBDIR$(3))/ $$(DST_LIBDIR$(3))/
cd $$($(2)_LIBDIR$(3)) && find -type f -printf '$$(DST_LIBDIR$(3))/%h\0' | sort -z | uniq -z | xargs $(--verbose?) -0 -r -P8 mkdir -p
cd $$($(2)_LIBDIR$(3)) && find -type l -printf '%p\0$$(DST_LIBDIR$(3))/%p\0' | xargs $(--verbose?) -0 -r -P8 -n2 cp -a
cd $$($(2)_LIBDIR$(3)) && find -type f -printf '$$(DST_LIBDIR$(3))/%h\0' | sort -z | uniq -z | xargs $(--verbose?) -0 -r -P$$(J) mkdir -p
cd $$($(2)_LIBDIR$(3)) && find -type l -printf '%p\0$$(DST_LIBDIR$(3))/%p\0' | xargs $(--verbose?) -0 -r -P$$(J) -n2 cp -a
cd $$($(2)_LIBDIR$(3)) && find -type f -not '(' -iname '*.pc' -or -iname '*.cmake' -or -iname '*.a' -or -iname '*.def' ')' \
-printf '--only-keep-debug\0%p\0$$(DST_LIBDIR$(3))/%p.debug\0' | \
xargs $(--verbose?) -0 -r -P8 -n3 objcopy --file-alignment=4096
xargs $(--verbose?) -0 -r -P$$(J) -n3 objcopy --file-alignment=4096
cd $$($(2)_LIBDIR$(3)) && find -type f -not '(' -iname '*.pc' -or -iname '*.cmake' -or -iname '*.a' -or -iname '*.def' ')' \
-printf '--add-gnu-debuglink=$$(DST_LIBDIR$(3))/%p.debug\0--strip-debug\0%p\0$$(DST_LIBDIR$(3))/%p\0' | \
xargs $(--verbose?) -0 -r -P8 -n4 objcopy --file-alignment=4096
xargs $(--verbose?) -0 -r -P$$(J) -n4 objcopy --file-alignment=4096
cd $$($(2)_LIBDIR$(3)) && find -type f -name '*.dll' \
-printf '$$(DST_LIBDIR$(3))/%p\0' | \
xargs $(--verbose?) -0 -r -P8 -n1 $$(SRC)/make/pefixup.py
xargs $(--verbose?) -0 -r -P$$(J) -n1 $$(SRC)/make/pefixup.py
touch $$@
else
$$(OBJ)/.$(1)-dist$(3):
@echo ":: installing $(3)bit $(1)..." >&2
mkdir -p $$($(2)_LIBDIR$(3))/ $$(DST_LIBDIR$(3))/
cd $$($(2)_LIBDIR$(3)) && find -type f -printf '$$(DST_LIBDIR$(3))/%h\0' | sort -z | uniq -z | xargs $(--verbose?) -0 -r -P8 mkdir -p
cd $$($(2)_LIBDIR$(3)) && find -type l -printf '%p\0$$(DST_LIBDIR$(3))/%p\0' | xargs $(--verbose?) -0 -r -P8 -n2 cp -a
cd $$($(2)_LIBDIR$(3)) && find -type f -printf '$$(DST_LIBDIR$(3))/%h\0' | sort -z | uniq -z | xargs $(--verbose?) -0 -r -P$$(J) mkdir -p
cd $$($(2)_LIBDIR$(3)) && find -type l -printf '%p\0$$(DST_LIBDIR$(3))/%p\0' | xargs $(--verbose?) -0 -r -P$$(J) -n2 cp -a
cd $$($(2)_LIBDIR$(3)) && find -type f -not '(' -iname '*.pc' -or -iname '*.cmake' -or -iname '*.a' -or -iname '*.def' ')' \
-printf '$$(DST_LIBDIR$(3))/%p.debug\0' | xargs $(--verbose?) -0 -r -P8 rm -f
-printf '$$(DST_LIBDIR$(3))/%p.debug\0' | xargs $(--verbose?) -0 -r -P$$(J) rm -f
cd $$($(2)_LIBDIR$(3)) && find -type f -not '(' -iname '*.pc' -or -iname '*.cmake' -or -iname '*.a' -or -iname '*.def' ')' \
-printf '--strip-debug\0%p\0$$(DST_LIBDIR$(3))/%p\0' | \
xargs $(--verbose?) -0 -r -P8 -n3 objcopy --file-alignment=4096
xargs $(--verbose?) -0 -r -P$$(J) -n3 objcopy --file-alignment=4096
cd $$($(2)_LIBDIR$(3)) && find -type f -name '*.dll' \
-printf '$$(DST_LIBDIR$(3))/%p\0' | \
xargs $(--verbose?) -0 -r -P8 -n1 $$(SRC)/make/pefixup.py
xargs $(--verbose?) -0 -r -P$$(J) -n1 $$(SRC)/make/pefixup.py
touch $$@
endif
endif