Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / dmake / tests / macros-11
blob023b8a140e1d3d0553b0a145534a9397b7295abc
1 #!/bin/sh
3 # 26.08.2007 Volker Quetschke
4 # Test OOODMAKEMODE macro.
5 # (issue 74007)
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 file2="startup.mk"
10 tmpfiles="$file1 $file2"
12 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
14 # Remove files from prior failed run
15 rm -rf $tmpfiles
17 # Remember to quote variables in generated makefiles( $ -> \$ ).
18 # Test 1 - Without OOODMAKEMODE set strip leading ./
19 cat > $file1 <<EOT
20 SHELL*:=/bin/sh
21 SHELLFLAGS*:=-ce
23 #OOODMAKEMODE=
25 ./all :
26 @echo X\$@Y
27 EOT
29 output1=`eval ${DMAKEPROG} -r -f $file1`
30 result1=$?
31 if test $result1 = 0 -a "$output1" = "XallY" ; then
32 echo "Subtest 1: OK"
33 result1=0
34 else
35 echo "Subtest 1: Wrong result: $output1"
36 echo
37 result1=1
41 # Remember to quote variables in generated makefiles( $ -> \$ ).
42 # Test 2 - With OOODMAKEMODE=y do not strip leading ./
43 cat > $file1 <<EOT
44 SHELL*:=/bin/sh
45 SHELLFLAGS*:=-ce
47 OOODMAKEMODE:=y
49 ./all :
50 @echo X\$@Y
51 EOT
53 output2=`eval ${DMAKEPROG} -r -f $file1`
54 result2=$?
55 if test $result2 = 0 -a "$output2" = "X./allY" ; then
56 echo "Subtest 2: OK"
57 result2=0
58 else
59 echo "Subtest 2: Wrong result: $output2"
60 echo
61 result2=1
65 # Remember to quote variables in generated makefiles( $ -> \$ ).
66 # Test 3 - Test OOODMAKEMODE from environment.
67 cat > $file1 <<EOT
68 SHELL*:=/bin/sh
69 SHELLFLAGS*:=-ce
71 .IMPORT : OOODMAKEMODE
73 ./all :
74 @echo X\$@Y
75 EOT
77 output3=`eval OOODMAKEMODE=y ${DMAKEPROG} -r -f $file1`
78 result3=$?
79 if test $result3 = 0 -a "$output3" = "X./allY" ; then
80 echo "Subtest 3: OK"
81 result3=0
82 else
83 echo "Subtest 3: Wrong result: $output3"
84 echo
85 result3=1
89 # Remember to quote variables in generated makefiles( $ -> \$ ).
90 # Test 4 - With OOODMAKEMODE= leading ./
91 cat > $file1 <<EOT
92 SHELL*:=/bin/sh
93 SHELLFLAGS*:=-ce
95 OOODMAKEMODE:=
97 ./all :
98 @echo X\$@Y
99 EOT
101 output4=`eval ${DMAKEPROG} -r -f $file1`
102 result4=$?
103 if test $result4 = 0 -a "$output4" = "XallY" ; then
104 echo "Subtest 4: OK"
105 result4=0
106 else
107 echo "Subtest 4: Wrong result: $output4"
108 echo
109 result4=1
113 # Remember to quote variables in generated makefiles( $ -> \$ ).
114 # Test 5 - Import from environment / targets from command line.
115 cat > $file1 <<EOT
116 SHELL*:=/bin/sh
117 SHELLFLAGS*:=-ce
119 %target :
120 @echo X\$@Y
123 cat > $file2 <<EOT
124 .IMPORT : OOODMAKEMODE
127 output5=`eval DMAKEROOT=. OOODMAKEMODE=y ${DMAKEPROG} -f $file1 ./mytarget`
128 result5=$?
129 if test $result5 = 0 -a "$output5" = "X./mytargetY" ; then
130 echo "Subtest 5: OK"
131 result5=0
132 else
133 echo "Subtest 5: Wrong result: $output5"
134 echo
135 result5=1
139 if test $result1 -eq 0 -a $result2 -eq 0 \
140 -a $result3 -eq 0 -a $result4 -eq 0 \
141 -a $result5 -eq 0 ; then
142 echo "Success - Cleaning up" && rm -f ${tmpfiles}
143 exit
144 else
145 echo "Failure!"
146 exit 1