Skip to content

Commit cb7f394

Browse files
committed
style: Enhance readability and consistency in Makefile
1 parent 1ebdbad commit cb7f394

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

examples/ImGui/makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# Default build type when running plain `make`
1414
.DEFAULT_GOAL := all
1515

16+
# Ensure consistent behavior across make versions
17+
.SUFFIXES:
18+
1619
# ─── Main configuration options ───────────────────────────────────────────────
1720

1821
# Application name (without extension)
@@ -258,16 +261,14 @@ $(BIN_DIR)/$(TARGET): $(OBJECTS)
258261
|| printf " $(ERROR_COLOR)$(NO_COLOR) %-10s : %s\n" "Status" "Linking failed"
259262
@printf "$(INFO_COLOR)────────────────────────────────────────────$(NO_COLOR)\n"
260263

261-
$(DEP_DIR)/%.d: ;
262-
.PRECIOUS: $(DEP_DIR)/%.d
263-
264-
-include $(DEPENDENCIES)
264+
# Only include existing dependency files - avoids infinite loops
265+
-include $(wildcard $(DEPENDENCIES))
265266

266267
# ─── Build UI variants ────────────────────────────────────────────────────────────
267268

268269
.PHONY: clean-banner
269270
clean-banner:
270-
@if [ -t 1 ]; then clear; fi
271+
@cls 2>/dev/null || clear
271272
ifeq ($(VERBOSE),1)
272273
@printf "$(INFO_COLOR)─── Build: $(HIGHLIGHT)$(APP_NAME)$(NO_COLOR)\n"
273274
@printf " $(BOLD)> OS:$(NO_COLOR) %s\n" "$(OS_NAME)"

templates/advanced/makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# Default build type when running plain `make`
1414
.DEFAULT_GOAL := all
1515

16+
# Ensure consistent behavior across make versions
17+
.SUFFIXES:
18+
1619
# ─── Main configuration options ───────────────────────────────────────────────
1720

1821
# Application name (without extension)
@@ -258,16 +261,14 @@ $(BIN_DIR)/$(TARGET): $(OBJECTS)
258261
|| printf " $(ERROR_COLOR)$(NO_COLOR) %-10s : %s\n" "Status" "Linking failed"
259262
@printf "$(INFO_COLOR)────────────────────────────────────────────$(NO_COLOR)\n"
260263

261-
$(DEP_DIR)/%.d: ;
262-
.PRECIOUS: $(DEP_DIR)/%.d
263-
264-
-include $(DEPENDENCIES)
264+
# Only include existing dependency files - avoids infinite loops
265+
-include $(wildcard $(DEPENDENCIES))
265266

266267
# ─── Build UI variants ────────────────────────────────────────────────────────────
267268

268269
.PHONY: clean-banner
269270
clean-banner:
270-
@if [ -t 1 ]; then clear; fi
271+
@cls 2>/dev/null || clear
271272
ifeq ($(VERBOSE),1)
272273
@printf "$(INFO_COLOR)─── Build: $(HIGHLIGHT)$(APP_NAME)$(NO_COLOR)\n"
273274
@printf " $(BOLD)> OS:$(NO_COLOR) %s\n" "$(OS_NAME)"

0 commit comments

Comments
 (0)