diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-06-17 23:42:31 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-06-17 23:42:31 +0300 |
commit | bcac686c1bf6a5c1dec2324269e2766babdc0fde (patch) | |
tree | 6483461015705efa8290a1ab05482a641739c1dd /Makefile |
lexer - done
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0cbcaeb --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +CC := gcc + +ifeq ($(PROD),1) +CFLAGS := -std=c99 -O2 # production flags +else +CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -g -DDEBUG # debug flags +endif + +SRCD := src +OBJD := obj +BIND := bin +TESTD := tests + +FILES = $(shell find $(SRCD)/ -type f 2> /dev/null) +CSRCS = $(filter %.c, $(FILES)) +COBJS = $(CSRCS:$(SRCD)/%.c=$(OBJD)/%.o) + +CDEPS = $(COBJS:%.o=%.d) +-include $(CDEPS) + +.PHONY: all clean lispy + +all: lispy +lispy: $(BIND)/lispy + +clean: + rm -rf $(BIND) + rm -rf $(OBJD) + +$(OBJD)/%.o: $(SRCD)/%.c + mkdir -p $(dir $@) + $(CC) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -c $< -o $@ + +$(BIND)/%: $(COBJS) + mkdir -p $(dir $@) + $(CC) $(CFLAGS) $^ -o $@ + +analyze: clean + scan-build \ + -enable-checker alpha \ + -enable-checker core \ + -enable-checker deadcode \ + -enable-checker security \ + -enable-checker unix \ + make + +leak: lispy + valgrind -s --leak-check=full $(BIND)/lispy |