If anything in the.app/* changes, then rebuild the app: APPS=$(wildcard *.app) APPS_DEPS=$(patsubst %,%.dep,$(APPS)) %.dep: %/ echo "vpath $*.scm $*" > $@ find $* -type f -print0 | sed -e 's/ /\\ /g' | xargs -0 echo "$*.import.so: " >> $@ find $* -type f -print0 | sed -e 's/ /\\ /g' | xargs -0 echo "$*.so: " >> $@