From ef15ee2b634058a8199c31223e5e2ec9784be031 Mon Sep 17 00:00:00 2001 From: hachem Date: Wed, 2 Sep 2026 01:19:50 +0200 Subject: setup: project --- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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 -- cgit v1.3