|
15 | 15 | # Default build type when running plain `make` |
16 | 16 | .DEFAULT_GOAL := all |
17 | 17 |
|
18 | | -# 0 = Silent Mode; 1 = Color & Details Mode |
19 | | -VERBOSE ?= 1 |
20 | | - |
21 | | -# Optional: if the user passes -s (--silent), force VERBOSE=0 |
22 | | -ifneq ($(findstring s,$(MAKEFLAGS)),) |
23 | | - VERBOSE := 0 |
24 | | -else ifneq ($(filter -j%,$(MAKEFLAGS)),) |
25 | | - VERBOSE := 0 |
26 | | -endif |
27 | | - |
28 | | -ifeq ($(VERBOSE),1) |
29 | | - NO_COLOR := \033[0m |
30 | | - BOLD := \033[1m |
31 | | - OK_COLOR := \033[32;01m |
32 | | - WARN_COLOR := \033[33;01m |
33 | | - ERROR_COLOR := \033[31;01m |
34 | | - INFO_COLOR := \033[36;01m |
35 | | - TITLE_COLOR := \033[35;01m |
36 | | - HIGHLIGHT := \033[95;01m |
37 | | -else |
38 | | - NO_COLOR := |
39 | | - BOLD := |
40 | | - OK_COLOR := |
41 | | - WARN_COLOR := |
42 | | - ERROR_COLOR := |
43 | | - INFO_COLOR := |
44 | | - TITLE_COLOR := |
45 | | - HIGHLIGHT := |
46 | | -endif |
47 | | - |
48 | | -# Platform-specific detection for commands |
49 | | - |
50 | | -UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown) |
51 | | - |
52 | | -ifeq ($(findstring Windows,$(OS)),Windows) |
53 | | - IS_WINDOWS := yes |
54 | | -else ifeq ($(UNAME_S),Darwin) |
55 | | - IS_MACOS := yes |
56 | | -else ifeq ($(UNAME_S),Linux) |
57 | | - IS_LINUX := yes |
58 | | -endif |
59 | | - |
60 | 18 | # ────────────────────────────────────────────────────────────────────────────── |
61 | 19 | # Main configuration – customize these variables |
62 | 20 | # ────────────────────────────────────────────────────────────────────────────── |
@@ -89,7 +47,7 @@ OPT_DEBUG ?= -Og |
89 | 47 |
|
90 | 48 | # Can be a list separate by spaces " ": include/ src/ src/core imgui/ |
91 | 49 | SOURCE_DIRS ?= src include |
92 | | -INCLUDE_DIRS ?= include/imgui include/imgui/backends |
| 50 | +INCLUDE_DIRS ?= include include/imgui include/imgui/backends |
93 | 51 |
|
94 | 52 | BUILD_BASE := ./build |
95 | 53 | BIN_DIR := $(BUILD_BASE)/app |
|
117 | 75 | endif |
118 | 76 |
|
119 | 77 | # ────────────────────────────────────────────────────────────────────────────── |
120 | | -# Platform detection & common settings |
| 78 | +# Verbose mode configuration |
| 79 | +# ────────────────────────────────────────────────────────────────────────────── |
| 80 | + |
| 81 | +# 0 = Silent Mode; 1 = Color & Details Mode |
| 82 | +VERBOSE ?= 1 |
| 83 | + |
| 84 | +# Optional: if the user passes -s (--silent), force VERBOSE=0 |
| 85 | +ifneq ($(findstring s,$(MAKEFLAGS)),) |
| 86 | + VERBOSE := 0 |
| 87 | +else ifneq ($(filter -j%,$(MAKEFLAGS)),) |
| 88 | + VERBOSE := 0 |
| 89 | +endif |
| 90 | + |
| 91 | +ifeq ($(VERBOSE),1) |
| 92 | + NO_COLOR := \033[0m |
| 93 | + BOLD := \033[1m |
| 94 | + OK_COLOR := \033[32;01m |
| 95 | + WARN_COLOR := \033[33;01m |
| 96 | + ERROR_COLOR := \033[31;01m |
| 97 | + INFO_COLOR := \033[36;01m |
| 98 | + TITLE_COLOR := \033[35;01m |
| 99 | + HIGHLIGHT := \033[95;01m |
| 100 | +else |
| 101 | + NO_COLOR := |
| 102 | + BOLD := |
| 103 | + OK_COLOR := |
| 104 | + WARN_COLOR := |
| 105 | + ERROR_COLOR := |
| 106 | + INFO_COLOR := |
| 107 | + TITLE_COLOR := |
| 108 | + HIGHLIGHT := |
| 109 | +endif |
| 110 | + |
| 111 | +# ────────────────────────────────────────────────────────────────────────────── |
| 112 | +# Platform detection |
| 113 | +# ────────────────────────────────────────────────────────────────────────────── |
| 114 | + |
| 115 | +UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown) |
| 116 | + |
| 117 | +ifeq ($(findstring Windows,$(OS)),Windows) |
| 118 | + IS_WINDOWS := yes |
| 119 | +else ifeq ($(UNAME_S),Darwin) |
| 120 | + IS_MACOS := yes |
| 121 | +else ifeq ($(UNAME_S),Linux) |
| 122 | + IS_LINUX := yes |
| 123 | +endif |
| 124 | + |
| 125 | +# ────────────────────────────────────────────────────────────────────────────── |
| 126 | +# Libraries & linker flags – main customization area |
| 127 | +# ────────────────────────────────────────────────────────────────────────────── |
| 128 | + |
| 129 | +# ── Library search paths (use -L) ── |
| 130 | +LDFLAGS ?= -L./lib/ |
| 131 | + |
| 132 | +# ── Libraries to link against (use -l) ── |
| 133 | +LIBS ?= |
| 134 | + |
| 135 | +# === Platform-specific libraries === |
| 136 | +ifeq ($(IS_WINDOWS),yes) |
| 137 | + # Windows / MinGW common |
| 138 | + LIBS += -lglfw3dll |
| 139 | + |
| 140 | + # OpenGL on Windows |
| 141 | + LIBS += -lgdi32 -lopengl32 |
| 142 | + |
| 143 | + # If using GUI app (no console), link additional libraries |
| 144 | + #LIBS += -luser32 -lgdi32 -lkernel32 |
| 145 | + |
| 146 | + # Optional: link with Shell32 and Dwmapi for advanced Windows features |
| 147 | + # LIBS += -lshell32 -ldwmapi |
| 148 | +endif |
| 149 | + |
| 150 | +ifeq ($(IS_LINUX),yes) |
| 151 | + # GLFW on Linux |
| 152 | + LIBS += -lglfw |
| 153 | + |
| 154 | + # OpenGL + X11 stack |
| 155 | + LIBS += -lGL -ldl -lpthread |
| 156 | + LIBS += -lXrandr -lXinerama -lXcursor -lXi |
| 157 | +endif |
| 158 | + |
| 159 | +ifeq ($(IS_MACOS),yes) |
| 160 | + # macOS frameworks (use -framework instead of -l) |
| 161 | + LDFLAGS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo |
| 162 | +endif |
| 163 | + |
| 164 | +# ── Final linker command ingredients ── |
| 165 | +LDFLAGS += $(LIBS) $(CONSOLEFLAGS) |
| 166 | + |
| 167 | +# ────────────────────────────────────────────────────────────────────────────── |
| 168 | +# Platforms common configuration |
121 | 169 | # ────────────────────────────────────────────────────────────────────────────── |
122 | 170 |
|
123 | 171 | ifeq ($(IS_WINDOWS),yes) |
@@ -158,37 +206,6 @@ endif |
158 | 206 | TARGET_ARCH := $(if $(filter native,$(ARCH)),$(HOST_ARCH),$(ARCH)) |
159 | 207 | TARGET := $(APP_NAME)-$(TARGET_ARCH)$(if $(filter Windows,$(OS_NAME)),.exe,) |
160 | 208 |
|
161 | | -# ────────────────────────────────────────────────────────────────────────────── |
162 | | -# Libraries & linker flags – main customization area |
163 | | -# ────────────────────────────────────────────────────────────────────────────── |
164 | | - |
165 | | -# ── Library search paths (use -L) ── |
166 | | -LDFLAGS ?= -L./lib/ |
167 | | - |
168 | | -# ── Libraries to link against (use -l) ── |
169 | | -LIBS ?= -ld3d12 -ldxgi -ld3dcompiler |
170 | | - |
171 | | -# === Platform-specific libraries === |
172 | | -ifeq ($(OS),Windows_NT) |
173 | | - # Windows / MinGW common |
174 | | - LIBS += -lkernel32 -luser32 -lgdi32 -lshell32 -ldwmapi |
175 | | -endif |
176 | | - |
177 | | -ifeq ($(OS_NAME),Linux) |
178 | | - # Typical Linux dependencies |
179 | | - # threads (usually needed on Linux) |
180 | | - # LIBS += -lXrandr -lXinerama -lXcursor -lXi |
181 | | - LIBS += -lGL -ldl -lpthread |
182 | | -endif |
183 | | - |
184 | | -ifeq ($(OS_NAME),macOS) |
185 | | - # macOS frameworks (use -framework instead of -l) |
186 | | - LDFLAGS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo |
187 | | -endif |
188 | | - |
189 | | -# ── Final linker command ingredients ── |
190 | | -LDFLAGS += $(LIBS) $(CONSOLEFLAGS) |
191 | | - |
192 | 209 | # ────────────────────────────────────────────────────────────────────────────── |
193 | 210 | # Automatic source & object discovery |
194 | 211 | # ────────────────────────────────────────────────────────────────────────────── |
|
0 commit comments