1+ # =============================================================================
2+ # Makefile to build all examples in this project
3+ # =============================================================================
4+
5+ # Default build type when running plain `make`
6+ .DEFAULT_GOAL := all
7+
8+ # Platform-specific detection for commands
9+
10+ UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown)
11+
12+ ifeq ($(findstring Windows,$(OS ) ) ,Windows)
13+ IS_WINDOWS := yes
14+ else ifeq ($(UNAME_S),Darwin)
15+ IS_MACOS := yes
16+ else ifeq ($(UNAME_S),Linux)
17+ IS_LINUX := yes
18+ endif
19+
20+ # ─────────────────────────────────────────────────────────────────────────────
21+ # Configuration
22+ # ─────────────────────────────────────────────────────────────────────────────
23+
24+ EXAMPLES_DIR := examples
25+
26+ # ─────────────────────────────────────────────────────────────────────────────
27+ # Common settings
28+ # ─────────────────────────────────────────────────────────────────────────────
29+
30+ ifeq ($(OS ) ,Windows_NT)
31+ RMDIR := rmdir /S /Q
32+ else
33+ RMDIR := rm -rf
34+ endif
35+
36+ # ─────────────────────────────────────────────────────────────────────────────
37+ # Main rules
38+ # ─────────────────────────────────────────────────────────────────────────────
39+
40+ .PHONY : all donut-basic ImGui
41+
42+ all : donut-basic ImGui
43+ @echo " → Built all examples"
44+
45+ donut-basic :
46+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /donut-basic
47+ @echo " → Built example: donut-basic"
48+
49+ ImGui :
50+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /ImGui
51+
52+ # ─────────────────────────────────────────────────────────────────────────────
53+ # Run targets
54+ # ─────────────────────────────────────────────────────────────────────────────
55+
56+ .PHONY : run-donut run-imgui
57+
58+ run-donut :
59+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /donut-basic run
60+
61+ run-imgui :
62+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /ImGui run
63+
64+ # ──────────────────────────────────────────────────────────────────────────────
65+ # Clean targets
66+ # ──────────────────────────────────────────────────────────────────────────────
67+
68+ .PHONY : clean clean-all
69+
70+ clean :
71+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /donut-basic clean
72+ @$(MAKE ) --no-print-directory -C $(EXAMPLES_DIR ) /ImGui clean
73+
74+ # ──────────────────────────────────────────────────────────────────────────────
75+ # Utilities
76+ # ──────────────────────────────────────────────────────────────────────────────
77+
78+ .PHONY : list help
79+
80+ list :
81+ @echo " Available examples:"
82+ @printf " %-12s (%s)\n" " imgui" " ImGui" ;
83+ @printf " %-12s (%s)\n" " donut" " donut-basic" ;
84+
85+ help :
86+ @echo " make .................... build all examples"
87+ @echo " make run-[alias] ........ build + run that example"
88+ @echo " (run-donut, run-imgui)"
89+ @echo " make clean .............. clean all examples"
90+ @echo " make list ............... show available examples"
91+ @echo " make help ............... this message"
0 commit comments