On 17 September 2013 23:36, David <[email protected]> wrote: > > found_files := $(wildcard *.mkv) $(wildcard *.mp4) $(wildcard *.avi) > ifdef found_files > some_command $(found_files) > endif
After sending I realised this could work for filenames with whitespace, provided it is part of a make rule: found_files := $(wildcard *.mkv) $(wildcard *.mp4) $(wildcard *.avi) ifdef found_files <tab>some_command *.mkv *.mp4 *.avi endif It uses $(wildcard) to detect if any matching files exist, and then uses the shell to expand the wildcards in the command line. You might also want nullglob eg found_files := $(wildcard *.mkv) $(wildcard *.mp4) $(wildcard *.avi) ifdef found_files <tab>shopt -s nullglob ; some_command *.mkv *.mp4 *.avi endif but nullglob is not in Bourne shell so that might require telling make to use SHELL := bash The above will fail if the filename is entirely whitespace :) The easiest way is to avoid whitespace in filenames :) _______________________________________________ luv-main mailing list [email protected] http://lists.luv.asn.au/listinfo/luv-main
