* [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery
@ 2019-05-28 8:23 Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 1/4] Makefile: Remove code to smooth transition to config.status Markus Armbruster
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Markus Armbruster @ 2019-05-28 8:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, richard.henderson, philmd
We make a few sub-directories recursively, in particular
$(TARGET_DIRS).
For goal "all", we do it the nice way: "all" has a prerequisite
subdir-T for each T in $(TARGET_DIRS), and T's recipe runs make
recursively. Behaves nicely with -j and -k.
For other goals such as "clean" and "install", the recipe runs make
recursively in a for loop. Ignores -j and -k.
Generalize the recursion machinery used by "all" so we can reuse it
for "clean" and "install".
This was previously posted as PATCH 1-4 of "[RFC v4 0/7] Baby steps
towards saner headers". Changes since then:
* PATCH 1: Don't lose @ [Philippe]
* PATCH 3: Update check-report-qtest-%.tap [Philippe]
Markus Armbruster (4):
Makefile: Remove code to smooth transition to config.status
Makefile: Drop bogus cleaning of $(ALL_SUBDIRS)/qemu-options.def
Makefile: Rename targets for make recursion
Makefile: Reuse all's recursion machinery for clean and install
Makefile | 73 ++++++++++++++++++++----------------------
configure | 6 ++--
tests/Makefile.include | 5 +--
3 files changed, 40 insertions(+), 44 deletions(-)
--
2.17.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/4] Makefile: Remove code to smooth transition to config.status
2019-05-28 8:23 [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery Markus Armbruster
@ 2019-05-28 8:23 ` Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 2/4] Makefile: Drop bogus cleaning of $(ALL_SUBDIRS)/qemu-options.def Markus Armbruster
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Markus Armbruster @ 2019-05-28 8:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, richard.henderson, philmd
When commit bdf523e6923 made configure generate config.status, it
added a fallback to Makefile to smooth the transition, with a TODO
"code can be removed after QEMU 1.7." It's been more than five years.
Remove it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Makefile | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index e02b88bcb1..940594cc7c 100644
--- a/Makefile
+++ b/Makefile
@@ -69,14 +69,7 @@ CONFIG_ALL=y
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
@echo $@ is out-of-date, running configure
- @# TODO: The next lines include code which supports a smooth
- @# transition from old configurations without config.status.
- @# This code can be removed after QEMU 1.7.
- @if test -x config.status; then \
- ./config.status; \
- else \
- sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh; \
- fi
+ @./config.status
else
config-host.mak:
ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
--
2.17.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/4] Makefile: Drop bogus cleaning of $(ALL_SUBDIRS)/qemu-options.def
2019-05-28 8:23 [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 1/4] Makefile: Remove code to smooth transition to config.status Markus Armbruster
@ 2019-05-28 8:23 ` Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install Markus Armbruster
3 siblings, 0 replies; 8+ messages in thread
From: Markus Armbruster @ 2019-05-28 8:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, richard.henderson, philmd
When commit df2943ba3c7 moved "rm -f qemu-options.def" from distclean
to clean, it also added "rm -f $$d/qemu-options.def" to the for d in
$(ALL_SUBDIRS) loop. That file doesn't exist. Remove the mistaken
rm.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile b/Makefile
index 940594cc7c..80c9c6416f 100644
--- a/Makefile
+++ b/Makefile
@@ -658,7 +658,6 @@ clean:
rm -rf qga/qapi-generated
for d in $(ALL_SUBDIRS); do \
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
- rm -f $$d/qemu-options.def; \
done
rm -f config-all-devices.mak
--
2.17.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion
2019-05-28 8:23 [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 1/4] Makefile: Remove code to smooth transition to config.status Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 2/4] Makefile: Drop bogus cleaning of $(ALL_SUBDIRS)/qemu-options.def Markus Armbruster
@ 2019-05-28 8:23 ` Markus Armbruster
2019-07-03 11:24 ` Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install Markus Armbruster
3 siblings, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2019-05-28 8:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, richard.henderson, philmd
We make a few sub-directories recursively, in particular
$(TARGET_DIRS).
For goal "all", we do it the nice way: "all" has a prerequisite
subdir-T for each T in $(TARGET_DIRS), and T's recipe runs make
recursively. Behaves nicely with -j and -k.
For other goals such as "clean" and "install", the recipe runs make
recursively in a for loop. Ignores -j and -k.
The next commit will fix that for "clean" and "install". This commit
prepares the ground by renaming the targets we use for "all" to
include the goal for the sub-make. This will permit reusing them for
goals other than "all".
Targets subdir-T for T in $(TARGET_DIRS) run "make all" in T. Rename
to T/all, and declare phony.
Targets romsubdir-R for R in $(ROMS) run "make" in pc-bios/R. Default
goal is "all" for all R. Rename to pc-bios/R/all, and declare phony.
The remainder are renamed just for consistency.
Target subdir-dtc runs "make libbft/libfdt.a" in dtc. Rename to
dtc/all, and declare phony.
Target subdir-capstone runs make $(BUILD_DIR)/capstone/$(LIBCAPSTONE)
in $(SRC_PATH)/capstone. Rename to capstone/all, and declare phony.
Target subdir-slirp runs "make" in $(SRC_PATH)/slirp. Default goal is
all, which builds $(BUILD_DIR)/libslirp.a. Rename to slirp/all, and
declare phony.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Makefile | 30 ++++++++++++++++++------------
configure | 6 +++---
tests/Makefile.include | 5 +++--
3 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
index 80c9c6416f..42930b7749 100644
--- a/Makefile
+++ b/Makefile
@@ -437,8 +437,8 @@ config-host.h-timestamp: config-host.mak
qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
-SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
-SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
+SUBDIR_RULES=$(addsuffix /all, $(TARGET_DIRS))
+SOFTMMU_SUBDIR_RULES=$(filter %-softmmu/all,$(SUBDIR_RULES))
$(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
@@ -448,14 +448,16 @@ $(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
$(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
-subdir-%:
- $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
+.PHONY: $(SUBDIR_RULES)
+$(SUBDIR_RULES):
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" all,)
DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
-subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
+.PHONY: dtc/all
+dtc/all: .git-submodule-status dtc/libfdt dtc/tests
$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
dtc/%: .git-submodule-status
@@ -473,21 +475,25 @@ CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
CAP_CFLAGS += -DCAPSTONE_HAS_X86
-subdir-capstone: .git-submodule-status
+.PHONY: capstone/all
+capstone/all: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
-subdir-slirp: .git-submodule-status
+.PHONY: slirp/all
+slirp/all: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
-ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
+ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
+ROMSUBDIR_RULES=$(addsuffix /all, $(ROM_DIRS))
# Only keep -O and -g cflags
-romsubdir-%:
- $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
+.PHONY: $(ROMSUBDIR_RULES)
+$(ROMSUBDIR_RULES):
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
-ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
+ALL_SUBDIRS=$(TARGET_DIRS) $(ROM_DIRS)
recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
@@ -1098,7 +1104,7 @@ endif
@$(if $(TARGET_DIRS), \
echo 'Architecture specific targets:'; \
$(foreach t, $(TARGET_DIRS), \
- printf " %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
+ printf " %-30s - Build for %s\\n" $(t)/all $(t);) \
echo '')
@echo 'Cleaning targets:'
@echo ' clean - Remove most generated files but keep the config'
diff --git a/configure b/configure
index 528b9ff705..effd943a05 100755
--- a/configure
+++ b/configure
@@ -6597,7 +6597,7 @@ if test "$slirp" != "no"; then
echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak
fi
if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then
- echo "config-host.h: subdir-slirp" >> $config_host_mak
+ echo "config-host.h: slirp/all" >> $config_host_mak
fi
if test "$vde" = "yes" ; then
echo "CONFIG_VDE=y" >> $config_host_mak
@@ -7865,10 +7865,10 @@ if test -n "$enabled_cross_compilers"; then
fi
if [ "$fdt" = "git" ]; then
- echo "config-host.h: subdir-dtc" >> $config_host_mak
+ echo "config-host.h: dtc/all" >> $config_host_mak
fi
if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
- echo "config-host.h: subdir-capstone" >> $config_host_mak
+ echo "config-host.h: capstone/all" >> $config_host_mak
fi
if test -n "$LIBCAPSTONE"; then
echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 1865f6b322..1a3f17faa9 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -1,3 +1,4 @@
+# -*- Mode: makefile -*-
.PHONY: check-help
check-help:
@@ -880,7 +881,7 @@ define do_test_tap
endef
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
-$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y)
+$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: %-softmmu/all $(check-qtest-y)
$(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \
QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
QTEST_QEMU_IMG=qemu-img$(EXESUF))
@@ -893,7 +894,7 @@ check-speed: $(check-speed-y)
# gtester tests with TAP output
-$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: subdir-%-softmmu $(check-qtest-y)
+$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: %-softmmu/all $(check-qtest-y)
$(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \
QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
QTEST_QEMU_IMG=qemu-img$(EXESUF))
--
2.17.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install
2019-05-28 8:23 [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery Markus Armbruster
` (2 preceding siblings ...)
2019-05-28 8:23 ` [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion Markus Armbruster
@ 2019-05-28 8:23 ` Markus Armbruster
2019-05-28 15:55 ` Philippe Mathieu-Daudé
3 siblings, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2019-05-28 8:23 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, richard.henderson, philmd
Targets "clean" and "install" run make recursively in a for loop.
This ignores -j and -k. Target "all" depends on SUBDIR/all to recurse
into each SUBDIR. Behaves nicely with -j and -k. Put that to use for
"clean" and "install": depend on SUBDIR/clean or SUBDIR/install,
respectively, and delete the loop.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
Makefile | 53 +++++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/Makefile b/Makefile
index 42930b7749..f194c61122 100644
--- a/Makefile
+++ b/Makefile
@@ -437,20 +437,22 @@ config-host.h-timestamp: config-host.mak
qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
-SUBDIR_RULES=$(addsuffix /all, $(TARGET_DIRS))
-SOFTMMU_SUBDIR_RULES=$(filter %-softmmu/all,$(SUBDIR_RULES))
+TARGET_DIRS_RULES := $(foreach t, all clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
-$(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
-$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
-$(SOFTMMU_SUBDIR_RULES): $(chardev-obj-y)
-$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
-$(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
-$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
-$(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
+SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
+$(SOFTMMU_ALL_RULES): $(authz-obj-y)
+$(SOFTMMU_ALL_RULES): $(block-obj-y)
+$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
+$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
+$(SOFTMMU_ALL_RULES): $(io-obj-y)
+$(SOFTMMU_ALL_RULES): config-all-devices.mak
+$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
-.PHONY: $(SUBDIR_RULES)
-$(SUBDIR_RULES):
- $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" all,)
+.PHONY: $(TARGET_DIRS_RULES)
+# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
+# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
+$(TARGET_DIRS_RULES):
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
@@ -483,19 +485,19 @@ capstone/all: .git-submodule-status
slirp/all: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
-$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
+$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
-ROMSUBDIR_RULES=$(addsuffix /all, $(ROM_DIRS))
+ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
# Only keep -O and -g cflags
-.PHONY: $(ROMSUBDIR_RULES)
-$(ROMSUBDIR_RULES):
- $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
+.PHONY: $(ROM_DIRS_RULES)
+$(ROM_DIRS_RULES):
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
-ALL_SUBDIRS=$(TARGET_DIRS) $(ROM_DIRS)
-
-recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
+recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
+recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
+recurse-install: $(addsuffix /install, $(TARGET_DIRS))
$(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
$(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
@@ -641,7 +643,7 @@ clean-coverage:
"CLEAN", "coverage files")
endif
-clean:
+clean: recurse-clean
# avoid old build problems by removing potentially incorrect old files
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
rm -f qemu-options.def
@@ -662,9 +664,6 @@ clean:
rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
rm -f qapi-gen-timestamp
rm -rf qga/qapi-generated
- for d in $(ALL_SUBDIRS); do \
- if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
- done
rm -f config-all-devices.mak
VERSION ?= $(shell cat VERSION)
@@ -810,7 +809,8 @@ endif
ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir \
- $(if $(INSTALL_BLOBS),$(edk2-decompressed))
+ $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
+ recurse-install
ifneq ($(TOOLS),)
$(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
endif
@@ -870,9 +870,6 @@ endif
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
done
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
- for d in $(TARGET_DIRS); do \
- $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
- done
.PHONY: ctags
ctags:
--
2.17.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install
2019-05-28 8:23 ` [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install Markus Armbruster
@ 2019-05-28 15:55 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-28 15:55 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: pbonzini, richard.henderson
On 5/28/19 10:23 AM, Markus Armbruster wrote:
> Targets "clean" and "install" run make recursively in a for loop.
> This ignores -j and -k. Target "all" depends on SUBDIR/all to recurse
> into each SUBDIR. Behaves nicely with -j and -k. Put that to use for
> "clean" and "install": depend on SUBDIR/clean or SUBDIR/install,
> respectively, and delete the loop.
Very nice!
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Makefile | 53 +++++++++++++++++++++++++----------------------------
> 1 file changed, 25 insertions(+), 28 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 42930b7749..f194c61122 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -437,20 +437,22 @@ config-host.h-timestamp: config-host.mak
> qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
> $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
>
> -SUBDIR_RULES=$(addsuffix /all, $(TARGET_DIRS))
> -SOFTMMU_SUBDIR_RULES=$(filter %-softmmu/all,$(SUBDIR_RULES))
> +TARGET_DIRS_RULES := $(foreach t, all clean install, $(addsuffix /$(t), $(TARGET_DIRS)))
>
> -$(SOFTMMU_SUBDIR_RULES): $(authz-obj-y)
> -$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
> -$(SOFTMMU_SUBDIR_RULES): $(chardev-obj-y)
> -$(SOFTMMU_SUBDIR_RULES): $(crypto-obj-y)
> -$(SOFTMMU_SUBDIR_RULES): $(io-obj-y)
> -$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
> -$(SOFTMMU_SUBDIR_RULES): $(edk2-decompressed)
> +SOFTMMU_ALL_RULES=$(filter %-softmmu/all, $(TARGET_DIRS_RULES))
> +$(SOFTMMU_ALL_RULES): $(authz-obj-y)
> +$(SOFTMMU_ALL_RULES): $(block-obj-y)
> +$(SOFTMMU_ALL_RULES): $(chardev-obj-y)
> +$(SOFTMMU_ALL_RULES): $(crypto-obj-y)
> +$(SOFTMMU_ALL_RULES): $(io-obj-y)
> +$(SOFTMMU_ALL_RULES): config-all-devices.mak
> +$(SOFTMMU_ALL_RULES): $(edk2-decompressed)
>
> -.PHONY: $(SUBDIR_RULES)
> -$(SUBDIR_RULES):
> - $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" all,)
> +.PHONY: $(TARGET_DIRS_RULES)
> +# The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that
> +# $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal
> +$(TARGET_DIRS_RULES):
> + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
>
> DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_srcdir=$(SRC_PATH)/dtc/libfdt
> DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
> @@ -483,19 +485,19 @@ capstone/all: .git-submodule-status
> slirp/all: .git-submodule-status
> $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
>
> -$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
> +$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \
> $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
>
> ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
> -ROMSUBDIR_RULES=$(addsuffix /all, $(ROM_DIRS))
> +ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
> # Only keep -O and -g cflags
> -.PHONY: $(ROMSUBDIR_RULES)
> -$(ROMSUBDIR_RULES):
> - $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
> +.PHONY: $(ROM_DIRS_RULES)
> +$(ROM_DIRS_RULES):
> + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" CFLAGS="$(filter -O% -g%,$(CFLAGS))" $(notdir $@),)
>
> -ALL_SUBDIRS=$(TARGET_DIRS) $(ROM_DIRS)
> -
> -recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
> +recurse-all: $(addsuffix /all, $(TARGET_DIRS) $(ROM_DIRS))
> +recurse-clean: $(addsuffix /clean, $(TARGET_DIRS) $(ROM_DIRS))
> +recurse-install: $(addsuffix /install, $(TARGET_DIRS))
>
> $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc config-host.h
> $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<,"RC","version.o")
> @@ -641,7 +643,7 @@ clean-coverage:
> "CLEAN", "coverage files")
> endif
>
> -clean:
> +clean: recurse-clean
> # avoid old build problems by removing potentially incorrect old files
> rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
> rm -f qemu-options.def
> @@ -662,9 +664,6 @@ clean:
> rm -f $(foreach f,$(generated-files-y),$(f) $(f)-timestamp)
> rm -f qapi-gen-timestamp
> rm -rf qga/qapi-generated
> - for d in $(ALL_SUBDIRS); do \
> - if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
> - done
> rm -f config-all-devices.mak
>
> VERSION ?= $(shell cat VERSION)
> @@ -810,7 +809,8 @@ endif
> ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
>
> install: all $(if $(BUILD_DOCS),install-doc) install-datadir install-localstatedir \
> - $(if $(INSTALL_BLOBS),$(edk2-decompressed))
> + $(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
> + recurse-install
> ifneq ($(TOOLS),)
> $(call install-prog,$(subst qemu-ga,qemu-ga$(EXESUF),$(TOOLS)),$(DESTDIR)$(bindir))
> endif
> @@ -870,9 +870,6 @@ endif
> $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
> done
> $(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
> - for d in $(TARGET_DIRS); do \
> - $(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
> - done
>
> .PHONY: ctags
> ctags:
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion
2019-05-28 8:23 ` [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion Markus Armbruster
@ 2019-07-03 11:24 ` Markus Armbruster
2019-07-03 11:49 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2019-07-03 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, pbonzini, richard.henderson, philmd
Peter pointed out that this makes an incremental build without -k fail
once. By "once", I mean it works fine when you retry. Squashing in the
appended patch to avoid this inconvenience.
diff --git a/Makefile b/Makefile
index e68982bd99..34bbcfc590 100644
--- a/Makefile
+++ b/Makefile
@@ -500,6 +500,12 @@ capstone/all: .git-submodule-status
slirp/all: .git-submodule-status
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
+# Compatibility gunk to keep make working across the rename of targets
+# for recursion, to be removed some time after 4.1.
+subdir-dtc: dtc/all
+subdir-capstone: capstone/all
+subdir-slirp: slirp/all
+
$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion
2019-07-03 11:24 ` Markus Armbruster
@ 2019-07-03 11:49 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-07-03 11:49 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: pbonzini, richard.henderson, Peter Maydell
On 7/3/19 1:24 PM, Markus Armbruster wrote:
> Peter pointed out that this makes an incremental build without -k fail
> once. By "once", I mean it works fine when you retry. Squashing in the
> appended patch to avoid this inconvenience.
>
>
> diff --git a/Makefile b/Makefile
> index e68982bd99..34bbcfc590 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -500,6 +500,12 @@ capstone/all: .git-submodule-status
> slirp/all: .git-submodule-status
> $(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
>
> +# Compatibility gunk to keep make working across the rename of targets
> +# for recursion, to be removed some time after 4.1.
> +subdir-dtc: dtc/all
> +subdir-capstone: capstone/all
> +subdir-slirp: slirp/all
> +
> $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
> $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
>
Both tags stand:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
(on top of previous patch)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-07-03 11:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 8:23 [Qemu-devel] [PATCH 0/4] Makefile: Generalize recursion machinery Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 1/4] Makefile: Remove code to smooth transition to config.status Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 2/4] Makefile: Drop bogus cleaning of $(ALL_SUBDIRS)/qemu-options.def Markus Armbruster
2019-05-28 8:23 ` [Qemu-devel] [PATCH 3/4] Makefile: Rename targets for make recursion Markus Armbruster
2019-07-03 11:24 ` Markus Armbruster
2019-07-03 11:49 ` Philippe Mathieu-Daudé
2019-05-28 8:23 ` [Qemu-devel] [PATCH 4/4] Makefile: Reuse all's recursion machinery for clean and install Markus Armbruster
2019-05-28 15:55 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.