Makefile: generate config.h in two stages