RELEASE_flags=-DNDEBUG -O2 -g0 -s
DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined

.PHONY: all debug dest run test install uninstall format clean archive

all: dest bin/modal

dest:
	@ mkdir -p bin
run: all
	@ bin/modal examples/test.modal
test: all
	@ bin/modal -v 
	@ bin/modal examples/test.modal
install: all 
	cp bin/modal ~/bin/
uninstall:
	rm -f ~/bin/modal
format:
	@ clang-format -i src/modal.c
clean:
	rm -fr bin
archive: all
	cp src/modal.c ../oscean/etc/modal.c.txt

bin/modal: src/modal.c
	@ cc ${DEBUG_flags} ${CFLAGS} src/modal.c -o bin/modal