1 # $NetBSD: d_dotwait.mk,v 1.1 2012/03/17 16:33:14 jruoho Exp $
3 THISMAKEFILE
:= ${.PARSEDIR
}/${.PARSEFILE
}
5 TESTS
= simple recursive shared cycle
8 # Use a .for loop rather than dependencies here, to ensure
9 # that the tests are run one by one, with parallelism
11 # Ignore "--- target ---" lines printed by parallel make.
14 @
${.MAKE
} -f
${THISMAKEFILE} -j4
$t | grep
-v
"^--- "
18 # Within each test, the names of the sub-targets follow these
20 # * If it's expected that two or more targets may be made in parallel,
21 # then the target names will differ only in an alphabetic component
22 # such as ".a" or ".b".
23 # * If it's expected that two or more targets should be made in sequence
24 # then the target names will differ in numeric components, such that
25 # lexical ordering of the target names matches the expected order
26 # in which the targets should be made.
28 # Targets may echo ${PARALLEL_TARG} to print a modified version
29 # of their own name, in which alphabetic components like ".a" or ".b"
30 # are converted to ".*". Two targets that are expected to
31 # be made in parallel will thus print the same strings, so that the
32 # output is independent of the order in which these targets are made.
34 PARALLEL_TARG
= ${.TARGET
:C
/\.
[a-z
]/.
*/g
:Q
}
36 @echo
${PARALLEL_TARG}; ${PAUSE}; echo
${PARALLEL_TARG}
38 @echo
${PARALLEL_TARG}; ${PAUSE}; echo
${PARALLEL_TARG}
40 # simple: no recursion, no cycles
41 simple
: simple
.1 .WAIT simple
.2
43 # recursive: all children of the left hand side of the .WAIT
44 # must be made before any child of the right hand side.
45 recursive
: recursive
.1.99 .WAIT recursive
.2.99
46 recursive
.1.99: recursive
.1.1.a recursive
.1.1.b _ECHOUSE
47 recursive
.2.99: recursive
.2.1.a recursive
.2.1.b _ECHOUSE
49 # shared: both shared.1.99 and shared.2.99 depend on shared.0.
50 # shared.0 must be made first, even though it is a child of
51 # the right hand side of the .WAIT.
52 shared
: shared
.1.99 .WAIT shared
.2.99
53 shared
.1.99: shared
.0 _ECHOUSE
54 shared
.2.99: shared
.2.1 shared
.0 _ECHOUSE
56 # cycle: the cyclic dependency must not cause infinite recursion
57 # leading to stack overflow and a crash.
58 cycle
: cycle
.1.99 .WAIT cycle
.2.99
59 cycle
.2.99: cycle
.2.98 _ECHOUSE
60 cycle
.2.98: cycle
.2.97 _ECHOUSE
61 cycle
.2.97: cycle
.2.99 _ECHOUSE