lang0/tests/Makefile
Johan B.W. de Vries 6055cddab2 Extends the test framework to prepare for compilation tests
Feat: add now can add two full strings

Fix: it2 would have different working for emit eof

Fix: eq and lt would return bools on it0 and it1

Fix: Functions always return something (there is no such
thing as an empty type).

Fix: Return value from main is now always ignored.

Fix: Output from check is same on all iterations
2025-05-04 14:33:10 +02:00

87 lines
2.0 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_*/test_*)
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 '*.it0.result' -delete
find build -name '*.it0.stderr' -delete
find build -name '*.it0.stdout' -delete
find build -name '*.it1' -delete
find build -name '*.it1.result' -delete
find build -name '*.it1.stderr' -delete
find build -name '*.it1.stdout' -delete
find build -name '*.it2' -delete
find build -name '*.it2.result' -delete
find build -name '*.it2.stderr' -delete
find build -name '*.it2.stdout' -delete
find build -name '*.py' -delete
find build -name '*.tmp' -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)