From 5bf3781da53d2e5fd0798a47eacec35b4600adee Mon Sep 17 00:00:00 2001 From: RToax <2386499836@qq.com> Date: Sun, 26 Sep 2021 01:26:37 +0000 Subject: [PATCH] add `-j|--jobs` to libcare-patch-make for `make -j ` add `-j|--jobs` to libcare-patch-make for `make -j `, i think is better to compile, `make -j 12` is faster than pure `make`. --- src/libcare-patch-make | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libcare-patch-make b/src/libcare-patch-make index 7138f89..f7505ee 100755 --- a/src/libcare-patch-make +++ b/src/libcare-patch-make @@ -7,6 +7,7 @@ Makes `kpatch'es for the makesystem in the current directory. Usage: libcare-patch-make [-h|--help] [-u|--update || -c|--clean] [-s|--srcdir=SRCDIR] \ [-d|--destdir=DESTDIRVAR] \ + [-j|--jobs=] \ PATCH1 PATCH2 ... Run from inside the directory with `make'ble software. Makesystem must support @@ -17,6 +18,8 @@ install with specified DESTDIR. working on patch utils. -d --destdir specify variable makefile system uses to specify destination directory for the installation + -j --jobs specify variable makefile system jobs of compile, like `make -j 4` + is startup `4` jobs to compile. EOF exit ${1-0} } @@ -72,6 +75,9 @@ trap "restore_origs" 0 build_objects() { restore_origs + JOBS_MAKE="" + test $jobs_make && JOBS_MAKE="-j $jobs_make" + if test -n "$do_clean"; then make $LPMAKEFILE clean >$MAKE_OUTPUT 2>&1 rm -rf "$LPMAKE_ORIGINAL_DIR" "$LPMAKE_PATCHED_DIR" @@ -81,7 +87,7 @@ build_objects() { export KPCC_DBGFILTER_ARGS="" echo "${green}BUILDING ORIGINAL CODE${reset}" - make $LPMAKEFILE >$MAKE_OUTPUT 2>&1 + make $LPMAKEFILE $JOBS_MAKE >$MAKE_OUTPUT 2>&1 echo "${green}INSTALLING ORIGINAL OBJECTS INTO $LPMAKE_ORIGINAL_DIR${reset}" make $LPMAKEFILE install \ @@ -107,7 +113,7 @@ build_objects() { export KPCC_APPEND_ARGS="-Wl,-q" echo "${green}BUILDING PATCHED CODE${reset}" - make $LPMAKEFILE >$MAKE_OUTPUT 2>&1 + make $LPMAKEFILE $JOBS_MAKE >$MAKE_OUTPUT 2>&1 echo "${green}INSTALLING PATCHED OBJECTS INTO $LPMAKE_PATCHED_DIR${reset}" make $LPMAKEFILE install \ @@ -149,7 +155,7 @@ build_kpatches() { main() { PROG_NAME=$(basename $0) - TEMP=$(getopt -o s:ucd --long srcdir:,update,clean,destdir: -n ${PROG_NAME} -- "$@" || usage 1) + TEMP=$(getopt -o s:ucdj: --long srcdir:,update,clean,destdir: -n ${PROG_NAME} -- "$@" || usage 1) eval set -- "$TEMP" destdir="DESTDIR" @@ -173,6 +179,11 @@ main() { destdir=$1 shift ;; + -j|--jobs) + shift + jobs_make=$1 + shift + ;; --) shift; break; ;; -- Gitee