summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>2012-06-21 19:34:49 (GMT)
committer Peter Korsgaard <jacmet@sunsite.dk>2012-06-23 21:14:56 (GMT)
commit75f18de67e7bc7f1feb360eb4201a3c6d6773698 (patch)
tree55619bc26f04d50d39c1d1d2f3746be0347dd2ed
parentf86391fc07731c26d96acec5f1d082378f9e494d (diff)
downloadbuildroot-75f18de67e7bc7f1feb360eb4201a3c6d6773698.tar.gz
buildroot-75f18de67e7bc7f1feb360eb4201a3c6d6773698.tar.bz2
pkg-utils.mk: add utility functions find*clauses and notfirstword
This patch adds a few utility functions to pkg-utils.mk. Functions finddirclauses and findfileclauses help in building a find command that skips a set of directories and performs operations on a set of files. This pattern can for example be used to keep certain files or directories from being stripped, or to remove certain files from a package installation. The notfirstword function is the inverse of the 'firstword' function in make: it returns all but the first word. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-rw-r--r--package/pkg-utils.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 953dbc9..0c55a9d 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -76,6 +76,15 @@ MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESE
TERM_BOLD := $(shell tput smso)
TERM_RESET := $(shell tput rmso)
+# Utility functions for 'find'
+# findfileclauses(filelist) => -name 'X' -o -name 'Y'
+findfileclauses = $(call notfirstword,$(patsubst %,-o -name '%',$(1)))
+# finddirclauses(base, dirlist) => -path 'base/dirX' -o -path 'base/dirY'
+finddirclauses = $(call notfirstword,$(patsubst %,-o -path '$(1)/%',$(2)))
+
+# Miscellaneous utility functions
+# notfirstword(wordlist): returns all but the first word in wordlist
+notfirstword = $(wordlist 2,$(words $(1)),$(1))
# Needed for the foreach loops to loop over the list of hooks, so that
# each hook call is properly separated by a newline.