restructure Makefile to avoid concurrent makefile generation