]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] am: implement $(am__tolower) and $(am__toupper)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 21 May 2012 21:15:31 +0000 (23:15 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 22 May 2012 11:44:19 +0000 (13:44 +0200)
These new make functions will be useful in future changes.

* lib/am/header-vars.am (am__toupper, am__tolower): New make functions.
* t/internals.tap: Test them.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
lib/am/header-vars.am
t/internals.tap

index 79dde9ca62e341e1d51363ff6096cadcaf4965fe..98a804252568123e945ae955fc9c46285adce037 100644 (file)
@@ -83,6 +83,22 @@ am__uniq = $(strip \
            $(am__empty), \
            $(lastword $(1)))))
 
+## These definitions have been generated by the following Bash 4 script:
+##
+##    #!/bin/bash
+##    toupper='$1' tolower='$1'
+##    for c in {a..z}; do
+##        C=${c^^}
+##        toupper="\$(subst $c,$C,$toupper)"
+##        tolower="\$(subst $C,$c,$tolower)"
+##    done
+##    echo "am__tolower = $tolower"
+##    echo "am__toupper = $toupper"
+
+am__tolower = $(subst Z,z,$(subst Y,y,$(subst X,x,$(subst W,w,$(subst V,v,$(subst U,u,$(subst T,t,$(subst S,s,$(subst R,r,$(subst Q,q,$(subst P,p,$(subst O,o,$(subst N,n,$(subst M,m,$(subst L,l,$(subst K,k,$(subst J,j,$(subst I,i,$(subst H,h,$(subst G,g,$(subst F,f,$(subst E,e,$(subst D,d,$(subst C,c,$(subst B,b,$(subst A,a,$1))))))))))))))))))))))))))
+
+am__toupper = $(subst z,Z,$(subst y,Y,$(subst x,X,$(subst w,W,$(subst v,V,$(subst u,U,$(subst t,T,$(subst s,S,$(subst r,R,$(subst q,Q,$(subst p,P,$(subst o,O,$(subst n,N,$(subst m,M,$(subst l,L,$(subst k,K,$(subst j,J,$(subst i,I,$(subst h,H,$(subst g,G,$(subst f,F,$(subst e,E,$(subst d,D,$(subst c,C,$(subst b,B,$(subst a,A,$1))))))))))))))))))))))))))
+
 ## Simple memoization for recursive make variables.  It is useful for
 ## situations where immediate variables can't be used (due, say, to
 ## ordering issues with the assignments of the referenced variables),
index f6ea954bdd30201ae9e81da497a269fa3de24c68..44b8912cedee62dac0779c5dbf171e46b77603b9 100755 (executable)
@@ -19,7 +19,7 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-plan_ 4
+plan_ 6
 
 cp "$am_amdir"/header-vars.am . \
   || fatal_ "fetching makefile fragment headers-vars.am"
@@ -34,6 +34,9 @@ rm -f header-vars.am
 cat > Makefile << 'END'
 include ./defn.mk
 
+lo = abcdefghijklmnopqrstuvwxyz
+up = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
 default:
        @echo Please select an explicit test; exit 1
 .PHONY: default
@@ -104,11 +107,50 @@ test-strip-suffixes:
              = 'foo.b bar'
        test '$(call am__strip_suffixes, .b.a .a, foo.b.a bar.a)' \
              = 'foo bar'
+
+.PHONY: test-tolower
+test-tolower:
+
+.PHONY: test-toupper
+test-toupper:
+       test '$(call am__toupper,a)'  = A
+       test '$(call am__toupper,A)'  = A
+       test '$(call am__toupper,aba)' = ABA
+       test '$(call am__toupper,a b)' = 'A B'
+       test '$(call am__toupper, a B)' = ' A B'
+       test '$(call am__toupper,Ab  )' = 'AB  '
+       test '$(call am__toupper,A       B c )' = 'A     B C '
+       test '$(call am__toupper,0)'  = 0
+       test '$(call am__toupper,0d)' = 0D
+       test '$(call am__toupper,@:&/?-)' = '@:&/?-'
+       test '$(call am__toupper,a@B)' = A@B
+       test '$(call am__toupper,zxzxzxZXZxzxzxzxzx)' = ZXZXZXZXZXZXZXZXZX
+       test '$(call am__toupper,$(lo))' = '$(up)'
+       test '$(call am__toupper,$(up))' = '$(up)'
+
+.PHONY: test-tolower
+test-tolower:
+       test '$(call am__tolower,A)'  = a
+       test '$(call am__tolower,a)'  = a
+       test '$(call am__tolower,ABA)' = aba
+       test '$(call am__tolower,A B)' = 'a b'
+       test '$(call am__tolower, A b)' = ' a b'
+       test '$(call am__tolower,aB  )' = 'ab  '
+       test '$(call am__tolower,a       b C )' = 'a     b c '
+       test '$(call am__tolower,0)'  = 0
+       test '$(call am__tolower,0D)' = 0d
+       test '$(call am__tolower,@:&/?-)' = '@:&/?-'
+       test '$(call am__tolower,a@B)' = a@b
+       test '$(call am__tolower,ZXZXZXzxzXZXZXZXZX)' = zxzxzxzxzxzxzxzxzx
+       test '$(call am__tolower,$(up))' = '$(lo)'
+       test '$(call am__tolower,$(lo))' = '$(lo)'
 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
 command_ok_  am__test_strip_suffixes    $MAKE test-strip-suffixes
+command_ok_  am__tolower                $MAKE test-tolower
+command_ok_  am__toupper                $MAKE test-toupper
 
 :