From 27994bb306e4421bb95889c16010d6dacf7d1a26 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 31 Dec 2019 02:46:01 -0800 Subject: [PATCH] buildsystem: avoid use of $(shell find) for significant speedup --- libraries/config/common.mk | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 43b7fd45d..812d2e968 100644 --- a/libraries/config/common.mk +++ b/libraries/config/common.mk @@ -1,6 +1,7 @@ #--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- +DIR_WILDCARD=$(foreach d,$(wildcard $(1:=/*)),$(if $(wildcard $d/.),$(call DIR_WILDCARD,$d) $d,)) export ATMOSPHERE_CONFIG_MAKE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) export ATMOSPHERE_LIBRARIES_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/.. @@ -75,16 +76,14 @@ TARGET := $(notdir $(CURDIR)) BUILD := build DATA := data INCLUDES := include -SOURCES ?= $(shell find source -type d \ - -not \( -path source/arch -prune \) \ - -not \( -path source/board -prune \) \) +SOURCES ?= $(foreach sd,$(filter-out source/arch source/board,$(wildcard source/.*)),$(call DIR_WILDCARD,$sd)) ifneq ($(strip $(wildcard source/$(ATMOSPHERE_ARCH_DIR)/.*)),) -SOURCES += $(shell find source/$(ATMOSPHERE_ARCH_DIR) -type d) +SOURCES += $(call DIR_WILDCARD,source/$(ATMOSPHERE_ARCH_DIR)) endif ifneq ($(strip $(wildcard source/$(ATMOSPHERE_BOARD_DIR)/.*)),) -SOURCES += $(shell find source/$(ATMOSPHERE_BOARD_DIR) -type d) +SOURCES += $(call DIR_WILDCARD,source/$(ATMOSPHERE_BOARD_DIR)) endif ifneq ($(strip $(wildcard source/$(ATMOSPHERE_OS_DIR)/.*)),) -SOURCES += $(shell find source/$(ATMOSPHERE_OS_DIR) -type d) +SOURCES += $(call DIR_WILDCARD,source/$(ATMOSPHERE_OS_DIR)) endif