File fix_MFLAGS.patch of Package gbench

From a2222ec51fa80fd60c7cc20eec39fc8b8621089e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Mon, 29 Aug 2022 19:38:02 +0200
Subject: [PATCH] Remove explicit MFLAGS passing in Makefiles

MFLAGS should not be passed explicitly, as these are already passed down
by GMake itself. Doing so breaks jobserver mode.
---
 src/build-system/Makefile.meta_l                 | 16 ++++++++--------
 .../project_tree_builder/proj_builder_app.cpp    | 10 +++++-----
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/build-system/Makefile.meta_l b/src/build-system/Makefile.meta_l
index b4855469..a056ad74 100644
--- a/src/build-system/Makefile.meta_l
+++ b/src/build-system/Makefile.meta_l
@@ -129,7 +129,7 @@ endef
 
 
 MAKE_USR = $(MAKE) -f "$$x_mfile" builddir="$(builddir)" \
-           srcdir="$(abs_srcdir)" $(MFLAGS_NR)
+           srcdir="$(abs_srcdir)"
 ANY_USR_PROJ = $(USR_PROJ)$(XUNIX_USR_PROJ)$(EXPENDABLE_USR_PROJ)
 ANY_UNIX_PROJ = $(UNIX_PROJ)$(EXPENDABLE_UNIX_PROJ)
 ifneq "$(ANY_USR_PROJ)$(ANY_UNIX_PROJ)" ""
@@ -164,7 +164,7 @@ define make_one_spec_proj
 $(ign)+@i=$(1) ; \
 $(echo_unless_silent) "cd $(abs_srcdir)  &&  $(MAKE_$(2)) $(3)" ; \
 cd $(abs_srcdir) && \
-if MAKE="$(MAKE) $(MFLAGS_NR)" \
+if MAKE="$(MAKE)" \
      $(RWL) -base make_asn -log "$(CURDIR)/make_$(1)_src.log" $(MAKE_$(2)) $(3) \
    &&  $(MAKE_LIB) src-stamp; then \
     : ; \
@@ -186,7 +186,7 @@ endef
 ### The i shell variable is a legacy of the previous approach,
 ### retained for compatibility with new_project and import_project.
 MAKE_LIB = $(MAKE) -f "$(builddir)/Makefile.lib.tmpl" srcdir="$(srcdir)" \
-           TMPL="$$i" $(MFLAGS_NR)
+           TMPL="$$i"
 ifeq "" "$(filter $(LIB_PROJ),$(foreach t,$(SPEC_TYPES),$($(t)_PROJ)))"
   LIB_TYPES = $(SPEC_TYPES) LIB
 else
@@ -215,7 +215,7 @@ $(call make_lib_proj_type,EXPENDABLE_LIB,$(1),1,-)
 endef
 
 MAKE_APP = $(MAKE) -f "$(builddir)/Makefile.app.tmpl" srcdir="$(srcdir)" \
-           TMPL="$$i" $(APP_NOCOPY) $(MFLAGS_NR)
+           TMPL="$$i" $(APP_NOCOPY)
 
 # 1: proj_name, 2: target, 3: is_expendable
 define make_one_app_proj
@@ -228,7 +228,7 @@ $(foreach p,$(EXPENDABLE_APP_PROJ),-$(call make_one_app_proj,$(p),$(1),1))
 endef
 
 MAKE_METAL = $(MAKE) -f "$(builddir)/Makefile.metal.tmpl" srcdir="$(srcdir)" \
-             TMPL="$$i" $(APP_NOCOPY) $(MFLAGS_NR)
+             TMPL="$$i" $(APP_NOCOPY)
 
 # 1: proj_name, 2: target, 3: is_expendable
 define make_one_metal_proj
@@ -243,7 +243,7 @@ ifneq "$(wildcard $(check_run))" ""
 # 1: target
 define make_check
 +@$(RWL) -base check $(check_run) $(signature) $(builddir) $(abs_top_srcdir) \
-    $(MAKE) $(MFLAGS_NR) IS_CHECK=Y $(1)  ||  exit 7
+    $(MAKE) IS_CHECK=Y $(1)  ||  exit 7
 endef
 endif
 
@@ -284,7 +284,7 @@ has_usr_locked = $(has_usr:%_l=%.usr.locked)
 ifeq ":" "$(NCBI_USING_FLAT_MAKEFILE):$(filter 0 1,$(proj_count))"
   $(has_usr_l_real): %_l.real:
 	@$(RWL) -base make__$(notdir $(CURDIR))_common \
-	    $(MAKE) $(MFLAGS_NR) $*.nonusr
+	    $(MAKE) $*.nonusr
 else
   $(has_usr_l_real): %_l.real: %.nonusr ;
 endif
@@ -312,7 +312,7 @@ else
   all.usr.locked: sources.usr.locked ;
 
   $(filter-out all.usr.locked,$(has_usr_locked)): %.usr.locked:
-	@$(RWL) -base make_user_projects $(MAKE) $(MFLAGS_NR) $*.usr
+	@$(RWL) -base make_user_projects $(MAKE) $*.usr
 
   $(has_usr_nonusr): %.nonusr: %.usr.locked
 endif
diff --git a/src/build-system/project_tree_builder/proj_builder_app.cpp b/src/build-system/project_tree_builder/proj_builder_app.cpp
index 691df947..78a92071 100644
--- a/src/build-system/project_tree_builder/proj_builder_app.cpp
+++ b/src/build-system/project_tree_builder/proj_builder_app.cpp
@@ -1045,7 +1045,7 @@ void CProjBulderApp::GenerateUnixProjects(CProjectItemsTree& projects_tree)
     }
     ofs << "# Non-redundant flags (will be overridden for GNU Make to avoid" << endl;
     ofs << "# --jobserver-fds=* proliferation)" << endl;
-    ofs << "MFLAGS_NR = $(MFLAGS)" << endl;
+    ofs << "MFLAGS_NR = \"\"" << endl;
     ofs << "SKIP_PRELIMINARIES= sources= configurables=configurables.null" << endl;
 
 // all dirs -----------------------------------------------------------------
@@ -1481,7 +1481,7 @@ void CProjBulderApp::GenerateUnixProjects(CProjectItemsTree& projects_tree)
         ofs << endl << endl;
 #else
         ofs << target << " :" << endl
-            << "\t$(MAKE) $(MFLAGS) -f $(MINPUT) " << target << dotreal
+            << "\t$(MAKE) -f $(MINPUT) " << target << dotreal
             << " MTARGET=$(MTARGET)";
         ofs << endl << endl;
         ofs << target << dotreal << " :";
@@ -1511,7 +1511,7 @@ void CProjBulderApp::GenerateUnixProjects(CProjectItemsTree& projects_tree)
         if (p->second.m_MakeType == eMakeType_Expendable) {
             ofs << " NCBI_BUT_EXPENDABLE=' (but expendable)'";
         }
-        ofs << " $(MAKE) $(MFLAGS)"
+        ofs << " $(MAKE) "
             << " APP_PROJ=" << target_app
             << (p->second.m_IsMetallib ? " LIB_PROJ=\"\" METAL_PROJ=" : " LIB_PROJ=") << target_lib
             << " UNIX_PROJ=" << target_user
@@ -1523,7 +1523,7 @@ void CProjBulderApp::GenerateUnixProjects(CProjectItemsTree& projects_tree)
  #endif
         if (hasDataspec) {
             ofs << target << dotfiles << " :" << endl
-                << "\t$(MAKE) $(MFLAGS) -f $(MINPUT) $(SKIP_PRELIMINARIES) "
+                << "\t$(MAKE) -f $(MINPUT) $(SKIP_PRELIMINARIES) "
                 << target << dotfiles << dotreal;
             ofs << endl << endl;
             ofs << target << dotfiles << dotreal << " :";
@@ -1605,7 +1605,7 @@ void CProjBulderApp::GenerateUnixProjects(CProjectItemsTree& projects_tree)
         }
         ofs << endl << "\t";
         ofs << "-";
-        ofs << "cd " << target << " && $(MAKE) $(MFLAGS) sources";
+        ofs << "cd " << target << " && $(MAKE) sources";
         ofs << endl << endl;
     }
 }
-- 
2.37.2

openSUSE Build Service is sponsored by