summaryrefslogtreecommitdiff
path: root/dmake/tests/macros-6
blob: 8119f2ae84bb812b73187d39a1919262b67d4eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

# 09.11.2006 Volker Quetschke
# Check that TMD honors if .SETDIR is used (with drive letters on cygwin)
# (issue 69821).

: ${DMAKEPROG:=dmake}
file1="mfile1.mk"
tmpfiles="$file1"

trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15

# Remove files from prior failed run
rm -rf $tmpfiles

# Remember to quote variables in generated makefiles( $ -> \$ ).
# Testcase 1
cat > $file1 <<EOT
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

.IMPORT .IGNORE : TEMP
.IF "\$(TEMP)"==""
TEMP:=/tmp
.ENDIF


# Test if .SETDIR works with drive letters
.IF "\$(subst,Cygwin, \$(shell @uname))"!="\$(shell @uname)"
SDIR:=\$(shell @+cygpath -d "\$(TEMP)")
.ELSE
SDIR:=\$(TEMP)
.ENDIF

# Make TEMP the target directory, cd to TMD should go back to
# the original directory
all ".SETDIR=\$(SDIR)" :
	@+cd \$(TMD); pwd

EOT


output1=`eval ${DMAKEPROG} -r -f $file1`
result1=$?

if test "$output1" != "`pwd`"; then
  echo "Test 1: Wrong result: ${output1}"
  result1=1
else
  echo "Test 1: OK"
fi

if test $result1 -eq 0; then
  echo "Success - Cleaning up"
  rm -rf $tmpfiles
exit
  result=0
else
  echo "Failure!"
  result=1
fi
exit $result