File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
2525INCLUDE_DIRS ?= include
2626
2727BUILD_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 ) ) )
6164OBJECTS := $(patsubst % .$(SRC_EXT ) ,$(OBJ_DIR ) /% .o,$(SOURCES ) )
6265DEPENDENCIES := $(OBJECTS:.o=.d )
6366
You can’t perform that action at this time.
0 commit comments