I've created a Makefile that looks like this:
_module1_DIR=/share/tmp/module1
_module2_DIR=/share/tmp/module2
_module3_DIR=/share/tmp/module3
REQUIRES:=module1 module2 module3
all:
@echo $(foreach z,$(strip $(REQUIRES)), \
$(if $(_$(z)_DIR), $(wildcard $(_$(z)_DIR)/inc),))
And created directories /share/tmp/module{1,2,3} and /share/tmp/module1/inc.
When I run this makefile, /share/tmp/module1/inc is output with both 1.5.19
DLLs and with a snapshot DLL. (/share/tmp is, of course, a remote drive)
So, I've gone the extra mile and tried to come up with a "simple test case"
(patent pending) but apparently I didn't duplicate your scenario adequately
and, so, we need more details about your environment.