All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1 of 5 v2] Makefile.package.in: add utility functions find*clauses and notfirstword
Date: Thu, 17 Nov 2011 20:41:48 +0100	[thread overview]
Message-ID: <b6579582d02dd802adca.1321557990@devws108> (raw)
In-Reply-To: <patchbomb.1321557989@devws108>

# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire@alcatel-lucent.com>
# Date 1318518890 -7200
# Node ID b6579582d02dd802adca94e2b38972cc19cd8b76
# Parent  baa870774b887fb01a9de0cc69161f250553f896
Makefile.package.in: add utility functions find*clauses and notfirstword

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@gmail.com>

---
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 "-wholename 'basedir/dirX' -o -wholename 'basedir/dirY'"
+# [1:basedir, 2:namelist]
+finddirclauses=-wholename '$(firstword $(2))' $(patsubst %,-o -wholename '$(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))

  reply	other threads:[~2011-11-17 19:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 19:41 [Buildroot] [PATCH 0 of 5 v2] Add find utility functions / exclude files from strip / reduce python Thomas De Schampheleire
2011-11-17 19:41 ` Thomas De Schampheleire [this message]
2011-11-17 19:50   ` [Buildroot] [PATCH 1 of 5 v2] Makefile.package.in: add utility functions find*clauses and notfirstword Thomas Petazzoni
2011-11-17 20:19     ` Thomas De Schampheleire
2011-11-18  0:10   ` Arnout Vandecappelle
2011-11-18  9:41     ` Thomas De Schampheleire
2011-11-19  7:13   ` Cam Hutchison
2011-11-21  8:42     ` Thomas De Schampheleire
2011-11-17 19:41 ` [Buildroot] [PATCH 2 of 5 v2] stripping: use findfileclauses utility function Thomas De Schampheleire
2011-11-18  0:06   ` Arnout Vandecappelle
2011-11-18  1:46   ` Cam Hutchison
2011-11-18  6:21     ` Thomas De Schampheleire
2011-11-17 19:41 ` [Buildroot] [PATCH 3 of 5 v2] build: add option to exclude executables/dirs from being stripped Thomas De Schampheleire
2011-11-17 19:42 ` [Buildroot] [PATCH 4 of 5 v2] python config: move configuration into menu Thomas De Schampheleire
2011-11-17 19:42 ` [Buildroot] [PATCH 5 of 5 v2] python: allow reduced installation Thomas De Schampheleire
2011-11-17 19:55   ` Thomas Petazzoni
2011-11-18  0:24     ` Arnout Vandecappelle
2011-11-18  7:59     ` Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6579582d02dd802adca.1321557990@devws108 \
    --to=patrickdepinguin+buildroot@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.