Skip to content

Commit b04eeb6

Browse files
committed
Updated basci makefile
1 parent 052c1a4 commit b04eeb6

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

examples/donut-basic/makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CXX := g++
2121
# ──────────────────────────────────────────────────────────────────────────────
2222

2323
# Can be a list separate by spaces " ": include/ src/ src/core imgui/
24-
SOURCE_DIRS ?= src src/core
24+
SOURCE_DIRS ?= src
2525
INCLUDE_DIRS ?= include
2626

2727
BUILD_BASE ?= build
@@ -53,11 +53,14 @@ endif
5353
# Automatic source & object discovery
5454
# ──────────────────────────────────────────────────────────────────────────────
5555

56-
# OPTIONAL: recursive with find
57-
# SOURCES := $(shell find $(SOURCE_DIRS) -name '*.$(SRC_EXT)')
58-
5956
# Find all source files recursively
60-
SOURCES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.$(SRC_EXT)))
57+
define recurse
58+
$(wildcard $(1)/*.$(SRC_EXT)) \
59+
$(foreach d,$(wildcard $(1)/*), \
60+
$(if $(wildcard $(d)/),$(call recurse,$(d))))
61+
endef
62+
63+
SOURCES := $(foreach dir,$(SOURCE_DIRS),$(call recurse,$(dir)))
6164
OBJECTS := $(patsubst %.$(SRC_EXT),$(OBJ_DIR)/%.o,$(SOURCES))
6265
DEPENDENCIES := $(OBJECTS:.o=.d)
6366

0 commit comments

Comments
 (0)