views:

107

answers:

1

I have a makefile that depending on some properties sets vpath and generates a list of source files into one variable. I need to run the makefile without compiling anything (the compilation is actually handled by a different makefile) and just see to which real files the filenames get matched depending on the vpath settings.

+2  A: 

Option 1: Let make do its path search:

.PHONY: whichfiles
whichfiles: $(LIST_OF_SOURCE_FILES)
    @echo $+

Option 2: Simulate the path search using $(wildcard):

.PHONY: whichfiles
whichfiles:
    @echo $(foreach f,$(LIST_OF_SOURCE_FILES),$(firstword $(wildcard $(VPATH:%=%/$f)) not-found:$f))

Either way, "make whichfiles" will print the list of matched files.

If some of the files can't be found, option 1 will fail with "no rule to make" reporting the first file that could not be found. Option 2 will print "not-found:" for each missing file.

moleeye