aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 13 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 56894e4..75eb058 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,8 @@
# make test the whole suite (tests/test.sh)
# make check the minimal suite, for iterating (tests/test.sh -q)
# make test JOBS=4 the same, four sections at a time
+# make parity compile the test programs with zc0 and with the self-hosted
+# compiler and compare what they print (src/tools/parity.sh)
# make genome build/core/genome.bin from src/, with the fixpoint check
# make build/bin/zyi the interpreter alone (zy has a jit on arm64 and on x86-64 linux)
# make lsp build/bin/zclsp, the language server
@@ -49,8 +51,10 @@ MAP := $(B)/core/map
COREINC := -Isrc/core -I$(MAP) --embed-dir=$(B)/core
CORE_H := src/core/genome.h src/core/fops.h src/core/bops.h src/core/stack.h $(MAP)/memmap.h
# the sources the compiler genome is built from, and the files it embeds
-ZC_SRC := src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc
-ZC_DEPS := $(ZC_SRC) src/lib/std.zc src/lib/icon.zc src/tools/build.zc
+# the compiler is the files named in src/compiler/parts, in that order
+ZC_PARTS := $(addprefix src/compiler/,$(shell cat src/compiler/parts))
+ZC_SRC := src/runtime/rt.zc src/core/core.zc $(ZC_PARTS)
+ZC_DEPS := $(ZC_SRC) src/compiler/parts src/lib/std.zc src/lib/icon.zc src/tools/build.zc
TOOLS := $(BIN)/zc0$(EXE) $(BIN)/mkgenome$(EXE) $(BIN)/genmap$(EXE)
PROGS := $(BIN)/zy$(EXE) $(BIN)/zym$(EXE) $(BIN)/zclsp$(EXE)
@@ -63,7 +67,7 @@ $(BIN):
# genmap needs no map of its own; everything else is built against the one it writes
$(BIN)/genmap$(EXE): src/tools/genmap.c | $(BIN)
$(CC) $(CFLAGS) src/tools/genmap.c -o $@
-$(MAP)/memmap.h: $(BIN)/genmap$(EXE) src/runtime/rt.zc src/compiler/compiler.zc
+$(MAP)/memmap.h: $(BIN)/genmap$(EXE) src/runtime/rt.zc src/compiler/parts $(ZC_PARTS)
mkdir -p $(B)/core
$(BIN)/genmap$(EXE) --preset default --check -o $(MAP) >$(B)/core/genmap.log 2>&1 || { cat $(B)/core/genmap.log; exit 1; }
$(BIN)/zc0$(EXE): src/tools/zc0.c src/core/fops.h src/core/bops.h $(MAP)/memmap.h | $(BIN)
@@ -147,6 +151,11 @@ run:
$(CC) $(CFLAGS) $(MICRO_THREADS) src/micro/micro.c $(PORT) -Isrc/core -Isrc/micro -I$(B)/run --embed-dir=$(B)/run -o $(B)/run/zymr$(EXE)
@echo "built $(B)/run/zymr$(EXE)"
+# the two compilers on the same programs: whatever zc0 accepts must print the same
+# under both. work files go to build/parity/.
+parity: $(BIN)/zc0$(EXE) $(BIN)/mkgenome$(EXE) $(BIN)/zy$(EXE)
+ bash src/tools/parity.sh
+
# JOBS sets how many sections run at once: make test JOBS=4
test:
bash tests/test.sh -j $(or $(JOBS),1)
@@ -158,4 +167,4 @@ check:
clean:
rm -rf $(B)
-.PHONY: all lsp genome js lspimage vsix web run test check clean
+.PHONY: all lsp genome js lspimage vsix web run parity test check clean