aboutsummaryrefslogtreecommitdiff
path: root/lazy.mk
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-09-03 11:01:00 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-09-03 11:01:00 +0200
commit690c853da8b50faa366ff42d9b32b32c841e7211 (patch)
treea2343570435e75bfd37025c3cedff3aceb033a53 /lazy.mk
parentff078630f3420a03cf8d9432cc7a96f249db5573 (diff)
more scaffolding
Diffstat (limited to 'lazy.mk')
-rw-r--r--lazy.mk32
1 files changed, 32 insertions, 0 deletions
diff --git a/lazy.mk b/lazy.mk
new file mode 100644
index 0000000..8684332
--- /dev/null
+++ b/lazy.mk
@@ -0,0 +1,32 @@
+# NOTE: CMAKE IS THE PRIMARY BUILD SYSTEM FOR THIS PROJECT. THIS FILE IS
+# PROVIDED PURELY FOR CONVENIENCE, AND SHOULD NOT BECOME AN ESSENTIAL PART OF
+# THE BUILD SYSTEM!
+
+BUILD_DIR ?= build
+TARGET ?= $(BUILD_DIR)/main
+
+# make cmake shut up
+CMFLAGS += --fresh
+CMFLAGS += --log-level WARNING
+CMFLAGS += -Wno-deprecated
+
+.PHONY: FORCE
+
+all: FORCE $(TARGET)
+
+$(BUILD_DIR)/build.ninja: CMakeLists.txt
+ @mkdir -p $(BUILD_DIR)
+ @cmake -B $(BUILD_DIR) -G Ninja $(CMFLAGS)
+
+$(TARGET): $(BUILD_DIR)/build.ninja FORCE
+ @ninja -C $(BUILD_DIR)
+
+clean: FORCE
+ $(RM) -r $(BUILD_DIR)
+
+# Forward any unknown targets to Ninja
+ifneq ($(MAKECMDGOALS),)
+%::
+ @ninja -C $(BUILD_DIR) $@
+endif
+