From 13c882147f6d35927b6f57d41f0cc8f765bb2747 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 24 Feb 2016 13:10:54 -0500 Subject: eshtrans/Makefile: Handle bootstrapping --- (limited to 'eshtrans/Makefile') diff --git a/eshtrans/Makefile b/eshtrans/Makefile index 5a093b6..79a7d1d 100644 --- a/eshtrans/Makefile +++ b/eshtrans/Makefile @@ -7,20 +7,52 @@ SOURCES = \ frontend/main.esh \ frontend/parser.esh \ frontend/lexer.esh -OBJECTS = $(SOURCES:.esh=.sh) +OBJECTS1 = $(SOURCES:.esh=.sh1) +OBJECTS2 = $(SOURCES:.esh=.sh2) +OBJECTS3 = $(SOURCES:.esh=.sh3) -all: eshtrans +bootstrap: stage3 +stage1: + @printf 'Stage 1:\n' + @time -p $(MAKE) eshtrans.stage1 +stage2: + @printf 'Stage 1:\n' + @time -p $(MAKE) eshtrans.stage1 + @printf 'Stage 2:\n' + @time -p $(MAKE) eshtrans.stage2 +stage3: + @printf 'Stage 1:\n' + @time -p $(MAKE) eshtrans.stage1 + @printf 'Stage 2:\n' + @time -p $(MAKE) eshtrans.stage2 + @printf 'Stage 3:\n' + @time -p $(MAKE) eshtrans.stage3 -.SUFFIXES: -.SUFFIXES: .esh .sh +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) -clean: - rm -f eshtrans $(OBJECTS) +.SUFFIXES: +.SUFFIXES: .esh .sh .sh1 .sh2 .sh3 -eshtrans: $(OBJECTS) Makefile - ../eshld/eshld -o $@ $(OBJECTS) +eshtrans.stage1: $(OBJECTS1) Makefile + cat $(OBJECTS1) >$@ + printf 'main "$${@}"\n' >>$@ + chmod a+x $@ +eshtrans.stage2: eshtrans.stage1 $(OBJECTS2) Makefile + ../eshld/eshld -o $@ $(OBJECTS2) +eshtrans.stage3: eshtrans.stage2 $(OBJECTS3) Makefile + ../eshld/eshld -o $@ $(OBJECTS3) -$(OBJECTS): Makefile +$(OBJECTS1) $(OBJECTS2) $(OBJECTS3): Makefile -.esh.sh: - ./eshtrans $< +.esh.sh1: + cp $< $@ +.esh.sh2: + ./eshtrans.stage1 -o $@ $< +.esh.sh3: + ./eshtrans.stage2 -o $@ $< -- cgit v0.9.1