update dev300-m58
[ooovba.git] / dmake / tests / macros-7
blob2c7d0849172f329b747bae4788b7c965a8eb8f9c
1 #!/bin/sh
3 # 24.07.2007 Volker Quetschke
4 # Test the $(macro:n) macro extension.
5 # (issue 78776)
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 tmpfiles="$file1"
11 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
13 # Remove files from prior failed run
14 rm -rf $tmpfiles
16 # Remember to quote variables in generated makefiles( $ -> \$ ).
17 # Test 1 - Test if :n works.
18 cat > $file1 <<EOT
19 SHELL*:=/bin/sh
20 SHELLFLAGS*:=-ce
22 .WINPATH:=
24 MACRO:=/tmp/./a "/tmp/a b/xxx/../b" /tmp
26 all :
27 @echo 1\$(MACRO:n)1
28 EOT
30 output1=`eval ${DMAKEPROG} -r -f $file1`
31 result1=$?
32 if test "$output1" != "1/tmp/a \"/tmp/a b/b\" /tmp1"; then
33 echo "Subtest 1: Wrong result: $output1"
34 result1=1
35 else
36 echo "Subtest 1: OK"
37 fi
39 # Test 2 - Test if the .WINPATH setting is honored
40 cat > $file1 <<EOT
41 SHELL*:=/bin/sh
42 SHELLFLAGS*:=-ce
44 MACRO:=/tmp
46 all .WINPATH :
47 @echo 2\$(MACRO:n)2
49 EOT
51 output2=`eval ${DMAKEPROG} -r -f $file1`
52 result2=$?
53 if test x`uname -o 2> /dev/null` = "xCygwin"; then
54 if test "$output2" != "2`cygpath -m /tmp`2"; then
55 echo "Subtest 2: Wrong result: $output2"
56 result2=1
57 else
58 echo "Subtest 2: OK"
60 else
61 if test "$output2" != "2/tmp2"; then
62 echo "Subtest 2: Wrong result: $output2"
63 result2=1
64 else
65 echo "Subtest 2: OK"
70 if test $result1 -eq 0 -a $result2 -eq 0 ; then
71 echo "Success - Cleaning up" && rm -f ${tmpfiles}
72 exit
73 else
74 echo "Failure!"
75 exit 1