summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-09-20 23:25:29 -0400
committerLLLL Colonq <llll@colonq>2025-09-20 23:25:29 -0400
commit85a67a25ac9757e694166b3c9e9e2c8cdeefc6da (patch)
treea381993c6f0d85aec3c3ead4ed7fa66583338ccb /Makefile
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ed444ea
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+SRCS := src/main.c src/utils.c src/lexer.c src/parser.c src/runtime.c
+OBJECTS := $(SRCS:src/%.c=build/%.o)
+EXE := pit
+
+CC := musl-gcc
+CHK_SOURCES ?= $(SRCS)
+CPPFLAGS ?= -MMD -MP
+CFLAGS ?= -Ideps/ -Isrc/ -Wall -Wextra -Wpedantic -ftrapv --std=c23 -O0 -g
+LDFLAGS ?= -g -static
+
+.PHONY: all clean check-syntax
+
+all: $(EXE)
+
+$(EXE): $(OBJECTS)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+build:
+ mkdir build/
+
+build/%.o: src/%.c | build
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+clean:
+ -rm $(EXE)
+ -rm -r build/
+
+TAGS: $(SRCS)
+ etags $^
+
+check-syntax: TAGS
+ gcc $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
+
+-include $(OBJECTS:.o=.d)