lang0/tests/Makefile
Johan B.W. de Vries 7672da6ad3 Extends the test framework to prepare for compilation tests
Fix: it2 would have different working for emit eof
2025-05-04 12:40:40 +02:00

81 lines
1.8 KiB
Makefile

.SUFFIXES:
.PHONY: all clean
.DELETE_ON_ERROR:
PYVERSION=3.12
PYPREFIX=/usr
CYTHON=cython3
CC=gcc
all: verify-results
Makefile.mk: generate-recipes.py $(wildcard test_stdlib_constants/*.exp.*) $(wildcard test_stdlib_functions/*.exp.*)
python3 generate-recipes.py Makefile.mk it0 it1 it2
include Makefile.mk
clean:
find build -name '*.c' -delete
find build -name '*.it0' -delete
find build -name '*.it1' -delete
find build -name '*.it2' -delete
find build -name '*.py' -delete
find build -name '*.tmp' -delete
find . -name '*.act.*.result' -delete
find . -name '*.act.*.stdout' -delete
find . -name '*.act.*.stderr' -delete
###
# it0
../0-lang0py/lang0py.exe: ../0-lang0py/lang0py.py
$(MAKE) -C ../0-lang0py
build/%.it0.py: %.lang0 ../0-lang0py/lang0py.exe
cat $< | ../0-lang0py/lang0py.exe > $@.tmp
mv $@.tmp $@
build/%.it0.c: build/%.it0.py
$(CYTHON) -3 --embed -o $@ $^
build/%.it0.o: build/%.it0.c
$(CC) -o $@ -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
build/%.it0: build/%.it0.o
$(CC) -o $@ $^ -lpython$(PYVERSION)
###
# it1
../1-lang0py/lang0py.exe: ../0-lang0py/lang0py.exe ../1-lang0py/lang0py.lang0
$(MAKE) -C ../1-lang0py
build/%.it1.py: %.lang0 ../1-lang0py/lang0py.exe
cat $< | ../1-lang0py/lang0py.exe > $@.tmp
mv $@.tmp $@
build/%.it1.c: build/%.it1.py
$(CYTHON) -3 --embed -o $@ $^
build/%.it1.o: build/%.it1.c
$(CC) -o $@ -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
build/%.it1: build/%.it1.o
$(CC) -o $@ $^ -lpython$(PYVERSION)
###
# it2
../2-lang0c/lang0c.exe: ../0-lang0py/lang0py.exe ../1-lang0py/lang0py.exe ../2-lang0c/lang0c.lang0
$(MAKE) -C ../2-lang0c
build/%.it2.c: %.lang0 ../2-lang0c/lang0c.exe
cat $< | ../2-lang0c/lang0c.exe > $@.tmp
mv $@.tmp $@
build/%.it2.o: build/%.it2.c
$(CC) -o $@ -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
build/%.it2: build/%.it2.o
$(CC) -o $@ $^ -lpython$(PYVERSION)