On 17 September 2013 22:28, Matthew Cengia <[email protected]> wrote:
> On 2013-09-17 20:42, Russell Coker wrote:
>> On Tue, 17 Sep 2013, Jason White <[email protected]> wrote:
>> > Matthew Cengia <[email protected]> wrote:
>> > >   mattcen@isis:tmp$ shopt -s nullglob
>> > >   mattcen@isis:tmp$ ls *.mkv *.mp4 *.avi
>> > >   a.mkv  b.mp4
>> >
>> > Excellent.
>>
>> Yes, Matthew's suggestion works really well for interactive use.  I couldn't
>> work out how to make it run from a Makefile though.
>
> GNU makefiles have a magical $(wildcard *.avi) function that I don't
> fully understand, but which may do what you want if you do some research
> into it.

Gnu makefile syntax might look like this if in the body of the makefile:

found_files := $(wildcard *.mkv) $(wildcard *.mp4) $(wildcard *.avi)
ifdef found_files
  some_command $(found_files)
endif

but this will break if the filenames contain whitespace, because make
intrinsically
treats whitespace as a separator and there's no way to avoid that
using $(wildcard),
or when using the make $(shell) function. So if the filenames might contain
whitespace, don't even consider using these make functions, filenames with
whitespace must be handled entirely in shell commands invoked by make, without
ever trying to store them in make variables.
_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to