SUBDIRS := $(patsubst %/, %, $(filter %/, $(shell ls -F))) SUBDIRMARKS := $(patsubst %, _dir_%, $(SUBDIRS)) all : $(patsubst %.php, %.phps, $(wildcard *.php)) \ $(patsubst %.inc, %.inc.phps, $(wildcard *.inc)) \ $(SUBDIRMARKS) # Create symbolic links to all *.php and *.inc files %.phps : %.php ln -s $< $@ %.inc.phps : %.inc ln -s $< $@ # Make subdirectories recursively .PHONY : $(SUBDIRMARKS) .PHONY : makesubdirs $(SUBDIRMARKS) : makesubdirs -$(MAKE) -C $(patsubst _dir_%, %, $@)