SOURCES = \ main.esh \ common.esh \ tokens.esh \ backend/main.esh \ backend/codegen.esh \ frontend/main.esh \ frontend/parser.esh \ frontend/lexer.esh OBJECTS1 = $(SOURCES:.esh=.sh1) OBJECTS2 = $(SOURCES:.esh=.sh2) OBJECTS3 = $(SOURCES:.esh=.sh3) bootstrap: stage3 stage1: @printf 'Stage 1:\n' @time -p $(MAKE) eshtrans.stage1 2>&1 | sed 's/^/\t/' stage2: stage1 @printf 'Stage 2:\n' @time -p $(MAKE) eshtrans.stage2 2>&1 | sed 's/^/\t/' stage3: stage2 @printf 'Stage 3:\n' @time -p $(MAKE) eshtrans.stage3 2>&1 | sed 's/^/\t/' clean: clean-stage1 clean-stage2 clean-stage3 clean-stage1: rm -f eshtrans.stage1 $(OBJECTS1) clean-stage2: rm -f eshtrans.stage2 $(OBJECTS2) clean-stage3: rm -f eshtrans.stage3 $(OBJECTS3) .SUFFIXES: .SUFFIXES: .esh .sh .sh1 .sh2 .sh3 eshtrans.stage1: $(OBJECTS1) Makefile cat $(OBJECTS1) >$@ printf 'main "$${@}"\n' >>$@ chmod a+x $@ eshtrans.stage2: eshtrans.stage1 $(OBJECTS2) ../libeshprof/hooks.esh Makefile ../eshld/eshld -o $@ $(OBJECTS2) ../libeshprof/hooks.esh eshtrans.stage3: eshtrans.stage2 $(OBJECTS3) ../libeshprof/hooks.esh Makefile ../eshld/eshld -o $@ $(OBJECTS3) ../libeshprof/hooks.esh $(OBJECTS1) $(OBJECTS2) $(OBJECTS3): Makefile .esh.sh1: cp $< $@ .esh.sh2: ./eshtrans.stage1 -o $@ $< .esh.sh3: ./eshtrans.stage2 -o $@ $<