update dev300-m58
[ooovba.git] / dmake / tests / targets-1
blob688c33cf024b65936517657f7701d87117c07bc8
1 #!/bin/sh
3 # 03.06.2006 Volker Quetschke
4 # Percent target definitions were not handled properly before.
5 # (issue 64869)
7 : ${DMAKEPROG:=dmake}
8 file1="mfile1.mk"
9 file2="mfile2.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 # Testcase 1 - This segfaulted before 4.5
19 cat > $file1 <<EOT
20 SHELL*:=/bin/sh
21 SHELLFLAGS*:=-ce
23 allnew : all
25 %.x all : %.c
26 +true $@
28 qqq.c :
29 +echo OK
31 EOT
33 # Testcase 2 - earlier than dmake 4.5 the second %-target was defined
34 # without the prerequisites, i.e. qqq.c was not build
35 cat > $file2 <<EOT
36 SHELL*:=/bin/sh
37 SHELLFLAGS*:=-ce
39 allnew : qqq.y
41 %.x %.y : %.c
42 +true "building %.y"
44 qqq.c :
45 +echo building qqq.c
47 EOT
49 output1=`eval ${DMAKEPROG} -r -f $file1 2>&1 `
50 result1=$?
51 output2=`eval ${DMAKEPROG} -r -f $file2 2>&1 `
52 result2=$?
54 if echo $output1 | grep 'Error: -- A non-%' > /dev/null 2>&1 ; then
55 #echo "Test 1: Right result: $output1"
56 result1=0
57 else
58 echo "Test 1: Wrong result: $output1"
59 echo
60 result1=1
63 if echo $output2 | grep -v 'building qqq.c' > /dev/null 2>&1 ; then
64 echo "Test 2: Wrong result: $output2"
65 echo
66 result2=1
69 if test $result1 -eq 0 -a $result2 -eq 0; then
70 echo "Success - Cleaning up"
71 rm -rf $tmpfiles
72 exit
73 result=0
74 else
75 echo "Failure!"
76 result=1
78 exit $result