aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-06-10 12:05:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:05 -0400
commita56650518f5ba84ed15b9415fa1041311eeeece0 (patch)
treee0bb21d39cfeee9e6f4e03a48ef784a5fc27e400 /Makefile
parentdedad0272052f3d848d6d178b681526b2f313029 (diff)
configure: integrate Meson in the build system
The Meson build system is integrated in the existing configure/make steps by invoking Meson from the configure script and converting Meson's build.ninja rules to an included Makefile. build.ninja already provides tags/ctags/cscope rules, so they are removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile50
1 files changed, 32 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index ec12101a84..b726e7d8d2 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,25 @@ git-submodule-update:
endif
endif
+export NINJA=./ninjatool
+
+# 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
+
.git-submodule-status: git-submodule-update config-host.mak
# Check that we're not trying to do an out-of-tree build from
@@ -70,7 +89,11 @@ CONFIG_ALL=y
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
@echo $@ is out-of-date, running configure
- @./config.status
+ @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)
@@ -762,7 +785,8 @@ clean-coverage:
"CLEAN", "coverage files")
endif
-clean: recurse-clean
+clean: recurse-clean ninja-clean clean-ctlist
+ -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t 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
@@ -799,7 +823,8 @@ rm -rf $(MANUAL_BUILDDIR)/$1/_static
rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
endef
-distclean: clean
+distclean: clean ninja-distclean
+ -test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
rm -f config-host.mak config-host.h* $(DOCS)
rm -f tests/tcg/config-*.mak
rm -f config-all-devices.mak config-all-disas.mak config.status
@@ -807,6 +832,8 @@ distclean: clean
rm -f po/*.mo tests/qemu-iotests/common.env
rm -f roms/seabios/config.mak roms/vgabios/config.mak
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
+ rm -rf meson-private meson-logs meson-info compile_commands.json
+ rm -f Makefile.ninja ninjatool ninjatool.stamp
rm -f config.log
rm -f linux-headers/asm
rm -f docs/version.texi
@@ -933,6 +960,8 @@ ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
install-includedir:
$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
+# Needed by "meson install"
+export DESTDIR
install: all $(if $(BUILD_DOCS),install-doc) \
install-datadir install-localstatedir install-includedir \
$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
@@ -1006,21 +1035,6 @@ endif
done
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
-.PHONY: ctags
-ctags:
- rm -f tags
- find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
-
-.PHONY: TAGS
-TAGS:
- rm -f TAGS
- find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
-
-cscope:
- rm -f "$(SRC_PATH)"/cscope.*
- find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
- cscope -b -i"$(SRC_PATH)/cscope.files"
-
# opengl shader programs
ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
@mkdir -p $(dir $@)