From ba5c0a4579ece5d53c009a14d00e683e70b982f4 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 9 May 2025 18:29:52 +0100 Subject: Initial implementation --- Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c6d5504 --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +CC=gcc +OUT=oats.out +LIBS=-I. +ARGS= + +RELEASE=0 +GFLAGS=-Wall -Wextra -Wswitch-enum -Werror -std=c11 +DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined +RFLAGS=-O3 +DEPFLAGS=-MT $@ -MMD -MP -MF + +ifeq ($(RELEASE), 1) +CFLAGS=$(GFLAGS) $(RFLAGS) -DDEBUG=0 +else +CFLAGS=$(GFLAGS) $(DFLAGS) +endif + +DIST=build +SRC:=tag.c memory.c vec.c sv.c lisp.c reader.c eval.c main.c +OBJ:=$(SRC:%.c=$(DIST)/%.o) +DEPDIR=$(DIST)/dependencies +DEPS:=$(SRC:%.c=$(DEPDIR)/%.d) + +.PHONY: all +all: $(DIST)/$(OUT) + +$(DIST)/%.o: %.c | $(DIST) $(DEPDIR) + $(CC) $(CFLAGS) $(DEPFLAGS) $(DEPDIR)/$*.d -c $< -o $@ $(LIBS) + +$(DIST)/$(OUT): $(OBJ) | $(DIST) + $(CC) $(CFLAGS) $^ -o $@ $(LIBS) + +.PHONY: run +run: $(DIST)/$(OUT) + ./$^ $(ARGS) + +.PHONY: +clean: + rm -rfv $(DIST)/* + +$(DIST): + mkdir -p $(DIST) + +$(DEPDIR): + mkdir -p $(DEPDIR) + +.PHONY: +watch: + find . -type 'f' -regex ".*.c\\|.*.h" | entr -cs "make run" + +-include $(DEPS) -- cgit v1.2.3-13-gbd6f