summaryrefslogtreecommitdiff
path: root/pit/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'pit/Makefile')
-rw-r--r--pit/Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/pit/Makefile b/pit/Makefile
index 6667b91..2eeb084 100644
--- a/pit/Makefile
+++ b/pit/Makefile
@@ -2,12 +2,15 @@ EXE ?= pit
CC ?= gcc
AR ?= ar
-override CPPFLAGS += -MMD -MP
-override CFLAGS += -O2 -fPIC --std=c99 -g -Ideps/ -Isrc/ -Iinclude/ -Wall -Wextra -Wpedantic -Wconversion -Wformat-security -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -Wfloat-equal -Wundef -Wpointer-arith -Wbad-function-cast -Wlogical-op -Wmissing-braces -Wcast-align -Wstrict-overflow=5 -fwrapv # -ftrapv
-override LDFLAGS += -g -static
BUILD = build_$(CC)
+override CPPFLAGS += -MMD -MP
+override CFLAGS += -O2 -fPIC --std=c99 -g -I$(BUILD) -Ideps/ -Isrc/ -Iinclude/ -Wall -Wextra -Wpedantic -Wconversion -Wformat-security -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -Wfloat-equal -Wundef -Wpointer-arith -Wbad-function-cast -Wlogical-op -Wmissing-braces -Wcast-align -Wstrict-overflow=5 -fanalyzer -fwrapv # -ftrapv
+override LDFLAGS += -g -static
+# override CFLAGS += -O2 -fanalyzer -fsanitize=undefined -fPIC --std=c99 -g -Ideps/ -Isrc/ -Iinclude/ -Wall -Wextra -Wpedantic -Wconversion -Wformat-security -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -Wfloat-equal -Wundef -Wpointer-arith -Wbad-function-cast -Wlogical-op -Wmissing-braces -Wcast-align -Wstrict-overflow=5 -fwrapv # -ftrapv
+# override LDFLAGS += -fsanitize=undefined -g
+
SRCS_CORE := \
src/utils.c src/arena.c src/lexer.c src/parser.c src/runtime.c \
src/runtime/value.c \
@@ -16,6 +19,9 @@ SRCS_CORE := \
src/library.c
OBJECTS_CORE := $(SRCS_CORE:src/%.c=$(BUILD)/%.o)
LIB_CORE := libcolonq-pit.a
+SRCS_LISP := \
+ lisp/essential.pit
+HEADERS_LISP := $(SRCS_LISP:lisp/%.pit=$(BUILD)/lisp/%.h)
SRCS_NATIVE := src/native.c
OBJECTS_NATIVE := $(SRCS_NATIVE:src/%.c=$(BUILD)/%.o)
LIB_NATIVE := libcolonq-pit-native.a
@@ -48,10 +54,14 @@ $(BUILD):
mkdir $(BUILD)/
mkdir $(BUILD)/runtime/
mkdir $(BUILD)/runtime/value/
+ mkdir $(BUILD)/lisp/
-$(BUILD)/%.o: src/%.c | $(BUILD)
+$(BUILD)/%.o: src/%.c $(HEADERS_LISP) | $(BUILD)
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+$(BUILD)/lisp/%.h: lisp/%.pit | $(BUILD)
+ xxd -i $< $@
+
clean:
-rm $(EXE)
-rm $(LIB_CORE)