From nobody Mon May 6 12:59:33 2024 Delivered-To: importer@patchew.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=1599496873; cv=none; d=zohomail.com; s=zohoarc; b=nTrfKRICDNSv62ISf33GS0J1cB+EChnupxY2d1Y/tQUwJ6n+4GRSaFez7vMZRe+21C77IJ4q0xaN3378dR6zCU4dphb2lSd8VcibslK034oJorBN+NOITsWb9s68nl1p9D3AKpekEjCmUQpRAlWKxPgph0vg8l1p6YmkpYHb9j0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599496873; h=Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=n3B1PcPbtXyRKDvhkufpceOeW+LHKvTC04HSYKxTByM=; b=W56SKU/LG1LfWxyK/G/MQwdobLhr/6gzmY4ALyw2dKwoDbYWkMSybcET8IXWr6gWuX9jf1u2YdtPfx6Ci7jf2pVkskBlmxUVUWxCRIqH482vCpN9FTn0UwBypwsc1+Wma32uH4ploggTiQcjyXROW4PHY9EbRjV15nJcZ6YffQ4= 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 1599496873880382.6495375905105; Mon, 7 Sep 2020 09:41:13 -0700 (PDT) Received: from localhost ([::1]:47640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFKCe-00032I-Il for importer@patchew.org; Mon, 07 Sep 2020 12:41:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFKBQ-0002Ua-Gn for qemu-devel@nongnu.org; Mon, 07 Sep 2020 12:39:56 -0400 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]:39690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFKBO-0008RL-Nx for qemu-devel@nongnu.org; Mon, 07 Sep 2020 12:39:56 -0400 Received: by mail-ej1-x641.google.com with SMTP id p9so18936276ejf.6 for ; Mon, 07 Sep 2020 09:39:54 -0700 (PDT) Received: from donizetti.lan ([2001:b07:6468:f312:6891:d6db:f6ec:d1df]) by smtp.gmail.com with ESMTPSA id y24sm15424308eds.35.2020.09.07.09.39.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 09:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=n3B1PcPbtXyRKDvhkufpceOeW+LHKvTC04HSYKxTByM=; b=dxMs8FGPTSULW2Y1Unz1o3tMQR2YEhgJjMLBxsLdHU3yJnO5OfxeAGVEVtjvzV+5GQ a/gOhWCk5qk/Do9pyeTqwHMhudGORnXY72zvb2M5Dr644s/oLG09me+/+yUIIYDaHri1 uqvmZq8QWneHVqej6uzH9D9eiZYQ7jFnxl0MjJxyg8xQtcFGMFATe6ZCQmUBVmPzHj0M ZKJdI4N+H+3L5QNSUNDtqKeFtUPI4eId2DSHhidKCaGJZIxUBMpchdFuCvhvp1723Pao piFEahBAtt3ZjYUVV8M4hVffl0aFOhoVB2aKGdBxflLmN5eW+Ykd8l6+WDWFXC+VxUhk pXkw== 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 :mime-version:content-transfer-encoding; bh=n3B1PcPbtXyRKDvhkufpceOeW+LHKvTC04HSYKxTByM=; b=VrzSc3v6TA1CvowTsJsDJhKxlLRG3tstga+dn3R0lVf/ZH+m9oGgS03nFdN4O9sTWw UhTDtAcUI4JCrgDkIR7MUjfiuzAa8dAYkzCWJ0utqRIfzN62FJxWZ3cRgr0lEOJZ9Aa0 xAXI3nDnpwhxwKbvCyxoL5OfWhShAebm2jaJQPCj+ChPeF9nuPRBOL+yj7gfn0aIsuMO 6zlOjnKtsJX/fD+VfynCowT8ebNapDuMloWyHtdyteVJ+7T3pegwwExRB7rLJHuV8ax0 wFvSJPCqqy32egLLhpH4qGsmN87nVPWrUuMU5jIgCwg0hMvHz9NNNLBAg2JQwBn+8k7b D/dA== X-Gm-Message-State: AOAM533ta5sBOnKTkZlyrnDRkPhUkPAm0P3L5BBiXSJOYq/R6cpPAeAW ye8BY3tgKwulMhNtzB9T4E8xcukTnFI= X-Google-Smtp-Source: ABdhPJybCaaQLlbZe2vlw+b0XuGpiMSWrwPBMHYZR6e0W6dD2mza9jGsXEyzaX8xhPDjtaw2pUXniA== X-Received: by 2002:a17:906:b47:: with SMTP id v7mr21121237ejg.310.1599496792485; Mon, 07 Sep 2020 09:39:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] docs: update build system documentation Date: Mon, 7 Sep 2020 18:39:53 +0200 Message-Id: <20200907163953.19097-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::641; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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) Content-Type: text/plain; charset="utf-8" Most of the Makefile bits are obsolete and can be removed. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/build-system.rst | 97 +++++-------------------------------- 1 file changed, 11 insertions(+), 86 deletions(-) diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst index 591e93f4b4..08e85c69e1 100644 --- a/docs/devel/build-system.rst +++ b/docs/devel/build-system.rst @@ -179,7 +179,7 @@ process for: =20 - Userspace emulators - qemu-$ARCH =20 - - Some (but not all) unit tests + - Unit tests =20 2) documentation =20 @@ -204,8 +204,9 @@ are then turned into static libraries as follows:: =20 chardev =3D declare_dependency(link_whole: libchardev) =20 -The special `.fa` suffix is needed as long as unit tests are built with -the older Makefile infrastructure, and will go away later. +As of Meson 0.55.1, the special `.fa` suffix should be used for everything +that is used with `link_whole`, to ensure that the link flags are placed +correctly in the command line. =20 Files linked into emulator targets there can be split into two distinct gr= oups of files, those which are independent of the QEMU emulation target and @@ -221,7 +222,8 @@ only in system emulators, `user_ss` only in user-mode e= mulators. =20 In the target-dependent set lives CPU emulation, device emulation and much glue code. This sometimes also has to be compiled multiple times, -once for each target being built. +once for each target being built. Target-dependent files are included +in the `specific_ss` sourceset. =20 All binaries link with a static library `libqemuutil.a`, which is then linked to all the binaries. `libqemuutil.a` is built from several @@ -300,84 +302,9 @@ The resulting build system is largely non-recursive in= nature, in contrast to common practices seen with automake. =20 Tests are also ran by the Makefile with the traditional `make check` -phony target. Meson test suites such as `unit` can be ran with `make -check-unit` too. It is also possible to run tests defined in meson.build -with `meson test`. - -The following text is only relevant for unit tests which still have to -be converted to Meson. - -All binaries should link to `libqemuutil.a`, e.g.: - - qemu-img$(EXESUF): qemu-img.o ..snip.. libqemuutil.a - -On Windows, all binaries have the suffix `.exe`, so all Makefile rules -which create binaries must include the $(EXESUF) variable on the binary -name. e.g. - - qemu-img$(EXESUF): qemu-img.o ..snip.. - -This expands to `.exe` on Windows, or an empty string on other platforms. - -Variable naming ---------------- - -The QEMU convention is to define variables to list different groups of -object files. These are named with the convention $PREFIX-obj-y. The -Meson `chardev` variable in the previous example corresponds to a -variable 'chardev-obj-y'. - -Likewise, tests that are executed by `make check-unit` are grouped into -a variable check-unit-y, like this: - - check-unit-y +=3D tests/test-visitor-serialization$(EXESUF) - check-unit-y +=3D tests/test-iov$(EXESUF) - check-unit-y +=3D tests/test-bitmap$(EXESUF) - -When a test or object file which needs to be conditionally built based -on some characteristic of the host system, the configure script will -define a variable for the conditional. For example, on Windows it will -define $(CONFIG_POSIX) with a value of 'n' and $(CONFIG_WIN32) with a -value of 'y'. It is now possible to use the config variables when -listing object files. For example, - - check-unit-$(CONFIG_POSIX) +=3D tests/test-vmstate$(EXESUF) - -On Windows this expands to - - check-unit-n +=3D tests/vmstate.exe - -Since the `check-unit` target only runs tests included in `$(check-unit-y)= `, -POSIX specific tests listed in `$(util-obj-n)` are ignored on the Windows -platform builds. - - -CFLAGS / LDFLAGS / LIBS handling --------------------------------- - -There are many different binaries being built with differing purposes, -and some of them might even be 3rd party libraries pulled in via git -submodules. As such the use of the global CFLAGS variable is generally -avoided in QEMU, since it would apply to too many build targets. - -Flags that are needed by any QEMU code (i.e. everything *except* GIT -submodule projects) are put in $(QEMU_CFLAGS) variable. For linker -flags the $(LIBS) variable is sometimes used, but a couple of more -targeted variables are preferred. - -In addition to these variables, it is possible to provide cflags and -libs against individual source code files, by defining variables of the -form $FILENAME-cflags and $FILENAME-libs. For example, the test -test-crypto-tlscredsx509 needs to link to the libtasn1 library, -so tests/Makefile.include defines some variables: - - tests/crypto-tls-x509-helpers.o-cflags :=3D $(TASN1_CFLAGS) - tests/crypto-tls-x509-helpers.o-libs :=3D $(TASN1_LIBS) - -The scope is a little different between the two variables. The libs get -used when linking any target binary that includes the curl.o object -file, while the cflags get used when compiling the curl.c file only. - +phony target, while benchmarks are run with `make bench`. Meson test +suites such as `unit` can be ran with `make check-unit` too. It is also +possible to run tests defined in meson.build with `meson test`. =20 Important files for the build system =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -402,10 +329,8 @@ number of dynamically created files listed later. other meson.build files spread throughout the QEMU source tree. =20 `tests/Makefile.include` - Rules for building the unit tests. This file is included directly by the - top level Makefile, so anything defined in this file will influence the - entire build system. Care needs to be taken when writing rules for tests - to ensure they only apply to the unit test execution / build. + Rules for external test harnesses. These include the TCG tests, + `qemu-iotests` and the Avocado-based acceptance tests. =20 `tests/docker/Makefile.include` Rules for Docker tests. Like tests/Makefile, this file is included --=20 2.26.2