aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-08-27 09:35:41 -0400
committerRaghuram Subramani <raghus2247@gmail.com>2025-08-27 09:35:41 -0400
commitfd7e478e475fccf9616998ccb62e91534e935ae5 (patch)
treee8fec45b0bf1999576def36a3b8b1372e8f70214
parent87a5767ab1c324d3b88407af2263505a88f6375a (diff)
build: add Makefile to wrap CMake
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile19
2 files changed, 20 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9927f6e..52b78a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ set(SRC
set(C_COMPILE_OPTIONS
# -O3
- -O0
+ # -O0
-Wall
-Wextra
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..963b7dd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+CC := clang
+EXEC := msg
+BUILD := build
+BUILT := $(BUILD)/$(EXEC)
+
+CMAKE_ARGS ?= -DCMAKE_EXPORT_COMPILE_COMMANDS=On -G 'Unix Makefiles' -DCMAKE_C_COMPILER=$(CC)
+MAKE_ARGS ?= -j$(shell nproc)
+
+all: $(BUILT)
+
+.PHONY: $(BUILT)
+$(BUILT): $(BUILD)
+ cmake --build $(BUILD) -- $(MAKE_ARGS)
+
+$(BUILD):
+ cmake -S $(PWD) -B $@ $(CMAKE_ARGS)
+
+clean:
+ $(RM) -rf $(BUILD)