automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12-1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12-145-g112d08a
Date: Thu, 03 May 2012 19:03:09 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=112d08a3756cbaf10c9a662092e100a0c9245f71

The branch, ng/master has been updated
       via  112d08a3756cbaf10c9a662092e100a0c9245f71 (commit)
      from  ef009b57dddc63649988f86c218235f345123b11 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 112d08a3756cbaf10c9a662092e100a0c9245f71
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 18:34:09 2012 +0200

    [ng] general: some new internal macros and functions
    
    These will be useful in future changes and refactorings.
    
    * lib/am/header-vars.am (am__empty, am__lastword, am__firstword,
    am__strip_lastword, am__strip_firstword, am__uniq): New functions
    and macros.
    (am__make_dryrun): Fix a typo in the comments for this variable
    since we are at it.
    * t/internals.tap: New test.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 lib/am/header-vars.am |   29 +++++++++++++++++-
 t/internals.tap       |   81 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+), 1 deletions(-)
 create mode 100755 t/internals.tap

diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 40aa13f..a081639 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -37,7 +37,7 @@ am__vpath_rewrite = \
 ## would see a "make flag" equal to "nap" when analyzing $(MAKEFLAGS), and
 ## would wrongly misinterpret that as and indication that make is running
 ## in dry mode.  This has already happened in practice.  So we need the
-## hack with $(subst \, ...).
+## hack with $(subst \ , ...).
 am__make_dryrun := \
   $(strip $(if $(strip \
     $(foreach am__v, $(subst \ ,,$(strip $(MAKEFLAGS))), \
@@ -45,6 +45,33 @@ am__make_dryrun := \
         $(findstring n,$(am__v))))), \
     true, false))
 
+# An empty strings.  It only serves to make the code readable
+# in some places.
+am__empty :=
+
+# GNU make 3.80 lacks $(lastword).
+## FIXME: the best thing to do here is ts
+am__lastword = $(word $(words $(1)),$(1))
+
+am__strip_firstword = $(wordlist 2,$(words $(1)),$(1))
+am__strip_lastword  = $(wordlist 2,$(words $(1)),dummy $(1))
+
+## Remove repeated elements from the given list (without reordering),
+## and return the reduced list.
+am__uniq = $(strip \
+## If the list is empty, we have nothing to do.  Otherwise, go on.
+  $(if $(strip $(1)), \
+## Call the function recursively on the list of all the elements
+## but the last one.
+    $(call am__uniq, \
+      $(call am__strip_lastword, $(1))) \
+## And append the last element, unless it was already present.
+      $(if $(filter $(call am__lastword, $(1)), \
+                    $(call am__strip_lastword, $(1))), \
+           $(am__empty), \
+           $(call am__lastword,$(1)))))
+
+
 ## Some derived variables that have been found to be useful.
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
diff --git a/t/internals.tap b/t/internals.tap
new file mode 100755
index 0000000..6efc96f
--- /dev/null
+++ b/t/internals.tap
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test some generic Automake-provided internal macros and make functions.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+plan_ 3
+
+cp "$am_amdir"/header-vars.am . \
+  || fatal_ "fetching makefile fragment headers-vars.am"
+
+# Filter out Automake comments and things that would need configure
+# substitutions.
+LC_ALL=C $EGREP -v '(^##|address@hidden@)' header-vars.am > defn.mk
+rm -f header-vars.am
+
+cat > Makefile << 'END'
+include ./defn.mk
+
+default:
+       @echo Please select an explicit test; exit 1
+.PHONY: default
+
+.PHONY: test-strip-firstword
+test-strip-firstword:
+       test '$(call am__strip_firstword,)'                = ''
+       test '$(call am__strip_firstword,1)'               = ''
+       test '$(call am__strip_firstword,1 1)'             = '1'
+       test '$(call am__strip_firstword,1 2)'             = '2'
+       test '$(call am__strip_firstword,1 2 3 4 5 6 7 8)' = '2 3 4 5 6 7 8'
+       test '$(call am__strip_firstword,  1      2     )' = '2'
+
+.PHONY: test-strip-lastword
+test-strip-lastword:
+       test '$(call am__strip_lastword,)'                 = ''
+       test '$(call am__strip_lastword,1)'                = ''
+       test '$(call am__strip_lastword,1 1)'              = '1'
+       test '$(call am__strip_lastword,1 2)'              = '1'
+       test '$(call am__strip_lastword,1 2 3 4 5 6 7 8)'  = '1 2 3 4 5 6 7'
+       test '$(call am__strip_lastword,  1       2     )' = '1'
+
+.PHONY: test-uniq
+test-uniq:
+       test '$(call am__uniq,)'                = ''
+       test '$(call am__uniq,1)'               = '1'
+       test '$(call am__uniq,1 1)'             = '1'
+       test '$(call am__uniq,1 2)'             = '1 2'
+       test '$(call am__uniq,2 1)'             = '2 1'
+       test '$(call am__uniq,1 2 3)'           = '1 2 3'
+       test '$(call am__uniq,2 3 1)'           = '2 3 1'
+       test '$(call am__uniq,1 1 1)'           = '1'
+       test '$(call am__uniq,1 2 1)'           = '1 2'
+       test '$(call am__uniq,2 1 1)'           = '2 1'
+       test '$(call am__uniq,2 1 1)'           = '2 1'
+       test '$(call am__uniq,2 2 1)'           = '2 1'
+       test '$(call am__uniq,1 1 1 3 1 1 1)'   = '1 3'
+       test '$(call am__uniq,3 1 1 4 1 4 1 1)' = '3 1 4'
+       test '$(call am__uniq,  1   3   1  )'   = '1 3'
+
+END
+
+command_ok_ "am__strip_firstword" $MAKE test-strip-firstword
+command_ok_ "am__strip_lastword"  $MAKE test-strip-lastword
+command_ok_ "am__uniq"            $MAKE test-uniq
+
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]