File: pattern_rule.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 (209 lines) | stat: -rw-r--r-- 3,996 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
###	SPAR <http://www.cpan.org/scripts/>
###	3	644	1181596243	1181903567	makepp_test_script.pl
eval { makepp 'abc.inaa' } and die;
eval { makepp 'a.xaa' } and die;
makepp;
###	92	644	1175559408	1374262865	Makeppfile
#
# This makeppfile tests pattern rules.
#

.PHONY: all

INFILES = abc def xyz

all: $(INFILES).out2 a.x b.x xyz.lc live.yoghurt abc.ina a.xa a.n

# Potential endless loop shall abort both based on files already existing and
# on ones to be discovered in the future.
%a: %
	&cp -l $(input) $(output)

# static pattern rule
a.x b.x : %.x : %.y
      &cat $^ -o $@

a.y b.y :
	&echo $@ -o $@

#
# A pattern rule that builds off another pattern rule, and also has
# two pattern dependencies:
#
%.out2: %.out %.in
	&echo $@ -o $@
	&cat $^ -o>>$@

#
# A pattern rule that overrides another pattern rule and embeds % in a function:
#
x%.out2: $(subst X,x,X%.out)
	&echo $@ -o $@
	&echo "(File $@ is another exception.)" -o>>$@
	&cat $^ -o>>$@

#
# GNU make style pattern rule.  Note that this tests using an alternate name
# for the directory.
#
%.out: ./%.in
	&echo $@ -o $@
	&cat $^ -o>>$@

#
# Another GNU make style pattern rule. Here the pattern is in the second dependency.
#
%.yoghurt: bacteria ./%.cream
	&echo $@ -o $@
	&cat $^ -o>>$@

#
# Pattern rule overridden by a explicit rule:
#
xyz.out: xyz.in subdir/percent_subdirs_test
	&echo $@ -o $@
	&echo "(File $@ is an exception.)" -o>>$@
	&cat $^ -o>>$@

#
# Do mixed case rules work, especially when not case sensitive?
#
%.Uc: %.in
	&cp -l $(input) $(output)

%.lc: %.Uc
	&cp -l $(input) $(output)

# Long chain, partially ordered forward, partially backward:
%.q: %.r
	&cp -l $(input) $(output)
%.p: %.q
	&cp -l $(input) $(output)
%.o: %.p
	&cp -l $(input) $(output)
%.n: %.o
	&cp -l $(input) $(output)

%.r: %.s
	&cp -l $(input) $(output)
%.s: %.t
	&cp -l $(input) $(output)
%.t: %.u
	&cp -l $(input) $(output)
%.u: %.v
	&cp -l $(input) $(output)
%.v: %.w
	&cp -l $(input) $(output)
%.w: %.x
	&cp -l $(input) $(output)
###	1	644	1175559408	965501121	abc.in
abc
###	1	644	1175559408	1175558557	bacteria
must be present for good live yoghurt
###	1	644	1175559408	965501124	def.in
def
###	1	644	1175559408	1175558557	live.cream
rich, creamy goodness
###	1	644	1175559408	965501136	xyz.in
xyz
###	D	755	1175559408	990032657	subdir/
###	12	644	1175559408	990032469	subdir/Makeppfile
#
# This file tests pattern rules with the percent_subdirs turned on, so
# the same rule applies to several subdirectories.
#
makepp_percent_subdirs = 1		# Allow % to refer to subdirectories, too.

%.out: %.in
	&echo $@ -o $@
	&cat $^ -o>>$@

percent_subdirs_test : **/*.out
	&cat $^ -o>>$@
###	24	644	1175559408	990032639	subdir/percent_subdirs_test
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
###	D	755	1175559408	990032657	subdir/suba/
###	1	644	1175559408	990031804	subdir/suba/a.in
a
###	D	755	1175559408	990032657	subdir/suba/subb/
###	1	644	1175559408	990031797	subdir/suba/subb/b.in
b
###	D	755	1175559408	990032657	subdir/subc/
###	1	644	1175559408	990031835	subdir/subc/c.in
c
###	D	755	1175559459	1175559461	answers/
###	1	444	1175559408	1104356247	answers/a.x
a.y
###	1	444	1175559408	1104356247	answers/a.y
a.y
###	1	444	1175559408	1104356247	answers/b.x
b.y
###	1	444	1175559408	1104356247	answers/b.y
b.y
###	3	644	1175559408	1175558694	answers/live.yoghurt
live.yoghurt
must be present for good live yoghurt
rich, creamy goodness
###	1	644	1175559408	1190053902	answers/n_files
29 1 0
###	1	444	1175559408	1104356247	answers/xyz.lc
xyz
###	35	664	1374263240	1374263240	answers/xyz.out2
xyz.out2
(File xyz.out2 is another exception.)
xyz.out
(File xyz.out is an exception.)
xyz
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c
suba/a.out
a
suba/subb/b.out
b
subc/c.out
c