summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7ba8b50
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+CC=gcc
+RELEASE=0
+
+GFLAGS=-Wall -Wextra -Wswitch-enum -std=c11
+DFLAGS=-fsanitize=address -fsanitize=undefined -ggdb
+RFLAGS=-O3
+
+ifeq ($(RELEASE), 0)
+CFLAGS=$(GFLAGS) $(DFLAGS)
+else
+CFLAGS=$(GFLAGS) $(RFLAGS)
+endif
+
+DIST=build
+OUT=avm.out
+
+all: $(DIST)/$(OUT)
+
+$(DIST)/$(OUT): main.c | $(DIST)
+ $(CC) $(CFLAGS) $^ -o $@
+
+.PHONY: run
+run: $(DIST)/$(OUT)
+ ./$^
+
+$(DIST):
+ mkdir $(DIST)