Buildroot Archive on 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] Makefile.package.in: add utility functions find*clauses and notfirstword
Date: Wed, 19 Oct 2011 09:34:04 +0200	[thread overview]
Message-ID: <31ae7a6eaff4e2cf9a1e.1318602116@devws108> (raw)
In-Reply-To: <patchbomb.1318602115@devws108>

This patch adds a few utility functions to Makefile.package.in.

Functions finddirclauses, finddirclauses_cont, findfileclauses and
findfileclauses_cont 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 make 'firstword' function: it
returns all but the first word.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 package/Makefile.package.in |  17 +++++++++++++++++
 1 files changed, 17 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,23 @@ MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)
 TERM_BOLD := $(shell tput smso)
 TERM_RESET := $(shell tput rmso)
 
+# Utility functions for 'find'
+# findfileclauses_cont: creates "-o -name 'X' -o -name 'Y'"
+# [1:namelist, 2:prefix]
+findfileclauses_cont=$(patsubst %,$(2) -name '%',$(1))
+# findfileclauses: creates "-name 'X' -o -name 'Y'"
+# [1:namelist]
+findfileclauses=$(call findfileclauses_cont,$(firstword $(1))) $(call findfileclauses_cont,$(call notfirstword,$(1)),-o)
+# finddirclauses_cont: creates "-o -wholename 'basedir/dirX' -o -wholename 'basedir/dirY'"
+# [1:basedir, 2:namelist, 3:prefix]
+finddirclauses_cont=$(patsubst %,$(3) -wholename '$(1)/%',$(2))
+# finddirclauses: creates "-wholename 'basedir/dirX' -o -wholename 'basedir/dirY'"
+# [1:basedir, 2:namelist]
+finddirclauses=$(call finddirclauses_cont,$(1),$(firstword $(2))) $(call finddirclauses_cont,$(1),$(call notfirstword,$(2)),-o)
+
+# 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-10-19  7:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  7:33 [Buildroot] [PATCH 0 of 5] Add find utility functions / exclude files from strip / reduce python Thomas De Schampheleire
2011-10-19  7:34 ` Thomas De Schampheleire [this message]
2011-10-19 22:32   ` [Buildroot] [PATCH 1 of 5] Makefile.package.in: add utility functions find*clauses and notfirstword Arnout Vandecappelle
2011-10-20  6:55     ` Thomas De Schampheleire
2011-10-19  7:34 ` [Buildroot] [PATCH 2 of 5] stripping: use findfileclauses utility function Thomas De Schampheleire
2011-10-19  7:34 ` [Buildroot] [PATCH 3 of 5] build: add option to exclude executables/dirs from being stripped Thomas De Schampheleire
2011-10-19  7:34 ` [Buildroot] [PATCH 4 of 5] python config: move configuration into menu Thomas De Schampheleire
2011-10-19  7:34 ` [Buildroot] [PATCH 5 of 5] python: allow reduced installation 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=31ae7a6eaff4e2cf9a1e.1318602116@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox