File: recursive_make.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (93 lines) | stat: -rw-r--r-- 2,242 bytes parent folder | download | duplicates (3)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
###	SPAR <http://www.cpan.org/scripts/>
###	2	644	1236523730	1237488485	hint
This tests the old fashioned way of doing multi-directory builds.
A failure does not imply that the makepp-way of doing things is broken.
###	1	755	1067749983	1210350510	is_relevant.pl
!is_windows || is_windows == -1
###	10	755	1164320211	1190054144	makepp_test_script.pl
#
# A simple test of recursive make.
#
# Run the test twice.  We had some obscure bugs where recursive make
# didn't work the second time around, which this should catch correctly.
#
makepp;
n_files 'n_files_0';
makepp;
1;
###	33	644	1164353230	1291316814	RootMakeppfile
XVAR = 1			# Gets overridden on the command line.

.PHONY: all

all: a b f

%: subdir1/% : foreach subdir1/?	# foreach necessary to exclude Makefile.
	&cp $< $@

# Test passing a variable through the environment to recursive make.
subdir1/a subdir1/b:
	cd subdir1 && EVAR=evar $(MAKE) YVAR=2 XVAR=3 $(notdir $@)

subdir1/c: d
	&cat e -o $@
	&echo c -o>>$@

#
# Test waiting for recursive make to finish.
# This is a hack that will reexecute recursive make but won't change the file.
#
d:
	$(MAKE) e
	test -f d || touch d

e:
	&echo $@ $(XVAR) -o $@

load_makefile subdir2		# Test migration phase with explicit load and $(MAKE)

f: g
	X=x $(MAKE) -Csubdir2
	&cp subdir2/f
###	D	755	1067451878	1078122244	subdir1
###	13	644	1067451878	1291316867	subdir1/Makefile
a:
	&echo a $(EVAR) $(XVAR) -o $@

b: c
	&cat c -o $@
	&echo b $(YVAR) -o >>$@

#
# This should not override a rule in the upper level makefile, because it
# invokes recursive make.
#
c:
	cd .. && $(MAKE) subdir1/$@
###	D	755	1291315990	1291315990	subdir2
###	8	644	1291315990	1291316858	subdir2/Makefile
perl { $VAR = '' unless defined $VAR } # Ensure initial emptyness
VAR += foo			       # Reloading used to double this

f:
	&echo f -o $@

../g:
	&echo g $(VAR) -o $@
###	D	755	1067451878	1078122199	answers
###	1	644	1067451878	1291315433	answers/a
a evar 3
###	3	644	1067451878	978378259	answers/b
e 1
c
b 2
###	1	644	1067451878	978378259	answers/e
e 1
###	1	644	1291315990	1291316308	answers/f
f
###	1	644	1291315990	1291316308	answers/g
g foo
###	1	644	1067451878	1291317183	answers/n_files
3 1 0
###	1	644	1078122192	1190052203	answers/n_files_0
11 1 0