fix end of stream exception when generating makefile