From patchwork Thu Feb 28 14:56:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 159395 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp736519jad; Thu, 28 Feb 2019 06:56:57 -0800 (PST) X-Received: by 2002:a5d:690d:: with SMTP id t13mr6460760wru.135.1551365817016; Thu, 28 Feb 2019 06:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551365817; cv=none; d=google.com; s=arc-20160816; b=BTRJwhHnhOqXjvYgqco5opp1a3YHCRYsuMMjeP5rpmM5wruka1FRlycUyP/kPS1hZ/ Ru2qRDoJwT+M0Iw1vWOjUYpCm56crhX96ljrNeagONfn2TL71ZhoJV89Ntedp+AGtbia PMohLxiW2KiCGhjNvEb9c2o9/STLe+xiVqt+lEFK6142hCs0lzIeCQqF33P3aj8oE0nf nsen52nbqyJ4Xervg+6ID2z8GIq7MgYZSegn3sofpTImKh+mDOdX89LowXUoXGMMw7gQ FEjW22VW+IkjYuz89o6mz6CBg/eWFA/M+KevPGh+A0pN0R/eoCwdSWROUyN7KdVm/Mty 3gew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=CdQeJ6sH6vZzcVaDPWqQdGDjNFU4YeawHVoENir51c8=; b=dxNmuRpzFjUP/jC8BhyABxiAioKnVD+TZm23PyS8rHGsG6nKjzWXIeOMips2VHDeYV 2/4dGPIZ8nIQCAFrr1dFJCWN8ECLF+7t2aGMmrg1iBxQ42olNV9rKsEn16803a0Qka6R mD+0EfRRgiY6oyWUPwT87BScvF0YLg8ogaB5QztCNvooQdokXBCLOoTUBFHjZKE7yewC QksVWiM0MpAfmYly9+T5kmSmQLv/q2m2KM+L+tkNi12xghJdNStjzGXW07rjKjtPgg/k GA4/r/CGbM3tfxdRhF4TUqUQdPwla07qJDH0zVA1JAkCBD7FBiTQvTVra2qeGFHECESL D5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7hNXuXM; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c4sor3513026wml.7.2019.02.28.06.56.56 for (Google Transport Security); Thu, 28 Feb 2019 06:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7hNXuXM; spf=pass (google.com: domain of peter.maydell@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=peter.maydell@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CdQeJ6sH6vZzcVaDPWqQdGDjNFU4YeawHVoENir51c8=; b=V7hNXuXMMZFhdORp0WTV+lGKxc+XyQKPketVcZNQtQ9Q1XZwy10KqF8DbCVBQpIdVZ p8JCp7H/+0b8qW2IGu/P26RtL+f7gelsX3U4jkcNNPjqL9J2SyXZo3e+JnoIe2Ij11RP ELR12XG4bPWX0o6JY8N10rxc6kufDtgQ+RQRxZ0I6SJ4lsDCZMDdmpKJukH8DETbEfv7 SjZqGhxE5kMrkc0deFjd5glo9DtWNJGOlBnyRr3P52I1Gg2sLp+8FjjGqQU2m440PLqG BmxfzaouilsFC520x7+y9Lnt8LJCi3UA036NYAIA2uTNU0ae/nKA6mdNfWXq6KJcwCqF QG1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CdQeJ6sH6vZzcVaDPWqQdGDjNFU4YeawHVoENir51c8=; b=BlfoQx8/ZsFDKY8CB/A+RM1N+FPgHMwHG90mk6D1FwXzm7ArH5IHmDdt9Z+HhUkWsf PKPxKxkLR6YAe1VUouCt5BpaOBMcnW+wafeo19C0DCYludJ/tAKGjka8NBD0vNo1fPO4 HK+l44S7Tqp5Z4+zv6RJBh4NaQfxuKLvvXc7A1Z3DlMbE2XDTBoYcUNVO66mb0/oUV3k Pl2xsNMxP5gJMPd+X0P4PUMbgWzG4hAPqbFIZsr6+fOQYofVVHnKi3PYPQfWcRWLaq3p ONyeA/uer6CrU6L4f3vkgbm5GZh1p0yXbmn2hpdhoaa9t1CdxPTLhO85/OaOW0prStvG YbzQ== X-Gm-Message-State: AHQUAua97l2TMViR7SjtBtgqNj4gHgxmNBasBfSBkvlmv2Zy6fZL10Uv R2GYLCD2y1ZvdVjRWBUcijTNCzRy X-Google-Smtp-Source: AHgI3IZR12KnbTHCMoHVqMKN3orXDDQ6oYlvvgBztYBVmnx98U9BU3N9QUQXJQ9qI24eFAjB+2ZEzQ== X-Received: by 2002:a1c:7a1a:: with SMTP id v26mr39436wmc.129.1551365816705; Thu, 28 Feb 2019 06:56:56 -0800 (PST) Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c17sm14047539wrs.17.2019.02.28.06.56.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 06:56:56 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Stefan Hajnoczi , =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?b?w6k=?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/11] Makefile: Abstract out "identify the pkgversion" code Date: Thu, 28 Feb 2019 14:56:23 +0000 Message-Id: <20190228145624.24885-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228145624.24885-1-peter.maydell@linaro.org> References: <20190228145624.24885-1-peter.maydell@linaro.org> MIME-Version: 1.0 Abstract out the "identify the pkgversion" code from the rule for creating qemu-version.h, so it sets makefile variables for QEMU_PKGVERSION and QEMU_FULL_VERSION. (We will want to use these when building the Sphinx docs.) Signed-off-by: Peter Maydell Reviewed-by: Alex Bennée --- Makefile | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) -- 2.20.1 diff --git a/Makefile b/Makefile index d6b897be0bc..46cb8e62571 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,20 @@ endif include $(SRC_PATH)/rules.mak +# Create QEMU_PKGVERSION and FULL_VERSION strings +# If PKGVERSION is set, use that; otherwise get version and -dirty status from git +QEMU_PKGVERSION := $(if $(PKGVERSION),$(PKGVERSION),$(shell \ + cd $(SRC_PATH); \ + if test -d .git; then \ + git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ + if ! git diff-index --quiet HEAD &>/dev/null; then \ + echo "-dirty"; \ + fi; \ + fi)) + +# Either "version (pkgversion)", or just "version" if pkgversion not set +FULL_VERSION := $(if $(QEMU_PKGVERSION),$(VERSION) ($(QEMU_PKGVERSION)),$(VERSION)) + GENERATED_FILES = qemu-version.h config-host.h qemu-options.def GENERATED_QAPI_FILES = qapi/qapi-builtin-types.h qapi/qapi-builtin-types.c @@ -392,23 +406,8 @@ all: $(DOCS) $(if $(BUILD_DOCS),sphinxdocs) $(TOOLS) $(HELPERS-y) recurse-all mo qemu-version.h: FORCE $(call quiet-command, \ - (cd $(SRC_PATH); \ - if test -n "$(PKGVERSION)"; then \ - pkgvers="$(PKGVERSION)"; \ - else \ - if test -d .git; then \ - pkgvers=$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\ - if ! git diff-index --quiet HEAD &>/dev/null; then \ - pkgvers="$${pkgvers}-dirty"; \ - fi; \ - fi; \ - fi; \ - printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \ - if test -n "$${pkgvers}"; then \ - printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"\n'; \ - else \ - printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \ - fi; \ + (printf '#define QEMU_PKGVERSION "$(QEMU_PKGVERSION)"\n'; \ + printf '#define QEMU_FULL_VERSION "$(FULL_VERSION)"\n'; \ ) > $@.tmp) $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ mv $@.tmp $@; \