summaryrefslogtreecommitdiffstats
path: root/eshtrans/Makefile
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-24 13:10:54 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-24 13:10:54 (EST)
commit13c882147f6d35927b6f57d41f0cc8f765bb2747 (patch)
tree6776390beefad717ee923f2f48f6b713e83ad6de /eshtrans/Makefile
parente9549f56d03e0113b85e45f8d1e5257e3a28f0a9 (diff)
downloadeggshell-13c882147f6d35927b6f57d41f0cc8f765bb2747.zip
eggshell-13c882147f6d35927b6f57d41f0cc8f765bb2747.tar.gz
eggshell-13c882147f6d35927b6f57d41f0cc8f765bb2747.tar.bz2
eshtrans/Makefile: Handle bootstrapping
Diffstat (limited to 'eshtrans/Makefile')
-rw-r--r--eshtrans/Makefile54
1 files changed, 43 insertions, 11 deletions
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 $@ $<