fix makefile, using static pattern rules and automatic variables