qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/11] qapi: add qapi-errors.py


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 09/11] qapi: add qapi-errors.py
Date: Thu, 26 Jul 2012 06:38:40 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 07/26/2012 05:55 AM, Paolo Bonzini wrote:
> Il 26/07/2012 13:50, Markus Armbruster ha scritto:
>>>> +qapi-errors.h qapi-errors.c :\
>>>> +$(SRC_PATH)/qapi-schema-errors.json $(SRC_PATH)/scripts/qapi-errors.py
>>>> +  $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-errors.py -o 
>>>> "." < $<, "  GEN   $@")
>> I'm afraid this isn't quite what you want.  It's shorthand for two
>> separate rules with the same recipe[*].  Therefore, it's prone to run
>> the recipe twice, with make blissfully unaware that each of the two runs
>> clobbers the other file, too.  Could conceivably lead to trouble with
>> parallel execution.
>>
>> Paolo, Eric, maybe you can provide advice on how to best tell make that
>> a recipe generates multiple files.
> 
> Hmm, I would just do
> 
> qapi-errors.h: qapi-errors.c
> qapi-errors.c: $(SRC_PATH)/qapi-schema-errors.json 
> $(SRC_PATH)/scripts/qapi-errors.py
>       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-errors.py -o 
> "." < $<, "  GEN   $@")
> 
> I think that's what I usually saw for bison (which creates both .h and .c).

Indeed, per
https://www.gnu.org/software/automake/manual/automake.html#Multiple-Outputs,
that is an appropriate solution for a 2-file generation.  It is only
when you have more than two files where...

> 
> A perhaps cleaner alternative is to add a stamp file, and make both files
> depend on it.

a stamp file makes more sense.

-- 
Eric Blake   address@hidden    +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]