Rewrite Makefile to generate dependencies on-fly