aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 01:25:24 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 01:25:24 +0100
commit16e22755767cbf6a11aa6699d0679ff73618d216 (patch)
tree03f34fc442b6885ff86ed2b4eae4ac9ff7bf6acf /Makefile
downloadovm-16e22755767cbf6a11aa6699d0679ff73618d216.tar.gz
ovm-16e22755767cbf6a11aa6699d0679ff73618d216.tar.bz2
ovm-16e22755767cbf6a11aa6699d0679ff73618d216.zip
First commit!
This is a from the ground rework of an old project of the same name. I'm hoping to be more concerned with runtime efficiency, bytecode size and all those things that should actually matter for something that may host time/space critical code.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b5c8120
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+CC=gcc
+CFLAGS=-Wall -Wextra -Werror -Wswitch-enum -ggdb -fsanitize=address -std=c11
+LIBS=
+ARGS=
+OUT=ovm.out
+
+SRC=src
+DIST=build
+
+CODE=$(addprefix $(SRC)/, main.c)
+OBJECTS=$(CODE:$(SRC)/%.c=$(DIST)/%.o)
+DEPS=$(OBJECTS:%.o=%.d)
+
+.PHONY: all
+all: $(OUT)
+
+$(OUT): $(DIST)/$(OUT)
+
+$(DIST)/$(OUT): $(OBJECTS)
+ mkdir -p $(DIST)
+ $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+
+-include $(DEPS)
+
+$(DIST)/%.o: $(SRC)/%.c
+ mkdir -p $(DIST)
+ $(CC) $(CFLAGS) -MMD -c $< -o $@ $(LIBS)
+
+.PHONY: run
+run: $(DIST)/$(OUT)
+ ./$^ $(ARGS)
+
+.PHONY:
+clean:
+ rm -rfv $(DIST)/*