generate proper makefile for subdirectories