rearrange Makefiles to each dir && check for dependencies automatically