summaryrefslogtreecommitdiff
path: root/dmake/tests/misc-9
blob: c3f8aad1ab392f3896429f36c997d4832521448e (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
#!/bin/sh

# 01.03.2006 Volker Quetschke
# If a dependency is added to a target after it is already build as an
# indered .INCLUDE makefile the new dependency can be lost in parallel
# builds.
# (issue 61969)

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

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( $ -> \$ ).
cat > $file1 <<EOT
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

%.dpcc :
	@sleep 1
# The following line adds a dependency to %.obj when the %.dpcc is included
	@+echo \$@ : \$(@:b).obj > \$@

# This has to be build if mytarget.dpcc is included and is requested
# as a target
# Adding the wait makes sure that the unpatched dmake is ended before the
# next recipe line is started, therefore loosing it.
%.obj :
	@sleep 1
	@echo making: \$@

.INCLUDE : mytarget.dpcc

# Make this the main target
mytarget.dpcc :

EOT

output=`eval ${DMAKEPROG} -r -P2 -f $file1`
result=$?

if test "$output" != "making: mytarget.obj"; then
  result=1
fi 
 
test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
test $result -ne 0 && echo "Failure! Recipe line got lost."
exit $result