qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] build-sys: generate .gitignore


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] build-sys: generate .gitignore
Date: Thu, 22 Sep 2016 16:06:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

On 09/22/2016 03:47 PM, Marc-André Lureau wrote:

>> 
>>  # Consolidated targets
>> +tests-cleanfiles = *.o
>> +tests-cleanfiles = .gitignore
>> +tests-cleanfiles += qht-bench$(EXESUF)

Missed this on the first round: you meant to use += on the .gitignore
line.  Without it, you aren't excluding ANY .o files.

>>> +ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if
>> $(MAKECMDGOALS),,fail))
>>> +$(SRC_PATH)/tests/.gitignore:
>>> +     echo "$(tests-cleanfiles)" | xargs -n1 | sort > $@
>>
>> This line is TOO noisy; you'll want to wrap it into a $(call
>> quiet-command...).
>>
> 
> Yep
> 
> 
>>
>> You could also do it with fewer processes and less typing, as:
>>
>> printf %s\\n $(tests-cleanfiles) | sort > $@
>>
> 
> Is there a way for printf to split the variable?
> 
> echo "*.o foo" | xargs -n1
> *.o
> foo
> 
> vs
> 
> pritnf %s\\n "*.o foo"
> *.o foo
> 
> If I remove the quote in the Makefile, then it will expand to all the
> non/exisiting .o files.

I thought you WANTED shell globbing; but now I see that you don't (you
want a literal glob output into the .gitignore).  I guess I got thrown
by the fact that I didn't see *.o in the generated .gitignore (never
mind that I didn't see ANY .o...), from the bug pointed out above.

Okay, so you DO want to convert make's spaces into newlines, while
avoiding globbing.  My initial thought was that 'xargs -n1' feels a bit
heavy-handed; tr ' ' '\n' would do the same thing but then you aren't
shaving off any processes or any typing.  You can temporarily disable
file globbing by playing with 'set -f', but that also feels awkward.  So
maybe your approach is best after all.

-- 
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]