72 lines
1.5 KiB
Makefile
72 lines
1.5 KiB
Makefile
.SUFFIXES:
|
|
.PHONY: all clean
|
|
|
|
PYVERSION=3.10
|
|
PYPREFIX=/usr
|
|
CYTHON=cython3
|
|
CC=gcc
|
|
|
|
TESTLIST=$(shell ls *.lang0 | sed 's/.lang0//')
|
|
|
|
all: all-it0.results all-it1.results all-it2.results
|
|
|
|
all-it0.results: $(addsuffix .it0, $(TESTLIST))
|
|
-rm -f $@
|
|
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it0 >> $@ ; echo "" >> $@)
|
|
! grep -v 'Success' $@
|
|
|
|
all-it1.results: $(addsuffix .it1, $(TESTLIST))
|
|
-rm -f $@
|
|
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it1 >> $@ ; echo "" >> $@)
|
|
! grep -v 'Success' $@
|
|
|
|
all-it2.results: $(addsuffix .it2, $(TESTLIST))
|
|
-rm -f $@
|
|
$(foreach test,$(TESTLIST), echo -n "$(test) " >> $@; ./$(test).it2 >> $@ ; echo "" >> $@)
|
|
! grep -v 'Success' $@
|
|
|
|
clean:
|
|
-rm -f *.result *.it0* *.it1* *.it2*
|
|
|
|
###
|
|
# it0
|
|
|
|
%.it0.py: %.lang0 ../0-lang0py/lang0py.exe
|
|
cat $< | ../0-lang0py/lang0py.exe > $@
|
|
|
|
%.it0.c: %.it0.py
|
|
$(CYTHON) -3 --embed -o $@ $^
|
|
|
|
%.it0.o: %.it0.c
|
|
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
|
|
|
|
%.it0: %.it0.o
|
|
$(CC) -o $@ $^ -lpython$(PYVERSION)
|
|
|
|
###
|
|
# it1
|
|
|
|
%.it1.py: %.lang0 ../1-lang0py/lang0py.exe
|
|
cat $< | ../1-lang0py/lang0py.exe > $@
|
|
|
|
%.it1.c: %.it1.py
|
|
$(CYTHON) -3 --embed -o $@ $^
|
|
|
|
%.it1.o: %.it1.c
|
|
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
|
|
|
|
%.it1: %.it1.o
|
|
$(CC) -o $@ $^ -lpython$(PYVERSION)
|
|
|
|
###
|
|
# it2
|
|
|
|
%.it2.c: %.lang0 ../2-lang0c/lang0c.exe
|
|
cat $< | ../2-lang0c/lang0c.exe > $@
|
|
|
|
%.it2.o: %.it2.c
|
|
$(CC) -c $^ -I$(PYPREFIX)/include/python$(PYVERSION)
|
|
|
|
%.it2: %.it2.o
|
|
$(CC) -o $@ $^ -lpython$(PYVERSION)
|