summaryrefslogtreecommitdiffstats
path: root/core/definitions.mk
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-09-29 16:26:28 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-10-16 19:35:15 -0700
commitd7b9ac7e4371f6163d4d3747c9f84ce7173f8e10 (patch)
treefda94cb9ba179300df12e0a354d22f7643c0a366 /core/definitions.mk
parent468ddd95411ca8616d2a11038161e5f776c36d53 (diff)
downloadbuild-d7b9ac7e4371f6163d4d3747c9f84ce7173f8e10.zip
build-d7b9ac7e4371f6163d4d3747c9f84ce7173f8e10.tar.gz
build-d7b9ac7e4371f6163d4d3747c9f84ce7173f8e10.tar.bz2
Add all-cpp-files-under
There are multiple versions of this in the tree. Let's standardize on one that will work for everyone, and will sort the results. Bug: 24204119 Change-Id: I09fcd80e1e8e35e64d8a8a62bbc096f87b02603f
Diffstat (limited to 'core/definitions.mk')
-rw-r--r--core/definitions.mk23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/definitions.mk b/core/definitions.mk
index 81df0dc..a07c7b1 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -219,6 +219,29 @@ $(call all-c-files-under,.)
endef
###########################################################
+## Find all of the cpp files under the named directories.
+## LOCAL_CPP_EXTENSION is respected if set.
+## Meant to be used like:
+## SRC_FILES := $(call all-cpp-files-under,src tests)
+###########################################################
+
+define all-cpp-files-under
+$(sort $(patsubst ./%,%, \
+ $(shell cd $(LOCAL_PATH) ; \
+ find -L $(1) -name "*$(or $(LOCAL_CPP_EXTENSION),.cpp)" -and -not -name ".*") \
+ ))
+endef
+
+###########################################################
+## Find all of the cpp files from here. Meant to be used like:
+## SRC_FILES := $(call all-subdir-cpp-files)
+###########################################################
+
+define all-subdir-cpp-files
+$(call all-cpp-files-under,.)
+endef
+
+###########################################################
## Find all files named "I*.aidl" under the named directories,
## which must be relative to $(LOCAL_PATH). The returned list
## is relative to $(LOCAL_PATH).