Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests Replace use of $() with ${}



details:   https://anonhg.NetBSD.org/src/rev/72c67384e13c
branches:  trunk
changeset: 802057:72c67384e13c
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat Aug 30 22:21:07 2014 +0000

description:
Replace use of $() with ${}
$() means something special to the shell, so ${} reduces confusion
and is used almost exclusively in the rest of the makefiles.

Discussed with: christos

diffstat:

 usr.bin/make/unit-tests/impsrc.mk   |    6 +-
 usr.bin/make/unit-tests/posix1.exp  |  170 ++++++++++++++++++------------------
 usr.bin/make/unit-tests/posix1.mk   |  114 ++++++++++++------------
 usr.bin/make/unit-tests/suffixes.mk |   30 +++---
 usr.bin/make/unit-tests/sysv.mk     |    6 +-
 usr.bin/make/unit-tests/varmisc.mk  |    4 +-
 6 files changed, 165 insertions(+), 165 deletions(-)

diffs (truncated from 586 to 300 lines):

diff -r 02e63a412e23 -r 72c67384e13c usr.bin/make/unit-tests/impsrc.mk
--- a/usr.bin/make/unit-tests/impsrc.mk Sat Aug 30 22:05:30 2014 +0000
+++ b/usr.bin/make/unit-tests/impsrc.mk Sat Aug 30 22:21:07 2014 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: impsrc.mk,v 1.1 2014/08/23 15:05:40 christos Exp $
+# $NetBSD: impsrc.mk,v 1.2 2014/08/30 22:21:07 sjg Exp $
 
-# Does $(.IMPSRC) work properly?
-# It should be set, in order of precedence, to $(.TARGET) of:
+# Does ${.IMPSRC} work properly?
+# It should be set, in order of precedence, to ${.TARGET} of:
 #  1) the implied source of a transformation rule,
 #  2) the first prerequisite from the dependency line of an explicit rule, or
 #  3) the first prerequisite of an explicit rule.
diff -r 02e63a412e23 -r 72c67384e13c usr.bin/make/unit-tests/posix1.exp
--- a/usr.bin/make/unit-tests/posix1.exp        Sat Aug 30 22:05:30 2014 +0000
+++ b/usr.bin/make/unit-tests/posix1.exp        Sat Aug 30 22:21:07 2014 +0000
@@ -1,4 +1,4 @@
-$(VAR) = "foo  bar baz"
+${VAR} = "foo  bar baz"
 a
 b
 c
@@ -9,81 +9,81 @@
 printf '#include "obj_1.h"\nconst char* obj_1 = "dir/obj_1.c";\n' \
     >'dir/obj_1.c'
 Local variables
- $(@)="dir/obj_1.o" $(<)="dir/obj_1.c"
- $(*)="dir/obj_1" $(?)="dir/obj_1.h dir/obj_1.c"
- $(%)=""
+ ${@}="dir/obj_1.o" ${<}="dir/obj_1.c"
+ ${*}="dir/obj_1" ${?}="dir/obj_1.h dir/obj_1.c"
+ ${%}=""
 
 Directory and filename parts of local variables
- $(@D)="dir" $(@F)="obj_1.o"
- $(<D)="dir" $(<F)="obj_1.c"
- $(*D)="dir" $(*F)="obj_1"
- $(?D)="dir dir" $(?F)="obj_1.h obj_1.c"
- $(%D)="" $(%F)=""
+ ${@D}="dir" ${@F}="obj_1.o"
+ ${<D}="dir" ${<F}="obj_1.c"
+ ${*D}="dir" ${*F}="obj_1"
+ ${?D}="dir dir" ${?F}="obj_1.h obj_1.c"
+ ${%D}="" ${%F}=""
 
 Local variable substitutions
- $(@:.o=)="dir/obj_1" $(<:.c=.C)="dir/obj_1.C"
- $(*:=.h)="dir/obj_1.h" $(?:.h=.H)="dir/obj_1.H dir/obj_1.c"
- $(%:=)=""
+ ${@:.o=}="dir/obj_1" ${<:.c=.C}="dir/obj_1.C"
+ ${*:=.h}="dir/obj_1.h" ${?:.h=.H}="dir/obj_1.H dir/obj_1.c"
+ ${%:=}=""
 
 Target with suffix transformations
- $(@D:=append)="dirappend"
- $(@F:.o=.O)="obj_1.O"
+ ${@D:=append}="dirappend"
+ ${@F:.o=.O}="obj_1.O"
  
  Implied source with suffix transformations
- $(<D:r=rr)="dirr"
- $(<F:.c=.C)="obj_1.C"
+ ${<D:r=rr}="dirr"
+ ${<F:.c=.C}="obj_1.C"
  
  Suffixless target with suffix transformations
- $(*D:.=dot)="dir"
- $(*F:.a=)="obj_1"
+ ${*D:.=dot}="dir"
+ ${*F:.a=}="obj_1"
  
  Out-of-date dependencies with suffix transformations
- $(?D:ir=)="d d"
- $(?F:.h=.H)="obj_1.H obj_1.c"
+ ${?D:ir=}="d d"
+ ${?F:.h=.H}="obj_1.H obj_1.c"
  
  Member with suffix transformations
- $(%D:.=)=""
- $(%F:$(VAR2)=$(VAR))=""
+ ${%D:.=}=""
+ ${%F:${VAR2}=${VAR}}=""
 
 cc -c -o 'dir/obj_1.o' 'dir/obj_1.c'
 mkdir -p '.'
 touch 'dummy'
 Local variables
- $(@)="lib.a" $(<)="dir/obj_1.o"
- $(*)="obj1" $(?)="dir/obj_1.o dummy"
- $(%)="obj1.o"
+ ${@}="lib.a" ${<}="dir/obj_1.o"
+ ${*}="obj1" ${?}="dir/obj_1.o dummy"
+ ${%}="obj1.o"
 
 Directory and filename parts of local variables
- $(@D)="." $(@F)="lib.a"
- $(<D)="dir" $(<F)="obj_1.o"
- $(*D)="." $(*F)="obj1"
- $(?D)="dir ." $(?F)="obj_1.o dummy"
- $(%D)="." $(%F)="obj1.o"
+ ${@D}="." ${@F}="lib.a"
+ ${<D}="dir" ${<F}="obj_1.o"
+ ${*D}="." ${*F}="obj1"
+ ${?D}="dir ." ${?F}="obj_1.o dummy"
+ ${%D}="." ${%F}="obj1.o"
 
 Local variable substitutions
- $(@:.o=)="lib.a" $(<:.c=.C)="dir/obj_1.o"
- $(*:=.h)="obj1.h" $(?:.h=.H)="dir/obj_1.o dummy"
- $(%:=)="obj1.o"
+ ${@:.o=}="lib.a" ${<:.c=.C}="dir/obj_1.o"
+ ${*:=.h}="obj1.h" ${?:.h=.H}="dir/obj_1.o dummy"
+ ${%:=}="obj1.o"
 
 Target with suffix transformations
- $(@D:=append)=".append"
- $(@F:.o=.O)="lib.a"
+ ${@D:=append}=".append"
+ ${@F:.o=.O}="lib.a"
  
  Implied source with suffix transformations
- $(<D:r=rr)="dirr"
- $(<F:.c=.C)="obj_1.o"
+ ${<D:r=rr}="dirr"
+ ${<F:.c=.C}="obj_1.o"
  
  Suffixless target with suffix transformations
- $(*D:.=dot)="dot"
- $(*F:.a=)="obj1"
+ ${*D:.=dot}="dot"
+ ${*F:.a=}="obj1"
  
  Out-of-date dependencies with suffix transformations
- $(?D:ir=)="d ."
- $(?F:.h=.H)="obj_1.o dummy"
+ ${?D:ir=}="d ."
+ ${?F:.h=.H}="obj_1.o dummy"
  
  Member with suffix transformations
- $(%D:.=)=""
- $(%F:$(VAR2)=$(VAR))="obj1foo  bar baz"
+ ${%D:.=}=""
+ ${%F:${VAR2}=${VAR}}="obj1foo  bar baz"
 
 cp 'dir/obj_1.o' 'obj1.o'
 ar -rcv 'lib.a' 'obj1.o'
@@ -95,41 +95,41 @@
 mkdir -p '.'
 touch 'obj_2.h'
 Local variables
- $(@)="obj2.o" $(<)="obj_2.c"
- $(*)="obj2" $(?)="obj_2.c obj_2.h dir/obj_1.h"
- $(%)=""
+ ${@}="obj2.o" ${<}="obj_2.c"
+ ${*}="obj2" ${?}="obj_2.c obj_2.h dir/obj_1.h"
+ ${%}=""
 
 Directory and filename parts of local variables
- $(@D)="." $(@F)="obj2.o"
- $(<D)="." $(<F)="obj_2.c"
- $(*D)="." $(*F)="obj2"
- $(?D)=". . dir" $(?F)="obj_2.c obj_2.h obj_1.h"
- $(%D)="" $(%F)=""
+ ${@D}="." ${@F}="obj2.o"
+ ${<D}="." ${<F}="obj_2.c"
+ ${*D}="." ${*F}="obj2"
+ ${?D}=". . dir" ${?F}="obj_2.c obj_2.h obj_1.h"
+ ${%D}="" ${%F}=""
 
 Local variable substitutions
- $(@:.o=)="obj2" $(<:.c=.C)="obj_2.C"
- $(*:=.h)="obj2.h" $(?:.h=.H)="obj_2.c obj_2.H dir/obj_1.H"
- $(%:=)=""
+ ${@:.o=}="obj2" ${<:.c=.C}="obj_2.C"
+ ${*:=.h}="obj2.h" ${?:.h=.H}="obj_2.c obj_2.H dir/obj_1.H"
+ ${%:=}=""
 
 Target with suffix transformations
- $(@D:=append)=".append"
- $(@F:.o=.O)="obj2.O"
+ ${@D:=append}=".append"
+ ${@F:.o=.O}="obj2.O"
  
  Implied source with suffix transformations
- $(<D:r=rr)="."
- $(<F:.c=.C)="obj_2.C"
+ ${<D:r=rr}="."
+ ${<F:.c=.C}="obj_2.C"
  
  Suffixless target with suffix transformations
- $(*D:.=dot)="dot"
- $(*F:.a=)="obj2"
+ ${*D:.=dot}="dot"
+ ${*F:.a=}="obj2"
  
  Out-of-date dependencies with suffix transformations
- $(?D:ir=)=". . d"
- $(?F:.h=.H)="obj_2.c obj_2.H obj_1.H"
+ ${?D:ir=}=". . d"
+ ${?F:.h=.H}="obj_2.c obj_2.H obj_1.H"
  
  Member with suffix transformations
- $(%D:.=)=""
- $(%F:$(VAR2)=$(VAR))=""
+ ${%D:.=}=""
+ ${%F:${VAR2}=${VAR}}=""
 
 cc -c -o 'obj2.o' 'obj_2.c'
 ar -rcv 'lib.a' 'obj2.o'
@@ -142,41 +142,41 @@
 printf '#include "obj3.h"\nconst char* obj3 = "obj3.c";\n' \
     >'obj3.c'
 Local variables
- $(@)="lib.a" $(<)="obj3.c"
- $(*)="obj3" $(?)="obj3.h dir/dummy obj3.c"
- $(%)="obj3.o"
+ ${@}="lib.a" ${<}="obj3.c"
+ ${*}="obj3" ${?}="obj3.h dir/dummy obj3.c"
+ ${%}="obj3.o"
 
 Directory and filename parts of local variables
- $(@D)="." $(@F)="lib.a"
- $(<D)="." $(<F)="obj3.c"
- $(*D)="." $(*F)="obj3"
- $(?D)=". dir ." $(?F)="obj3.h dummy obj3.c"
- $(%D)="." $(%F)="obj3.o"
+ ${@D}="." ${@F}="lib.a"
+ ${<D}="." ${<F}="obj3.c"
+ ${*D}="." ${*F}="obj3"
+ ${?D}=". dir ." ${?F}="obj3.h dummy obj3.c"
+ ${%D}="." ${%F}="obj3.o"
 
 Local variable substitutions
- $(@:.o=)="lib.a" $(<:.c=.C)="obj3.C"
- $(*:=.h)="obj3.h" $(?:.h=.H)="obj3.H dir/dummy obj3.c"
- $(%:=)="obj3.o"
+ ${@:.o=}="lib.a" ${<:.c=.C}="obj3.C"
+ ${*:=.h}="obj3.h" ${?:.h=.H}="obj3.H dir/dummy obj3.c"
+ ${%:=}="obj3.o"
 
 Target with suffix transformations
- $(@D:=append)=".append"
- $(@F:.o=.O)="lib.a"
+ ${@D:=append}=".append"
+ ${@F:.o=.O}="lib.a"
  
  Implied source with suffix transformations
- $(<D:r=rr)="."
- $(<F:.c=.C)="obj3.C"
+ ${<D:r=rr}="."
+ ${<F:.c=.C}="obj3.C"
  
  Suffixless target with suffix transformations
- $(*D:.=dot)="dot"
- $(*F:.a=)="obj3"
+ ${*D:.=dot}="dot"
+ ${*F:.a=}="obj3"
  
  Out-of-date dependencies with suffix transformations
- $(?D:ir=)=". d ."
- $(?F:.h=.H)="obj3.H dummy obj3.c"
+ ${?D:ir=}=". d ."
+ ${?F:.h=.H}="obj3.H dummy obj3.c"
  
  Member with suffix transformations
- $(%D:.=)=""
- $(%F:$(VAR2)=$(VAR))="obj3foo  bar baz"
+ ${%D:.=}=""
+ ${%F:${VAR2}=${VAR}}="obj3foo  bar baz"
 
 cc -c -o 'obj3.o' 'obj3.c'
 ar -rcv 'lib.a' 'obj3.o'
diff -r 02e63a412e23 -r 72c67384e13c usr.bin/make/unit-tests/posix1.mk
--- a/usr.bin/make/unit-tests/posix1.mk Sat Aug 30 22:05:30 2014 +0000
+++ b/usr.bin/make/unit-tests/posix1.mk Sat Aug 30 22:21:07 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: posix1.mk,v 1.2 2014/08/29 15:55:44 sjg Exp $
+# $NetBSD: posix1.mk,v 1.3 2014/08/30 22:21:08 sjg Exp $
 
 # Keep the default suffixes from interfering, just in case.
 .SUFFIXES:
@@ -19,7 +19,7 @@
 # are retained, but a single leading tab (if any) from the next line is
 # removed. (PR 49085)
 # Expect:
-# $(VAR) = "foo  bar baz"
+# ${VAR} = "foo  bar baz"
 # a
 # b
 # c
@@ -29,7 +29,7 @@
  baz
 
 line-continuations:
-       @echo '$$(VAR) = "$(VAR)"'
+       @echo '$${VAR} = "${VAR}"'
        @echo 'aXbXc' | sed -e 's/X/\
        /g'
 



Home | Main Index | Thread Index | Old Index