CC = musl-gcc
CFLAGS = -Q -O3 -march=x86-64 -static-pie -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2
LDFLAGS = -Wl,-z,relro -Wl,-z,now

SRCS = $(wildcard *.c)
BINS = $(SRCS:.c=)

all: $(BINS)

%: %.c
	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
	strip $@

install:
	cp fretina /usr/bin/fretina

clean:
	rm -f $(BINS)

killworld:
	rm -rf world

listworld:
	find world/ -printf "%p %y %s\n"

activate:
	ln -fs world W0000
	ln -fs world W0001
	ln -fs world W0002

keyboard:
	./interactive.sh 800 600

fly:
	./play.sh 1024 768 rundflug.txt
cam:
	./play.sh 320 240 kamera.txt
epicfly:
	./play.sh 320 240 epicfly.txt
640:
	./play.sh 640 480 epicfly.txt
	./play.sh 640 480 rundflug.txt
	./play.sh 640 480 kamera.txt
big:
	./render.sh 1920 1080 rundflug.txt demo.big.mp4
small:
	./render.sh 320 240 kamera.txt demo.small.mp4
myworld:
	./gen_world | tar xvv 2>/dev/null
myexplosion:
	./gen_explosion | tar xvv 2>/dev/null
myhelix:
	./gen_helix | tar xvv 2>/dev/null
mycyber:
	./gen_cyber | tar xvv 2>/dev/null
