lang0/1-lang0py/Makefile
Johan B.W. de Vries 7568a15093 Makefile improvements
Using a tmp file prevents a failed build from being reported
as succeeded.

Changes in the compiler should now rebuild the tests
automatically.
2025-02-09 14:59:09 +01:00

41 lines
810 B
Makefile

.SUFFIXES:
PYVERSION=3.10
PYPREFIX=/usr
INCLUDES=-I$(PYPREFIX)/include/python$(PYVERSION)
CYTHON=cython3
LANG0PY=$(CURDIR)/../0-lang0py/lang0py.exe
all: lang0py.exe
%.exe: %.o
gcc -o $@ $< -lpython$(PYVERSION)
%.o: %.c
gcc -c $< $(INCLUDES)
%.c: %.py
$(CYTHON) -3 --embed $<
lang0py0.py: lang0py.lang0 $(LANG0PY)
cat $< | $(LANG0PY) > $@.tmp
mv $@.tmp $@
lang0py1.py: lang0py.lang0 lang0py0.exe
cat $< | ./lang0py0.exe > $@.tmp
mv $@.tmp $@
# Cannot diff on the first iteration - platform change
lang0py2.py: lang0py.lang0 lang0py1.exe
cat $< | ./lang0py1.exe > $@.tmp
mv $@.tmp $@
-diff lang0py1.py lang0py2.py
lang0py.py: lang0py.lang0 lang0py2.exe
cat $< | ./lang0py2.exe > $@.tmp
mv $@.tmp $@
-diff lang0py2.py lang0py.py
clean:
rm -f lang0py*.py lang0py*.c lang0py*.o lang0py*.exe