-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
101 lines (83 loc) · 5.08 KB
/
makefile
File metadata and controls
101 lines (83 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# =============================================================================
# Makefile to build all examples in this project
# =============================================================================
# Default build type when running plain `make`
.DEFAULT_GOAL := all
# Ensure consistent behavior across make versions
.SUFFIXES:
# Platform-specific detection for commands
UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown)
ifeq ($(findstring Windows,$(OS)),Windows)
IS_WINDOWS := yes
RMDIR := rmdir /S /Q
else ifeq ($(UNAME_S),Darwin)
IS_MACOS := yes
RMDIR := rm -rf
else
IS_LINUX := yes
RMDIR := rm -rf
endif
# ─── Configuration ───────────────────────────────────────────────────────
EXAMPLES_DIR := examples
# ─── Main rules ──────────────────────────────────────────────────────────
.PHONY: all donut-basic ImGui task-manager run-donut run-imgui run-tm clean clean-all list help
all: donut-basic ImGui task-manager
@echo "→ Built all examples"
donut-basic:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/donut-basic
@echo "→ Built example: donut-basic"
ImGui:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/ImGui
@echo "→ Built example: ImGui"
task-manager:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/task-manager
@echo "→ Built example: task-manager"
# ─── Run targets ─────────────────────────────────────────────────────────
run-donut:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/donut-basic run
run-imgui:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/ImGui run
run-tm:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/task-manager run
# ─── Clean targets ─────────────────────────────────────────────────────────
clean:
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/donut-basic clean
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/ImGui clean
@$(MAKE) --no-print-directory -C $(EXAMPLES_DIR)/task-manager clean
@echo "→ Cleaned all examples"
clean-all:
@$(RMDIR) "$(EXAMPLES_DIR)/donut-basic/build" 2>/dev/null || true
@$(RMDIR) "$(EXAMPLES_DIR)/ImGui/build" 2>/dev/null || true
@$(RMDIR) "$(EXAMPLES_DIR)/task-manager/build" 2>/dev/null || true
@echo "→ Removed all build directories"
# ─── Utilities ────────────────────────────────────────────────────────────
list:
@printf "\n═══════════════════════════════════════════════════════════\n"
@printf " Available Examples\n"
@printf "═══════════════════════════════════════════════════════════\n"
@printf " %-20s %-35s\n" "Alias" "Description"
@printf " %-20s %-35s\n" "donut" "3D ASCII Donut (Terminal Animation)"
@printf " %-20s %-35s\n" "imgui" "ImGui + GLFW (GUI Application)"
@printf " %-20s %-35s\n" "task-manager" "CLI Task Manager (Advanced)"
@printf "═══════════════════════════════════════════════════════════\n\n"
help:
@printf "\n═══════════════════════════════════════════════════════════\n"
@printf " Example Build System - Help\n"
@printf "═══════════════════════════════════════════════════════════\n"
@printf "Usage: make [target]\n\n"
@printf "Main Targets:\n"
@printf " all build all examples (default)\n"
@printf " donut-basic build donut example only\n"
@printf " ImGui build imgui example only\n"
@printf " task-manager build task-manager example only\n\n"
@printf "Run Targets:\n"
@printf " run-donut build + run donut example\n"
@printf " run-imgui build + run imgui example\n"
@printf " run-tm build + run task-manager example\n\n"
@printf "Clean Targets:\n"
@printf " clean clean all examples\n"
@printf " clean-all remove all build directories\n\n"
@printf "Utilities:\n"
@printf " list show available examples\n"
@printf " help this message\n\n"
@printf "═══════════════════════════════════════════════════════════\n\n"