qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 09/22] build: cleanups to Makefile
Date: Fri, 16 Oct 2020 07:48:01 -0400	[thread overview]
Message-ID: <20201016114814.1564523-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20201016114814.1564523-1-pbonzini@redhat.com>

Group similar rules, add comments to "else" and "endif" lines,
detect too-old config-host.mak before messing things up.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile | 45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index 91c62a26c8..53d624a0be 100644
--- a/Makefile
+++ b/Makefile
@@ -30,13 +30,21 @@ UNCHECKED_GOALS := %clean TAGS cscope ctags dist \
     help check-help print-% \
     docker docker-% vm-help vm-test vm-build-%
 
+all:
+.PHONY: all clean distclean recurse-all dist msi FORCE
+
+# Don't try to regenerate Makefile or configure
+# We don't generate any of them
+Makefile: ;
+configure: ;
+
 # All following code might depend on configuration variables
 ifneq ($(wildcard config-host.mak),)
-# Put the all: rule here so that config-host.mak can contain dependencies.
-all:
 include config-host.mak
 
 git-submodule-update:
+.git-submodule-status: git-submodule-update config-host.mak
+Makefile: .git-submodule-status
 
 .PHONY: git-submodule-update
 
@@ -84,9 +92,7 @@ Makefile.mtest: build.ninja scripts/mtest2make.py
 -include Makefile.mtest
 endif
 
-Makefile: .git-submodule-status
-.git-submodule-status: git-submodule-update config-host.mak
-
+# Ensure the build tree is okay.
 # Check that we're not trying to do an out-of-tree build from
 # a tree that's been used for an in-tree build.
 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
@@ -97,6 +103,20 @@ seems to have been used for an in-tree build. You can fix this by running \
 endif
 endif
 
+# force a rerun of configure if config-host.mak is too old or corrupted
+ifeq ($(MESON),)
+.PHONY: config-host.mak
+x := $(shell rm -rf meson-private meson-info meson-logs)
+endif
+ifeq ($(NINJA),)
+.PHONY: config-host.mak
+x := $(shell rm -rf meson-private meson-info meson-logs)
+endif
+ifeq ($(wildcard build.ninja),)
+.PHONY: config-host.mak
+x := $(shell rm -rf meson-private meson-info meson-logs)
+endif
+
 config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
 	@echo $@ is out-of-date, running configure
 	@if test -f meson-private/coredata.dat; then \
@@ -114,15 +134,15 @@ plugins:
 	$(call quiet-command,\
 		$(MAKE) $(SUBDIR_MAKEFLAGS) -C contrib/plugins V="$(V)", \
 		"BUILD", "example plugins")
-endif
+endif # $(CONFIG_PLUGIN)
 
-else
+else # config-host.mak does not exist
 config-host.mak:
 ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
 	@echo "Please call configure before running make!"
 	@exit 1
 endif
-endif
+endif # config-host.mak does not exist
 
 # Only needed in case Makefile.ninja does not exist.
 .PHONY: ninja-clean ninja-distclean clean-ctlist
@@ -131,20 +151,11 @@ ninja-clean::
 ninja-distclean::
 build.ninja: config-host.mak
 
-# Don't try to regenerate Makefile or configure
-# We don't generate any of them
-Makefile: ;
-configure: ;
-
-.PHONY: all clean distclean install \
-	recurse-all dist msi FORCE
-
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
 
 include $(SRC_PATH)/tests/Makefile.include
 
 all: recurse-all
-Makefile:
 
 ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
 ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
-- 
2.26.2




  parent reply	other threads:[~2020-10-16 11:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 11:47 [PULL 00/22] Build system + misc changes for 2020-10-16 Paolo Bonzini
2020-10-16 11:47 ` [PULL 01/22] submodules: bump meson to 0.55.3 Paolo Bonzini
2020-10-16 11:47 ` [PULL 02/22] Makefile: Ensure cscope.out/tags/TAGS are generated in the source tree Paolo Bonzini
2020-10-16 11:47 ` [PULL 03/22] tests/Makefile.include: unbreak non-tcg builds Paolo Bonzini
2020-10-16 11:47 ` [PULL 04/22] make: run shell with pipefail Paolo Bonzini
2020-10-16 11:47 ` [PULL 05/22] tests: add missing generated sources to testqapi Paolo Bonzini
2020-10-16 11:47 ` [PULL 06/22] configure: move QEMU_INCLUDES to meson Paolo Bonzini
2020-10-16 11:47 ` [PULL 07/22] dockerfiles: enable Centos 8 PowerTools Paolo Bonzini
2020-10-16 11:48 ` [PULL 08/22] add ninja to dockerfiles, CI configurations and test VMs Paolo Bonzini
2020-10-16 11:48 ` Paolo Bonzini [this message]
2020-10-16 11:48 ` [PULL 10/22] build: replace ninjatool with ninja Paolo Bonzini
2020-10-16 11:48 ` [PULL 11/22] build: add --enable/--disable-libudev Paolo Bonzini
2020-10-16 11:48 ` [PULL 12/22] meson.build: don't condition iconv detection on library detection Paolo Bonzini
2020-10-16 11:48 ` [PULL 13/22] meson: cleanup curses/iconv test Paolo Bonzini
2020-10-16 11:48 ` [PULL 14/22] configure: fix handling of --docdir parameter Paolo Bonzini
2020-10-16 11:48 ` [PULL 15/22] meson: Only install icons and qemu.desktop if have_system Paolo Bonzini
2020-10-16 11:48 ` [PULL 16/22] docs: Fix Sphinx configuration for msys2/mingw Paolo Bonzini
2020-10-16 11:48 ` [PULL 17/22] meson: move SPHINX_ARGS references within "if build_docs" Paolo Bonzini
2020-10-16 11:48 ` [PULL 18/22] meson: Move the detection logic for sphinx to meson Paolo Bonzini
2020-10-16 13:27   ` 罗勇刚(Yonggang Luo)
2020-10-19 19:40     ` Eric Blake
2020-10-16 11:48 ` [PULL 19/22] cirrus: Enable doc build on msys2/mingw Paolo Bonzini
2020-10-16 11:48 ` [PULL 20/22] fuzz: Disable QEMU's SIG{INT,HUP,TERM} handlers Paolo Bonzini
2020-10-16 11:48 ` [PULL 21/22] hax: unbreak accelerator cpu code after cpus.c split Paolo Bonzini
2020-10-16 11:48 ` [PULL 22/22] ci: include configure and meson logs in all jobs if configure fails Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201016114814.1564523-10-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).