hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-02 01:19:50 +0200
committerhachem <im@hachem.wtf>2026-09-02 01:19:50 +0200
commitef15ee2b634058a8199c31223e5e2ec9784be031 (patch)
treef1b0de7d47a04a26f8c3814e729564d3edef34dc /Makefile
parent363c188831bdbd75c5f5cd4ac861e9331adaf1af (diff)
setup: project
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..cb5d10d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+CC := clang
+
+CFLAGS := -Wall \
+ -Wextra \
+ -Wpedantic \
+ -Wconversion \
+ -Wsign-conversion \
+ -Wshadow \
+ -Wstrict-prototypes \
+ -Wmissing-prototypes \
+ -g \
+ -fno-omit-frame-pointer \
+ -fsanitize=address,undefined \
+ -std=c17 \
+ -Isrc
+
+LDFLAGS := -fsanitize=address,undefined
+
+CPPCHECKFLAGS := --project=compile_commands.json \
+ --enable=warning,style,performance,portability \
+ --error-exitcode=1
+
+TARGET := bin/jafm
+
+SRC := $(shell find src -name '*.c')
+OBJ := $(SRC:src/%.c=bin/%.o)
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ)
+ @mkdir -p $(@D)
+ $(CC) $^ -o $@ $(LDFLAGS)
+
+bin/%.o: src/%.c
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+check:
+ bear -- make clean all
+ cppcheck $(CPPCHECKFLAGS)
+
+clean:
+ rm -rf bin
+
+.PHONY: all check clean