From 5ef50a0f30184c572c1829d0a161b2eb8af8a6a3 Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Fri, 3 Mar 2023 11:10:06 -0600 Subject: [PATCH] GNUMake 4.4.1 requires MAKEFLAGS to be in the correct order. Prepending -j results in errors when using --print-directory (as it gets translated to 'w') Fixed by not modifying MAKEFLAGS Using MAKE: /home/balay/tmp/make-4.4.1/gmake Using MAKEFLAGS: -j10 -l18.0 w -- PETSC_DIR=/home/balay/petsc PETSC_ARCH=arch-linux-c-debug ========================================== gmake[3]: Entering directory '/home/balay/petsc' /usr/bin/python3 ./config/gmakegen.py --petsc-arch=arch-linux-c-debug /usr/bin/python3 /home/balay/petsc/config/gmakegentest.py --petsc-dir=/home/balay/petsc --petsc-arch=arch-linux-c-debug --testdir=./arch-linux-c-debug/tests gmake[3]: *** No rule to make target 'w'. Stop. --- lib/petsc/conf/rules | 16 +++++++++++++++- makefile | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/petsc/conf/rules b/lib/petsc/conf/rules index 7219d0274e7..a24e64130c4 100644 --- a/lib/petsc/conf/rules +++ b/lib/petsc/conf/rules @@ -53,7 +53,21 @@ ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles: @${MKDIR} -p ${PETSC_DIR}/${PETSC_ARCH}/tests && touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles libs: ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles - +@cd ${PETSC_DIR} && MAKEFLAGS="-j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" ${OMAKE_PRINTDIR} -f gmakefile ${MAKE_PAR_OUT_FLG} V=${V} libs + +@r=`echo "${MAKEFLAGS}" | grep ' \-j'`; \ + if [ "$$?" = 0 ]; then \ + make_j="";\ + echo "Skipping adding -jMAKE_NP option as -j option is already specified"; \ + else \ + make_j="-j${MAKE_NP}"; \ + fi; \ + r=`echo "${MAKEFLAGS}" | grep ' \-l'`; \ + if [ "$$?" = 0 ]; then \ + make_l="";\ + echo "Skipping adding -lMAKE_LOAD option as -l option is already specified"; \ + else \ + make_l="-l${MAKE_LOAD}"; \ + fi; \ + cd ${PETSC_DIR} && ${OMAKE_PRINTDIR} -f gmakefile $${make_j} $${make_l} ${MAKE_PAR_OUT_FLG} V=${V} libs # Does nothing; needed for some rules that require actions. foo: diff --git a/makefile b/makefile index a8329057970..8cdd2fc5af1 100644 --- a/makefile +++ b/makefile @@ -122,8 +122,8 @@ info: -@echo "------------------------------------------" -@echo "Using mpiexec: ${MPIEXEC}" -@echo "------------------------------------------" - -@echo "Using MAKE: $(MAKE)" - -@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" + -@echo "Using MAKE: ${MAKE}" + -@echo "Default MAKEFLAGS: MAKE_NP:${MAKE_NP} MAKE_LOAD:${MAKE_LOAD} MAKEFLAGS:${MAKEFLAGS}" -@echo "==========================================" # -- GitLab