lang0/Makefile
2025-01-26 14:55:10 +01:00

91 lines
2.0 KiB
Makefile

.SUFFIXES:
GCC_FLAGS := -g -O0 -Wall
all: it2-out
# it0-out.py => Hand made
it1-out0.py: it0-out.py it1-in.lang0
cat it1-in.lang0 | python3 it0-out.py > it1-out0.py
it1-out1.py: it1-out0.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out0.py > it1-out1.py
# We can diff here since the target hasn't changed
# The target for it0 is the same as for it1
diff it1-out0.py it1-out1.py
it1-out2.py: it1-out1.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out1.py > it1-out2.py
diff it1-out1.py it1-out2.py
it1-out3.py: it1-out2.py it1-in.lang0
cat it1-in.lang0 | python3 it1-out2.py > it1-out3.py
diff it1-out2.py it1-out3.py
it1-out.py: it1-out3.py
cp it1-out3.py it1-out.py
it2-out0.py: it1-out.py it2-in.lang0
cat it2-in.lang0 | python3 it1-out.py > it2-out0.py
# No gcc step since the target is still python here
it2-out1.c: it2-out0.py it2-in.lang0
cat it2-in.lang0 | python3 it2-out0.py > it2-out1.c
# diff it2-out0.py it2-out1.py Do not diff - the target changed so the output will be different
it2-out1: it2-out1.c
gcc it2-out1.c -o it2-out1 $(GCC_FLAGS)
it2-out2.c: it2-out1 it2-in.lang0
cat it2-in.lang0 | ./it2-out1 > it2-out2.c
diff it2-out1.c it2-out2.c
it2-out2: it2-out2.c
gcc it2-out2.c -o it2-out2 $(GCC_FLAGS)
it2-out3.c: it2-out2 it2-in.lang0
cat it2-in.lang0 | ./it2-out2 > it2-out3.c
diff it2-out2.c it2-out3.c
it2-out3: it2-out3.c
gcc it2-out3.c -o it2-out3 $(GCC_FLAGS)
it2-out: it2-out3
cp it2-out3 it2-out
it3-out0.c: it2-out it3-in.lang0
cat it3-in.lang0 | ./it2-out > it3-out0.c
# gcc step instead of asm step since the target is still bcc here
it3-out0: it3-out0.c
gcc it3-out0.c -o it3-out0 $(GCC_FLAGS)
it3-out1.asm: it3-out0 it3-in.lang0
cat it3-in.lang0 | ./it3-out0 > it3-out1.asm
# diff it3-out0.py it3-out1.py Do not diff - the target changed so the output will be different
it3-out1.o: it3-out1.asm
nasm -f elf64 -g -F dwarf -o it3-out1.o it3-out1.asm
it3-out1: it3-out1.o
ld -o it3-out1 it3-out1.o
clean:
-rm it1-out* it2-out*
-rm it1-out* it2-out* it3-out*