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
signature.asc
Description: OpenPGP digital signature