qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] Makefile: Derive "PKGVERSION"


From: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default
Date: Tue, 31 May 2016 21:05:13 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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 new
> header.
> 
>     $ cat qemu-version.h
>     #define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9-unclean"
> 
> 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 of
> the file changes, all sources have to be recompiled.
> 
> Signed-off-by: Fam Zheng <address@hidden>
> ---

> +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) > address@hidden)
> +     $(call quiet-command, cmp --quiet $@ address@hidden || mv 
> address@hidden $@)
> +


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]