automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, experimental/ng/var-simplif


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, experimental/ng/var-simplify, updated. v1.12-154-gc8bd8c4
Date: Thu, 03 May 2012 16:36:06 +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=c8bd8c4d01f9b6585613e411a27741e039c0b403

The branch, experimental/ng/var-simplify has been updated
       via  c8bd8c4d01f9b6585613e411a27741e039c0b403 (commit)
       via  7587b43430ac7f5b8a5bb24f92e1d2026584ca87 (commit)
      from  0e70726c993d7de62d37b7fedf904dfc18c31b74 (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 c8bd8c4d01f9b6585613e411a27741e039c0b403
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 18:34:09 2012 +0200

    general: some new internal macros and functions
    
    These will be useful in future changes and refactoring.
    
    * 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>

commit 7587b43430ac7f5b8a5bb24f92e1d2026584ca87
Author: Stefano Lattarini <address@hidden>
Date:   Thu May 3 17:30:56 2012 +0200

    dist: don't bother putting README first in $(DIST_COMMON)
    
    Comments on some of our automake-time pre-processing of $(DIST_COMMON)
    said that it was done in order to "put README first because it then
    becomes easier to make a Usenet-compliant shar file".  But such a
    format is hardly relevant anymore, and not worth the (albeit small)
    added complexity.
    
    * automake.in (handle_dist): Don't sort @dist_common.
    (for_dist_common): Delete this function, is not used anymore.
    * lib/am/distdir.am (DISTFILES): Remove obsolete comment.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

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

Summary of changes:
 automake.in           |   22 +-------------
 lib/am/distdir.am     |    1 -
 lib/am/header-vars.am |   29 +++++++++++++++++-
 t/internals.tap       |   81 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 23 deletions(-)
 create mode 100755 t/internals.tap

diff --git a/automake.in b/automake.in
index 79027ac..b9a54ae 100644
--- a/automake.in
+++ b/automake.in
@@ -3654,26 +3654,6 @@ sub user_phony_rule ($)
 }
 
 
-# $BOOLEAN
-# &for_dist_common ($A, $B)
-# -------------------------
-# Subroutine for &handle_dist: sort files to dist.
-#
-# We put README first because it then becomes easier to make a
-# Usenet-compliant shar file (in these, README must be first).
-#
-# FIXME: do more ordering of files here.
-sub for_dist_common
-{
-    return 0
-       if $a eq $b;
-    return -1
-       if $a eq 'README';
-    return 1
-       if $b eq 'README';
-    return $a cmp $b;
-}
-
 # handle_dist
 # -----------
 # Handle 'dist' target.
@@ -3784,7 +3764,7 @@ sub handle_dist ()
   # Files to distributed.  Don't use ->value_as_list_recursive
   # as it recursively expands '$(dist_pkgdata_DATA)' etc.
   my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
-  @dist_common = uniq (sort for_dist_common (@dist_common));
+  @dist_common = uniq @dist_common;
   variable_delete 'DIST_COMMON';
   define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
 
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index bb2d2a7..2c7307f 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -14,7 +14,6 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## DIST_COMMON comes first so that README can be the very first file.
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 
 if %?TOPDIR_P%
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]