From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7wTE-0000oM-4l for qemu-devel@nongnu.org; Tue, 31 May 2016 23:05:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7wTC-00016v-0I for qemu-devel@nongnu.org; Tue, 31 May 2016 23:05:23 -0400 References: <967bcc3b-e1d5-38db-eb7d-2d07e92c2e19@redhat.com> <20160601013139.29790-1-famz@redhat.com> <20160601013139.29790-3-famz@redhat.com> From: Eric Blake Message-ID: <574E50E9.3030007@redhat.com> Date: Tue, 31 May 2016 21:05:13 -0600 MIME-Version: 1.0 In-Reply-To: <20160601013139.29790-3-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p0KPMV7BIIo4anh6vco5kCN1I8CqxppaU" Subject: Re: [Qemu-devel] [PATCH 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , lersek@redhat.com Cc: Paolo Bonzini , qemu-devel@nongnu.org, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --p0KPMV7BIIo4anh6vco5kCN1I8CqxppaU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/31/2016 07:31 PM, Fam Zheng wrote: > Currently, if not specified in "./configure", QEMU_PKGVERSION will be > empty. Write a rule in Makefile to generate a value from "git describe"= > combined with a possible git tree cleanness suffix, and write into a ne= w > header. >=20 > $ cat qemu-version.h > #define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9-unclean" >=20 > Include the header in .c files where the macro is referenced. It's not > necessary to include it in all files, otherwise each time the content o= f > the file changes, all sources have to be recompiled. >=20 > Signed-off-by: Fam Zheng > --- > +qemu-version.h: FORCE > + $(call quiet-command, \ > + (cd $(SRC_PATH); \ Can CDPATH interfere with this one? > + echo -n '#define QEMU_PKGVERSION '; \ 'echo -n' is non-portable, use printf instead. > + if test -n "$(PKGVERSION)"; then \ > + echo '"$(PKGVERSION)"'; \ > + else \ > + echo -n '"-'; \ And again > + if ! git status &>/dev/null; then \ > + echo -n "no-git"; \ and again > + else \ > + git describe 2>/dev/null | tr -d '\n'; \ > + if ! git diff-index --quiet HEAD &>/dev/null; then \ > + echo -n '-unclean'; \ and again Why -unclean instead of -dirty? > + fi \ > + fi; \ > + echo '"'; \ > + fi) > $@.tmp) > + $(call quiet-command, cmp --quiet $@ $@.tmp || mv $@.tmp $@) > + --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --p0KPMV7BIIo4anh6vco5kCN1I8CqxppaU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXTlDpAAoJEKeha0olJ0NqR+EH/2Pi+bnP7+kxBvY4b9WYF42P JRtaW1aSBtUD5m4zSpUP63LeU2K0HnQwF9/1xB2BbHpPLYuM/iqsjim5Utypw01M 7cKswzlBovZfoxrYKMhmiT84wNb1Re28b4xhqpChz4ypVnB6BnJscHCzALlUqbhF k2IkFQpuKG6v44qAMGI53qQWogAP1FAjNNR8n0WyyyNt516hov+MlXqzIJHjqas5 D4dg70BNGFa7l4fiOFfL6xtEUTWOvY35OKkN6bE8k3k/fsvogKfpeHpkChWk22DO WiwV6EFoIn8XTOiBUGef4xznijsmGg0bN2ofepujmZ4Fw5gHH+iEKJfrw3ixBRM= =3INO -----END PGP SIGNATURE----- --p0KPMV7BIIo4anh6vco5kCN1I8CqxppaU--