qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH] build-sys: generate .gitignore
Date: Thu, 22 Sep 2016 16:06:51 -0500	[thread overview]
Message-ID: <c92f048a-92aa-92c2-b9e0-bd29efa443af@redhat.com> (raw)
In-Reply-To: <CAJ+F1CJZuqbETy50TEUUMyaTjLU9H1DP5OB=k8O0RGEuzn3FHw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2016-09-22 21:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 20:19 [Qemu-devel] [PATCH] build-sys: generate .gitignore Marc-André Lureau
2016-09-22 20:20 ` Marc-André Lureau
2016-09-22 20:37 ` Eric Blake
2016-09-22 20:47   ` Marc-André Lureau
2016-09-22 21:06     ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c92f048a-92aa-92c2-b9e0-bd29efa443af@redhat.com \
    --to=eblake@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).