Skip to content

Commit 3ddbe43

Browse files
committed
Add a compilers target for compiling the compilers.
1 parent 0fd7b13 commit 3ddbe43

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ bootstrap:
8383
diff -w .compiler.orig.tmp .compiler.out.tmp
8484
rm .compiler.out.tmp .compiler.orig.tmp
8585

86+
compiler%.secd: PARENT=compiler$$(($* - 1)).secd
87+
compiler%.secd: compiler%.lisp $(PARENT) $(BIN)
88+
./$(BIN) $(PARENT) $< | fmt -w 80 > $@
89+
./$(BIN) $@ $< | fmt -w 80 > $@.bootstrap
90+
diff -y -d $@ $@.bootstrap
91+
92+
compilers: $(addsuffix .secd, $(basename $(wildcard compiler*.lisp)))
93+
8694
archive:
8795
git archive --prefix=lispkit-$(SOURCE_ID)/ HEAD | gzip > lispkit-$(SOURCE_ID).tar.gz
8896

bootstrap-check.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ function bootstrap {
3232
local Ps=$2
3333
local Po=${Ps/.lisp/.secd}
3434
local CPo=${Po}.bootstrap
35-
m $Co $Ps $Po
36-
m $Po $Ps $CPo
37-
d $Po $CPo
35+
m $Co $Ps $Po # compile compiler with earlier compiler
36+
m $Po $Ps $CPo # compile compiler with itself
37+
d $Po $CPo # compare the results of above two
3838
echo "Bootstrap OK"
3939
}
4040

4141
cat $COMPILER | tr '\n' ' ' | fmt -w 80 > compiler0.secd
4242
cat $SOURCE | tr '\n' ' ' | fmt -w 80 > compiler1.lisp
4343

44-
bootstrap compiler0.secd compiler1.lisp
45-
bootstrap compiler1.secd compiler2.lisp
46-
bootstrap compiler2.secd compiler3.lisp
44+
for n in $(seq 0 2); do
45+
bootstrap compiler$n.secd compiler$((n + 1)).lisp
46+
done

0 commit comments

Comments
 (0)