#!/usr/bin/env python3

snd = "rsc/hot-sandwitches-loop.pcmf32le rsc/navigate.pcmf32le rsc/select.pcmf32le rsc/coin.pcmf32le rsc/graviton.pcmf32le rsc/restart.pcmf32le " + \
      "rsc/switch.pcmf32le rsc/cant_switch.pcmf32le rsc/jump.pcmf32le rsc/eject.pcmf32le rsc/hit_floor.pcmf32le rsc/hit_ceil.pcmf32le rsc/victory.pcmf32le"
rsc = snd + " " + " ".join([f"rsc/{i}.lvl rsc/{i}.mesharray rsc/{i}s.mesharray" for i in range(64)])
print(".POSIX:")
print(".SUFFIXES:")
print()
print("all: tabout", rsc);
print()
print("tabout: main.c lvl.h lvl.c shr.h shr.c draw.c tick.c coll.c controls.c")
print("\tgcc -o tabout -Wall -Wextra -Wpedantic -Wno-unused-result -std=c11 -g -O3 main.c lvl.c shr.c draw.c tick.c coll.c controls.c -ldg")
print()
for s in snd.split():
    print(s + ": util/pcmf32le.sh util/" + s[:-9] + ".wav")
    print("\tutil/pcmf32le.sh util/" + s[:-9] + ".wav " + s)
    print()
for i in range(64):
    print(f"rsc/{i}.lvl: util/rsc/{i}.cfg util/rsc/{i}.ppm util/shr.py util/lvl.py")
    print(f"\tutil/lvl.py util/rsc/{i}.cfg util/rsc/{i}.ppm rsc/{i}.lvl")
    print()
    print(f"rsc/{i}.mesharray: util/rsc/{i}.cfg util/rsc/{i}.ppm util/shr.py util/mesh.py util/ma.py")
    print(f"\tutil/ma.py util/rsc/{i}.cfg util/rsc/{i}.ppm rsc/{i}.mesharray")
    print()
    print(f"rsc/{i}s.mesharray: util/rsc/{i}.cfg util/rsc/{i}.ppm util/shr.py util/mesh.py util/sma.py")
    print(f"\tutil/sma.py util/rsc/{i}.cfg util/rsc/{i}.ppm rsc/{i}s.mesharray")
    print()
print("distclean:")
print("\trm -f tabout " + rsc)
