modal/makefile

35 lines
1.0 KiB
Makefile

RELEASE_flags=-DNDEBUG -O2 -g0 -s
DEBUG_flags=-std=c99 -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 debug test install uninstall format clean archive
all: dest
dest:
@ mkdir -p bin
run: all bin/modal
@ bin/modal src/repl.modal
debug: all bin/modal-debug
@ bin/modal-debug examples/rules.modal
test: all bin/modal-debug bin/modal
@ bin/modal -v
@ bin/modal-debug -q examples/fizzbuzz.modal
@ bin/modal-debug -q examples/sierpinski.modal
@ bin/modal-debug -q -a examples/tests.modal
install: bin/modal
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-debug: src/modal.c
@ cc ${DEBUG_flags} src/modal.c -o bin/modal-debug
bin/modal: src/modal.c
@ cc ${RELEASE_flags} src/modal.c -o bin/modal