Skip to contentSkip to conversation

build: remove use of MAKELEVEL optimization in submodule handling

PATCH In review Daniel P. Berrange 3 participants 3 messages Nov 6, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: remove use of MAKELEVEL optimization in submodule handling

The Makefile attempts to optimize the handling of submodules by using MAKELEVEL to only check the submodule status when running from the top level make invokation. This causes problems for people who are using a makefile of their own to in turn invoke QEMU's makefile, as MAKELEVEL is already set to 1 (or more) when QEMU's makefile runs.

This optimization should not really be needed, since the git-submodule.sh script is already used to detect if a submodule update is required. This by removing the MAKELEVEL check, we at most add an extra 'git-submodule.sh status' call to each make level, the overhead of which is lost in noise of building QEMU.

---

NB this is on top of https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg00449.html

 Makefile | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Makefile +5 -7
index a92d7b8e14..0496c5057a 100644
@@ -18,12 +18,11 @@ git-submodule-update:
 
 .PHONY: git-submodule-update
 
-ifeq (0,$(MAKELEVEL))
-  git_module_status := $(shell \
-    cd '$(SRC_PATH)' && \
-    GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
-    echo $$?; \
-  )
+git_module_status := $(shell \
+  cd '$(SRC_PATH)' && \
+  GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
+  echo $$?; \
+)
 
 ifeq (1,$(git_module_status))
 ifeq (no,$(GIT_UPDATE))
@@ -42,7 +41,6 @@ git-submodule-update:
           "GIT","$(GIT_SUBMODULES)")
 endif
 endif
-endif
 
 .git-submodule-status: git-submodule-update config-host.mak
 
Signature · 1 line
2.13.6
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Mon, 6 Nov 2017 11:41:34 +0000 "Daniel P. Berrange" <[email protected]>…

The Makefile attempts to optimize the handling of submodules by using MAKELEVEL to only check the submodule status when running from the top level make invokation. This causes problems for people who are using a makefile of their own to in turn invoke QEMU's makefile, as MAKELEVEL is already set to 1 (or more) when QEMU's makefile runs.

Quoted 9 lines

This optimization should not really be needed, since the git-submodule.sh script is already used to detect if a submodule update is required. This by removing the MAKELEVEL check, we at most add an extra 'git-submodule.sh status' call to each make level, the overhead of which is lost in noise of building QEMU.

---

Heh, I had come up with a similar patch based on master and nearly the same commit message. :)

Quoted 2 lines

NB this is on top of https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg00449.html

I could check that this patch applied on top of the series mentioned above fixes the issue for me.

Quoted 33 lines
 Makefile | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Makefile +5 -7
index a92d7b8e14..0496c5057a 100644
@@ -18,12 +18,11 @@ git-submodule-update:
 
 .PHONY: git-submodule-update
 
-ifeq (0,$(MAKELEVEL))
-  git_module_status := $(shell \
-    cd '$(SRC_PATH)' && \
-    GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
-    echo $$?; \
-  )
+git_module_status := $(shell \
+  cd '$(SRC_PATH)' && \
+  GIT="$(GIT)" ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
+  echo $$?; \
+)
 
 ifeq (1,$(git_module_status))
 ifeq (no,$(GIT_UPDATE))
@@ -42,7 +41,6 @@ git-submodule-update:
           "GIT","$(GIT_SUBMODULES)")
 endif
 endif
-endif
 
 .git-submodule-status: git-submodule-update config-host.mak
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel P. Berrange
Quoted 3 lines · Daniel P. Berrange

The Makefile attempts to optimize the handling of submodules by using MAKELEVEL to only check the submodule status when running from the top level make invokation. This causes problems for people who are using a makefile of their

s/invokation/invocation/

Quoted 5 lines

own to in turn invoke QEMU's makefile, as MAKELEVEL is already set to 1 (or more) when QEMU's makefile runs.

This optimization should not really be needed, since the git-submodule.sh script is already used to detect if a submodule update is required. This by

s/This/Thus/

Quoted 8 lines

removing the MAKELEVEL check, we at most add an extra 'git-submodule.sh status' call to each make level, the overhead of which is lost in noise of building QEMU.

---

NB this is on top of https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg00449.html

Or in wording understood by patchew:

Based-on:
https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg00449.html

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org