I have a Makefile:
Makefile
foo: touch foo touch bar %/: mkdir -p $@ dir/%: % | dir/ rm -f $@ ln $< $@ foobar: d