From nobody Mon Feb 9 20:35:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576157144; cv=none; d=zohomail.com; s=zohoarc; b=TglF1oDBK2vI2NBIW56mDJWb+x0WDT+MNrYrFIlCKeha8d9xmeopTEr2o9wHme/LBRL9rlVaKe/rmuAlthGzKoyVAsoYG0CiOK2Ssf6LjcKVNs7ZU1Bzn3l/lec/N0s6ApsicHagA/nYwYbYk0IFRfXhL05T00yQEw1Lwjvu6rI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576157144; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pa3Lkx+CsIop0JEWRcLrRpLqD2Xhtkc5mBSulFY1kvo=; b=H6hyFSvIf60+9F7stOmIdgkIHJW43Vf99nB4O2GpL8b9J6p8Y0PxMvjENeOtpr5TT2hGLop21+s2Et1pkzJyYDlUB2spWasCSUN5GSNbxVrBoyfNFNn0o0WrdJ5cuz26sE21ueYIgIDd9ly3DFkefR559XAhYcsaufasD54OCoM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576157144025995.0091979847997; Thu, 12 Dec 2019 05:25:44 -0800 (PST) Received: from localhost ([::1]:59262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifOTO-0001Hd-6u for importer@patchew.org; Thu, 12 Dec 2019 08:25:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifNyN-0003Y9-TF for qemu-devel@nongnu.org; Thu, 12 Dec 2019 07:53:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifNyL-0006kU-AL for qemu-devel@nongnu.org; Thu, 12 Dec 2019 07:53:39 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifNyK-0006ih-WC for qemu-devel@nongnu.org; Thu, 12 Dec 2019 07:53:37 -0500 Received: by mail-wr1-x42f.google.com with SMTP id q6so2582936wro.9 for ; Thu, 12 Dec 2019 04:53:36 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n189sm5193825wme.33.2019.12.12.04.53.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2019 04:53:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pa3Lkx+CsIop0JEWRcLrRpLqD2Xhtkc5mBSulFY1kvo=; b=oYZ3/z+igD9irISKu4jBE0fxAVORV7BhmjL6j4YGV05oipVT5DAyKsVQMXWUAfIldW 0/k1ra99tkUkMrmvt3f+kDrOn1QOlhwgN6l5Ku3F4OvmbkzVgBuJXNyHRyRURHepJb0/ loe9xQu5rAxC/cWa7E5X5+cEdHBIeKbEjpmAkD+OeQqhfmzPYcN32ipw6ohT07ezcKzw btVahJgFg3LqZSfJgGb0hrFCap5KWiiECrJWuGmj0G77zst5f5KtmIkuKunDRPbFPZ3A dvLf1tHhKt3acDqAADdD3aOMJ8oMIupkPz+ItPhs8baTiIzSbY+uT2qi6f1SMYZnh9VK +RhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pa3Lkx+CsIop0JEWRcLrRpLqD2Xhtkc5mBSulFY1kvo=; b=HFY2iqR340MxXWK/oLG0IHCYmt+vIH5debhi/6IuFakCOdE91cLsSqG8/i+3JivdYh rpRhZruayAxoFNmVDNADe4UvHKP8zisffJRtZbeMp8tTfidp2RkLEbGzUk6K+mUfRD3z bP/zXI8NpAs2jyZXPsraM50FSAUZ6oAccavGAREqRQ/nZyeso2DmXsVXybLM6Sq4lkqc JeRgEjDwwYDxHlatyFc73cwoCLW/Ju3r/8+oP1xTZ/YqGIJgycZOpT2oyTd5f9FQOzJH K8YP+XOsDGzEhEAeqWr0Bjxd9Tz5lqwkX3RQi4OIGh+yE/+xUKh0dxnT9qFVNeMtbCnO s4SA== X-Gm-Message-State: APjAAAUSeG2QkO/6ZFLd9e742b3ITuBzAnIG3wYEOREEFrPoWTj6fHYo cge45oaEDwVf5jNsAkZd7opodECo X-Google-Smtp-Source: APXvYqyKCsvOP8exqX+8gFU44lQ3cBFs7d8yFYi2CqOibkftrtis5nRR9vq8CUJoMSEwjJz/srT/0g== X-Received: by 2002:adf:fe0e:: with SMTP id n14mr6189962wrr.116.1576155215326; Thu, 12 Dec 2019 04:53:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 038/132] meson: infrastructure for building emulators Date: Thu, 12 Dec 2019 13:51:22 +0100 Message-Id: <1576155176-2464-39-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576155176-2464-1-git-send-email-pbonzini@redhat.com> References: <1576155176-2464-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini Signed-off-by: Marc-Andr=C3=A9 Lureau --- Makefile | 72 +++----------------- Makefile.target | 19 +++--- configure | 6 -- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 2 +- include/qemu/osdep.h | 2 +- meson.build | 182 ++++++++++++++++++++++++++++++++++++++++++++++= +++- rules.mak | 8 --- scripts/create_config | 2 + scripts/grepy.sh | 3 + scripts/minikconf.py | 1 + 11 files changed, 207 insertions(+), 92 deletions(-) create mode 100755 scripts/grepy.sh mode change 100644 =3D> 100755 scripts/minikconf.py diff --git a/Makefile b/Makefile index 77ac1ea..bae96ec 100644 --- a/Makefile +++ b/Makefile @@ -134,63 +134,6 @@ DOCS=3D endif =20 SUBDIR_MAKEFLAGS=3D$(if $(V),,--no-print-directory --quiet) BUILD_DIR=3D$(= BUILD_DIR) -SUBDIR_DEVICES_MAK=3D$(patsubst %, %/config-devices.mak, $(filter %-softmm= u, $(TARGET_DIRS))) -SUBDIR_DEVICES_MAK_DEP=3D$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK)) - -ifeq ($(SUBDIR_DEVICES_MAK),) -config-all-devices.mak: config-host.mak - $(call quiet-command,echo '# no devices' > $@,"GEN","$@") -else -config-all-devices.mak: $(SUBDIR_DEVICES_MAK) config-host.mak - $(call quiet-command, sed -n \ - 's|^\([^=3D]*\)=3D\(.*\)$$|\1:=3D$$(findstring y,$$(\1)\2)|p'= \ - $(SUBDIR_DEVICES_MAK) | sort -u > $@, \ - "GEN","$@") -endif - --include $(SUBDIR_DEVICES_MAK_DEP) - -# This has to be kept in sync with Kconfig.host. -MINIKCONF_ARGS =3D \ - $(CONFIG_MINIKCONF_MODE) \ - $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \ - CONFIG_KVM=3D$(CONFIG_KVM) \ - CONFIG_SPICE=3D$(CONFIG_SPICE) \ - CONFIG_IVSHMEM=3D$(CONFIG_IVSHMEM) \ - CONFIG_TPM=3D$(CONFIG_TPM) \ - CONFIG_XEN=3D$(CONFIG_XEN) \ - CONFIG_OPENGL=3D$(CONFIG_OPENGL) \ - CONFIG_X11=3D$(CONFIG_X11) \ - CONFIG_VHOST_USER=3D$(CONFIG_VHOST_USER) \ - CONFIG_VIRTFS=3D$(CONFIG_VIRTFS) \ - CONFIG_LINUX=3D$(CONFIG_LINUX) \ - CONFIG_PVRDMA=3D$(CONFIG_PVRDMA) - -MINIKCONF_INPUTS =3D $(SRC_PATH)/Kconfig.host $(SRC_PATH)/hw/Kconfig -MINIKCONF =3D $(PYTHON) $(SRC_PATH)/scripts/minikconf.py \ - -$(SUBDIR_DEVICES_MAK): %/config-devices.mak: default-configs/%.mak $(MINIK= CONF_INPUTS) $(BUILD_DIR)/config-host.mak - $(call quiet-command, $(MINIKCONF) $(MINIKCONF_ARGS) > $@.tmp, "GEN", "$@= .tmp") - $(call quiet-command, if test -f $@; then \ - if cmp -s $@.old $@; then \ - mv $@.tmp $@; \ - cp -p $@ $@.old; \ - else \ - if test -f $@.old; then \ - echo "WARNING: $@ (user modified) out of date.";\ - else \ - echo "WARNING: $@ out of date.";\ - fi; \ - echo "Run \"$(MAKE) defconfig\" to regenerate."; \ - rm $@.tmp; \ - fi; \ - else \ - mv $@.tmp $@; \ - cp -p $@ $@.old; \ - fi,"GEN","$@"); - -defconfig: - rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK) =20 ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/Makefile.objs @@ -207,10 +150,9 @@ include $(SRC_PATH)/tests/Makefile.include =20 all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-= all modules =20 -config-host.h: config-host.h-timestamp -config-host.h-timestamp: config-host.mak - TARGET_DIRS_RULES :=3D $(foreach t, all clean install, $(addsuffix /$(t), = $(TARGET_DIRS))) +SUBDIR_RULES=3D$(patsubst %,subdir-%, $(TARGET_DIRS)) +SOFTMMU_SUBDIR_RULES=3D$(filter %-softmmu,$(SUBDIR_RULES)) =20 SOFTMMU_ALL_RULES=3D$(filter %-softmmu/all, $(TARGET_DIRS_RULES)) $(SOFTMMU_ALL_RULES): $(authz-obj-y) @@ -221,10 +163,15 @@ $(SOFTMMU_ALL_RULES): $(io-obj-y) $(SOFTMMU_ALL_RULES): $(qom-obj-y) $(SOFTMMU_ALL_RULES): config-all-devices.mak =20 +# meson: this is sub-optimal but going away after conversion +TARGET_DEPS =3D $(patsubst %,%-config-target.h, $(TARGET_DIRS)) +TARGET_DEPS +=3D $(patsubst %,%-config-devices.h, $(filter %-softmmu,$(TAR= GET_DIRS))) +TARGET_DEPS +=3D $(patsubst %,libqemu-%.fa, $(TARGET_DIRS)) + .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): +$(TARGET_DIRS_RULES): $(TARGET_DEPS) $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V=3D"$(V)" = TARGET_DIR=3D"$(dir $@)" $(notdir $@),) =20 DTC_MAKE_ARGS=3D-I$(SRC_PATH)/dtc VPATH=3D$(SRC_PATH)/dtc -C dtc V=3D"$(V)= " LIBFDT_srcdir=3D$(SRC_PATH)/dtc/libfdt @@ -356,8 +303,7 @@ endef distclean: clean rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.= texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi rm -f tests/tcg/config-*.mak - rm -f config-all-devices.mak config-all-disas.mak config.status - rm -f $(SUBDIR_DEVICES_MAK) + rm -f config-all-disas.mak config.status rm -f po/*.mo tests/qemu-iotests/common.env rm -f roms/seabios/config.mak roms/vgabios/config.mak rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.cps diff --git a/Makefile.target b/Makefile.target index f912ba0..74e8295 100644 --- a/Makefile.target +++ b/Makefile.target @@ -6,8 +6,10 @@ include ../config-host.mak include config-target.mak include $(SRC_PATH)/rules.mak =20 +FULL_TARGET_NAME=3D$(TARGET_NAME)-$(if $(CONFIG_SOFTMMU),softmmu,linux-use= r) + ifdef CONFIG_SOFTMMU -include config-devices.mak +include ../$(FULL_TARGET_NAME)-config-devices.mak endif =20 $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) @@ -18,6 +20,9 @@ QEMU_CFLAGS +=3D -iquote .. -iquote $(SRC_PATH)/target/$(= TARGET_BASE_ARCH) -DNEED_ =20 QEMU_CFLAGS+=3D-iquote $(SRC_PATH)/include =20 +QEMU_CFLAGS +=3D -DCONFIG_TARGET=3D\"../$(FULL_TARGET_NAME)-config-target.= h\" +QEMU_CFLAGS +=3D -DCONFIG_DEVICES=3D\"../$(FULL_TARGET_NAME)-config-device= s.h\" + ifdef CONFIG_USER_ONLY # user emulator name QEMU_PROG=3Dqemu-$(TARGET_NAME) @@ -36,15 +41,10 @@ QEMU_PROG_BUILD =3D $(QEMU_PROG) endif endif =20 +LIBQEMU =3D ../libqemu-$(FULL_TARGET_NAME).fa PROGS=3D$(QEMU_PROG) $(QEMU_PROGW) STPFILES=3D =20 -config-target.h: config-target.h-timestamp -config-target.h-timestamp: config-target.mak - -config-devices.h: config-devices.h-timestamp -config-devices.h-timestamp: config-devices.mak - ifdef CONFIG_TRACE_SYSTEMTAP stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace= .stp $(QEMU_PROG)-log.stp =20 @@ -103,6 +103,7 @@ all: $(PROGS) stap # Dummy command so that make thinks it has done something @true =20 +obj-y +=3D $(LIBQEMU) obj-y +=3D trace/ =20 ######################################################### @@ -168,7 +169,6 @@ obj-y +=3D hw/$(TARGET_BASE_ARCH)/ endif =20 generated-files-y +=3D hmp-commands.h hmp-commands-info.h -generated-files-y +=3D config-devices.h =20 endif # CONFIG_SOFTMMU =20 @@ -195,7 +195,7 @@ all-obj-$(CONFIG_SOFTMMU) +=3D $(crypto-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(io-obj-y) =20 ifdef CONFIG_SOFTMMU -$(QEMU_PROG_BUILD): config-devices.mak +$(QEMU_PROG_BUILD): ../$(FULL_TARGET_NAME)-config-devices.mak endif =20 COMMON_LDADDS =3D ../libqemuutil.a @@ -231,5 +231,4 @@ ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../system= tap/tapset/$(QEMU_PROG)-log.stp" endif =20 -generated-files-y +=3D config-target.h Makefile: $(generated-files-y) diff --git a/configure b/configure index ca91a76..d65b79e 100755 --- a/configure +++ b/configure @@ -7582,18 +7582,12 @@ fi =20 if supported_xen_target $target; then echo "CONFIG_XEN=3Dy" >> $config_target_mak - echo "$target/config-devices.mak: CONFIG_XEN=3Dy" >> $config_host_mak if test "$xen_pci_passthrough" =3D yes; then echo "CONFIG_XEN_PCI_PASSTHROUGH=3Dy" >> "$config_target_mak" fi -else - echo "$target/config-devices.mak: CONFIG_XEN=3Dn" >> $config_host_mak fi if supported_kvm_target $target; then echo "CONFIG_KVM=3Dy" >> $config_target_mak - echo "$target/config-devices.mak: CONFIG_KVM=3Dy" >> $config_host_mak -else - echo "$target/config-devices.mak: CONFIG_KVM=3Dn" >> $config_host_mak fi if supported_hax_target $target; then echo "CONFIG_HAX=3Dy" >> $config_target_mak diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c14ed86..87aef3c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -86,7 +86,7 @@ #include "hw/mem/memory-device.h" #include "sysemu/replay.h" #include "qapi/qmp/qerror.h" -#include "config-devices.h" +#include CONFIG_DEVICES =20 /* debug PC/ISA interrupts */ //#define DEBUG_IRQ diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2362675..46cfb16 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "config-devices.h" +#include CONFIG_DEVICES =20 #include "qemu/units.h" #include "hw/loader.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index af2b91f..280fd40 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -29,7 +29,7 @@ =20 #include "config-host.h" #ifdef NEED_CPU_H -#include "config-target.h" +#include CONFIG_TARGET #else #include "exec/poison.h" #endif diff --git a/meson.build b/meson.build index bdc2f3e..5949e6d 100644 --- a/meson.build +++ b/meson.build @@ -4,6 +4,7 @@ cc =3D meson.get_compiler('c') kconfig =3D import('unstable-kconfig') ss =3D import('sourceset') config_host =3D kconfig.load(meson.current_build_dir() / 'config-host.mak') +config_all_disas =3D kconfig.load(meson.current_build_dir() / 'config-all-= disas.mak') =20 add_project_arguments(config_host['CFLAGS'].split(), language: ['c', 'objc']) @@ -105,16 +106,96 @@ if 'CONFIG_LIBUDEV' in config_host libudev =3D declare_dependency(link_args: config_host['LIBUDEV_LIBS'].sp= lit()) endif =20 +create_config =3D find_program('scripts/create_config') +minikconf =3D find_program('scripts/minikconf.py') target_dirs =3D config_host['TARGET_DIRS'].split() have_user =3D false have_system =3D false +target_devices_kconfs =3D [] +target_devices_h =3D {} +target_config =3D {} +kconfig_external_symbols =3D [ + 'CONFIG_KVM', + 'CONFIG_XEN', + 'CONFIG_TPM', + 'CONFIG_SPICE', + 'CONFIG_IVSHMEM', + 'CONFIG_OPENGL', + 'CONFIG_X11', + 'CONFIG_VHOST_USER', + 'CONFIG_VHOST_KERNEL', + 'CONFIG_VIRTFS', + 'CONFIG_LINUX', + 'CONFIG_PVRDMA', +] foreach target : target_dirs have_user =3D have_user or target.endswith('-user') - have_system =3D have_system or target.endswith('-softmmu') + config_target =3D kconfig.load(meson.current_build_dir() / target / 'con= fig-target.mak') + config_host + + if target.endswith('-softmmu') + have_system =3D true + + base_kconfig =3D [] + foreach sym : kconfig_external_symbols + if sym in config_target + base_kconfig +=3D '@0@=3Dy'.format(sym) + endif + endforeach + + config_devices_mak =3D target + '-config-devices.mak' + config_devices_mak =3D configure_file( + input: ['default-configs' / target + '.mak', 'Kconfig.host', 'hw/Kco= nfig'], + output: config_devices_mak, + depfile: config_devices_mak + '.d', + capture: true, + command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'], + config_devices_mak, '@DEPFILE@', '@INPUT@', + base_kconfig]) + config_devices_h =3D custom_target( + target + '-config-devices.h', + input: config_devices_mak, + output: target + '-config-devices.h', + capture: true, + command: [create_config, '@INPUT@']) + target_devices_kconfs +=3D config_devices_mak + target_devices_h +=3D {target: config_devices_h} + config_target +=3D kconfig.load(config_devices_mak) + endif + target_config +=3D {target: config_target} endforeach have_tools =3D 'CONFIG_TOOLS' in config_host have_block =3D have_system or have_tools =20 +grepy =3D find_program('scripts/grepy.sh') +# This configuration is used to build files that are shared by +# multiple binaries, and then extracted out of the "common" +# static_library target. +# +# We do not use all_sources()/all_dependencies(), because it would +# build literally all source files, including devices only used by +# targets that are not built for this compilation. The CONFIG_ALL +# pseudo symbol replaces it. + +config_all =3D {} +if have_system + config_all_devices_inputs =3D [] + config_all_devices =3D configure_file( + output: 'config-all-devices.mak', + input: target_devices_kconfs, + capture: true, + command: [grepy, '@INPUT@'], + ) + config_all +=3D kconfig.load(config_all_devices) +endif +config_all +=3D config_host +config_all +=3D config_all_disas +config_all +=3D { + 'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'), + 'CONFIG_SOFTMMU': have_system, + 'CONFIG_USER_ONLY': have_user, + 'CONFIG_ALL': true, +} + # Generators =20 hxtool =3D find_program('scripts/hxtool') @@ -128,6 +209,12 @@ qapi_gen_depends =3D [ meson.source_root() / 'scripts/= qapi/events.py', meson.source_root() / 'scripts/qapi/doc.py', meson.source_root() / 'scripts/qapi-gen.py' ] =20 +config_host_h =3D custom_target('config-host.h', + input: meson.current_build_dir() / 'config-h= ost.mak', + output: 'config-host.h', + capture: true, + command: [create_config, '@INPUT@']) + hxdep =3D [] hx_headers =3D [ ['qemu-options.hx', 'qemu-options.def'], @@ -167,6 +254,16 @@ endforeach util_ss =3D ss.source_set() stub_ss =3D ss.source_set() trace_ss =3D ss.source_set() +common_ss =3D ss.source_set() +softmmu_ss =3D ss.source_set() +user_ss =3D ss.source_set() +bsd_user_ss =3D ss.source_set() +linux_user_ss =3D ss.source_set() +specific_ss =3D ss.source_set() + +hw_arch =3D {} +target_arch =3D {} +target_softmmu_arch =3D {} =20 # TODO: add each directory to the subdirs from its own meson.build, once # we have those @@ -254,7 +351,7 @@ trace_events_subdirs +=3D [ 'util', ] =20 -genh =3D [] +genh =3D [config_host_h] subdir('qapi') subdir('qobject') subdir('stubs') @@ -280,6 +377,87 @@ qemuutil =3D declare_dependency(link_with: libqemuutil, subdir('io') subdir('fsdev') =20 +common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_ss) +common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) + +common_all =3D common_ss.apply(config_all, strict: false) +common_all =3D static_library('common', + sources: common_all.sources(), + dependencies: common_all.dependencies(), + name_suffix: 'fa') + +foreach target : target_dirs + config_target =3D target_config[target] + target_name =3D config_target['TARGET_NAME'] + arch =3D config_target['TARGET_BASE_ARCH'] + arch_srcs =3D [] + arch_deps =3D [] + + target_inc =3D [include_directories('target' / config_target['TARGET_BAS= E_ARCH'])] + if host_machine.system() =3D=3D 'linux' + target_inc +=3D include_directories('linux-headers') + endif + if target.endswith('-softmmu') + qemu_target_name =3D 'qemu-system-' + target_name + target_type=3D'system' + t =3D target_softmmu_arch[arch].apply(config_target, strict: false) + arch_srcs +=3D t.sources() + arch_deps +=3D t.dependencies() + + if target_name =3D=3D 'sparc64' + hw =3D hw_arch['sparc64'].apply(config_target, strict: false) + else + hw =3D hw_arch[arch].apply(config_target, strict: false) + endif + arch_srcs +=3D hw.sources() + arch_srcs +=3D target_devices_h[target] + arch_deps +=3D hw.dependencies() + else + target_type=3D'user' + qemu_target_name =3D 'qemu-' + target_name + if 'CONFIG_LINUX_USER' in config_target + base_dir =3D 'linux-user' + else + base_dir =3D 'bsd-user' + endif + target_inc +=3D include_directories( + base_dir, + base_dir / config_target['TARGET_ABI_DIR'], + ) + if 'CONFIG_LINUX_USER' in config_target + dir =3D base_dir / config_target['TARGET_ABI_DIR'] + target_inc +=3D include_directories(base_dir / 'host' / config_targe= t['ARCH']) + arch_srcs +=3D files(dir / 'signal.c', dir / 'cpu_loop.c') + endif + endif + + t =3D target_arch[arch].apply(config_target, strict: false) + arch_srcs +=3D t.sources() + arch_deps +=3D t.dependencies() + + target_common =3D common_ss.apply(config_target, strict: false) + objects =3D common_all.extract_objects(target_common.sources()) + deps =3D target_common.dependencies() + + # TODO: Change to generator once obj-y goes away + config_target_h =3D custom_target(target + '-config-target.h', + input: meson.current_build_dir() / target / = 'config-target.mak', + output: target + '-config-target.h', + capture: true, + command: [create_config, '@INPUT@']) + + target_specific =3D specific_ss.apply(config_target, strict: false) + static_library('qemu-' + target, + sources: target_specific.sources() + arch_srcs + [config_= target_h], + dependencies: target_specific.dependencies() + arch_deps = + deps, + objects: objects, + include_directories: target_inc, + c_args: ['-DNEED_CPU_H', + '-DCONFIG_TARGET=3D"@0@-config-target.h"'.format= (target), + '-DCONFIG_DEVICES=3D"@0@-config-devices.h"'.form= at(target)], + name_suffix: 'fa') +endforeach + # Other build targets if 'CONFIG_GUEST_AGENT' in config_host subdir('qga') diff --git a/rules.mak b/rules.mak index a10a972..9dd3b7e 100644 --- a/rules.mak +++ b/rules.mak @@ -203,14 +203,6 @@ notempty =3D $(if $1,y,n) # Generate files with tracetool TRACETOOL=3D$(PYTHON) $(SRC_PATH)/scripts/tracetool.py =20 -# Generate timestamp files for .h include files - -config-%.h: config-%.h-timestamp - @cmp $< $@ >/dev/null 2>&1 || cp $< $@ - -config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config - $(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@,"GEN= ","$(TARGET_DIR)config-$*.h") - .PHONY: clean-timestamp clean-timestamp: rm -f *.timestamp diff --git a/scripts/create_config b/scripts/create_config index 6d8f08b..bc82661 100755 --- a/scripts/create_config +++ b/scripts/create_config @@ -1,5 +1,7 @@ #!/bin/sh =20 +test $# -gt 0 && exec < $1 + echo "/* Automatically generated by create_config - do not modify */" =20 while read line; do diff --git a/scripts/grepy.sh b/scripts/grepy.sh new file mode 100755 index 0000000..33c74c6 --- /dev/null +++ b/scripts/grepy.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +grep --no-filename '=3Dy$' "$@" | sort -u diff --git a/scripts/minikconf.py b/scripts/minikconf.py old mode 100644 new mode 100755 index febd9a4..e4cbd57 --- a/scripts/minikconf.py +++ b/scripts/minikconf.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Mini-Kconfig parser # --=20 1.8.3.1