[Buildroot] [PATCH 1 of 2 v3-resend] Makefile.package.in: add utility functions find*clauses and notfirstword
Thomas De Schampheleire
patrickdepinguin+buildroot at gmail.com
Thu Feb 9 20:09:29 UTC 2012
This patch adds a few utility functions to Makefile.package.in.
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 at gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
---
v3: use -path instead of -wholename; fix a bug in finddirclauses. Thanks, Cam.
v2: integrate _cont variants in main find*clauses functions. Thanks, Arnout.
package/Makefile.package.in | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/package/Makefile.package.in b/package/Makefile.package.in
--- a/package/Makefile.package.in
+++ b/package/Makefile.package.in
@@ -87,6 +87,17 @@ MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)
TERM_BOLD := $(shell tput smso)
TERM_RESET := $(shell tput rmso)
+# Utility functions for 'find'
+# findfileclauses: creates "-name 'X' -o -name 'Y'"
+# [1:namelist]
+findfileclauses=-name '$(firstword $(1))' $(patsubst %,-o -name '%',$(call notfirstword,$(1)))
+# finddirclauses: creates "-path 'basedir/dirX' -o -path 'basedir/dirY'"
+# [1:basedir, 2:namelist]
+finddirclauses=-path '$(1)/$(firstword $(2))' $(patsubst %,-o -path '$(1)/%',$(call notfirstword,$(2)))
+
+# Miscellaneous utility functions
+notfirstword=$(wordlist 2,$(words $(1)),$(1))
+
# Download method commands
WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET)
SVN:=$(call qstrip,$(BR2_SVN))
More information about the buildroot
mailing list