diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-05-09 18:29:52 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-05-09 18:29:52 +0100 |
commit | ba5c0a4579ece5d53c009a14d00e683e70b982f4 (patch) | |
tree | ad7e6788b8ce634172f9a5cdee0a1a9ac08c7788 /Makefile | |
parent | 576bf0f3085022e9117d78e3b4e19971c82a61d6 (diff) | |
download | oats-ba5c0a4579ece5d53c009a14d00e683e70b982f4.tar.gz oats-ba5c0a4579ece5d53c009a14d00e683e70b982f4.tar.bz2 oats-ba5c0a4579ece5d53c009a14d00e683e70b982f4.zip |
Initial implementation
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 51 |
1 files changed, 51 insertions, 0 deletions
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) |