summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-10-25 17:06:42 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-10-25 17:06:42 +0100
commitaace23ead78fa22edb2533565acfa379e451c5eb (patch)
treeaf13aeec4a6d11850436f218b6ee0edb104f305a /Makefile
downloadavm-aace23ead78fa22edb2533565acfa379e451c5eb.tar.gz
avm-aace23ead78fa22edb2533565acfa379e451c5eb.tar.bz2
avm-aace23ead78fa22edb2533565acfa379e451c5eb.zip
Hello, world!
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)