@@ -49,24 +49,31 @@ endif
endif
export NINJA=./ninjatool
-Makefile.ninja: build.ninja ninjatool
- ./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
--include Makefile.ninja
-${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
-
-ninjatool: ninjatool.stamp
-ninjatool.stamp: $(SRC_PATH)/scripts/ninjatool.py config-host.mak
- $(MESON) setup --reconfigure . $(SRC_PATH) && touch $@
+# Running meson regenerates both build.ninja and ninjatool, and that is
+# enough to prime the rest of the build.
+ninjatool: build.ninja
+# Only needed in case Makefile.ninja does not exist.
.PHONY: ninja-clean ninja-distclean clean-ctlist
clean-ctlist:
ninja-clean::
ninja-distclean::
+build.ninja: config-host.mak
+
+Makefile.ninja: build.ninja ninjatool
+ ./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
+-include Makefile.ninja
+${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
+
+# If MESON is empty, the rule will be re-evaluated after Makefiles are
+# reread (and MESON won't be empty anymore).
+ifneq ($(MESON),)
Makefile.mtest: build.ninja scripts/mtest2make.py
$(MESON) introspect --tests | $(PYTHON) scripts/mtest2make.py > $@
-include Makefile.mtest
+endif
.git-submodule-status: git-submodule-update config-host.mak
@@ -87,11 +94,13 @@ CONFIG_ALL=y
-include config-all-devices.mak
-include config-all-disas.mak
-build.ninja: meson-private/coredata.dat
-meson-private/coredata.dat: config-host.mak
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
@echo $@ is out-of-date, running configure
- @./config.status --skip-meson
+ @if test -f meson-private/coredata.dat; then \
+ ./config.status --skip-meson; \
+ else \
+ ./config.status; \
+ fi
# Force configure to re-run if the API symbols are updated
ifeq ($(CONFIG_PLUGIN),y)
@@ -8179,17 +8179,10 @@ if test -n "$cross_prefix"; then
else
cross_arg="--native-file config-meson.cross"
fi
-
-if test -f config-meson.cross && ! cmp $cross config-meson.cross >/dev/null 2>&1; then
- rm -rf meson-private meson-info meson-logs
-fi
mv $cross config-meson.cross
-if test -d meson-private && ! test -f meson-private/coredata.dat; then
- rm -rf meson-private meson-info meson-logs
-fi
+rm -rf meson-private meson-info meson-logs
NINJA=$PWD/ninjatool $meson setup \
- $(if test -d meson-private/; then echo --reconfigure; fi) \
--prefix "${pre_prefix}$prefix" \
--libdir "${pre_prefix}$libdir" \
--libexecdir "${pre_prefix}$libexecdir" \