aboutsummaryrefslogtreecommitdiff
path: root/testsuite/make.tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtestsuite/make.tests805
1 files changed, 805 insertions, 0 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests
new file mode 100755
index 000000000..fabdbe45c
--- /dev/null
+++ b/testsuite/make.tests
@@ -0,0 +1,805 @@
1#!/bin/sh
2
3. ./testing.sh
4unset MAKEFLAGS
5rm -rf make.tempdir
6
7# testing "test name" "command" "expected result" "file input" "stdin"
8
9testing "make basic makefile" \
10 "make -f -" "target\n" "" '
11target:
12 @echo target
13'
14
15testing "make .DEFAULT rule for prerequisite" \
16 "make -f - 2>/dev/null" "source\n" "" '
17.DEFAULT:
18 @echo $@
19target: source
20'
21
22mkdir make.tempdir && cd make.tempdir || exit 1
23touch target.xyz
24testing "make empty command overrides inference rule" \
25 "make -f - target 2>/dev/null" "" "" '
26.SUFFIXES: .xyz
27.xyz:
28 @echo xyz
29target: ;
30'
31cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
32
33# Macros should be expanded before suffix substitution. The suffixes
34# can be obtained by macro expansion.
35testing "make macro expansion and suffix substitution" \
36 "make -f -" "src1.o src2.o\n" "" '
37DOTC = .c
38DOTO = .o
39SRC1 = src1.c
40SRCS = $(SRC1) src2.c
41target:
42 @echo $(SRCS:$(DOTC)=$(DOTO))
43'
44
45# Indeed, everything after the <colon> can be obtained by macro
46# macro expansion.
47testing "make macro expansion and suffix substitution 2" \
48 "make -f -" "src1.o src2.o\n" "" '
49DOTS = .c=.o
50SRC1 = src1.c
51SRCS = $(SRC1) src2.c
52target:
53 @echo $(SRCS:$(DOTS))
54'
55
56# It should be possible for an inference rule to determine that a
57# prerequisite can be created using an explicit rule.
58mkdir make.tempdir && cd make.tempdir || exit 1
59testing "make inference rule with explicit rule for prerequisite" \
60 "make -f -" "touch x.p\ncat x.p >x.q\n" "" '
61.SUFFIXES: .p .q
62x.q:
63x.p:
64 touch $@
65.p.q:
66 cat $< >$@
67'
68cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
69
70# Austin Group defect report 875 clarifies certain aspects of the
71# behaviour of inference rules. Study of this resulted in a number
72# of changes to pdpmake, though this test passed anyway.
73mkdir make.tempdir && cd make.tempdir || exit 1
74touch test.j test.k
75testing "make proper handling of inference rules 1" \
76 "make -f -" \
77 ".j.l\n" "" '
78.SUFFIXES: .j .k .l
79.j.l:
80 @echo .j.l
81.k.l:
82 @echo .k.l
83test.l: test.k
84test.j:
85test.k:
86'
87cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
88
89# Check that single-suffix inference rules work.
90mkdir make.tempdir && cd make.tempdir || exit 1
91touch test.sh
92testing "make single-suffix inference rule works" \
93 "make -f - -s; echo $?" \
94 "0\n" "" '
95test:
96'
97cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
98
99# There was a bug where the failure of a build command didn't result
100# in make returning a non-zero exit status.
101testing "make return error if command fails" \
102 "make -f - >/dev/null 2>&1; test \$? -gt 0 && echo OK" "OK\n" "" '
103target:
104 @exit 42
105'
106
107# An equal sign in a command on a target rule was detected as a
108# macro assignment.
109testing "make equal sign in inline command" \
110 "make -f -" "a = a\n" "" '
111a = a
112target:;@echo a = $(a)
113'
114
115# Ensure an inline command on a target rule can be detected even if
116# the semicolon is obfuscated.
117testing "make equal sign in obfuscated inline command" \
118 "make -f -" "a = a\n" "" '
119a = a
120semi = ;
121target:$(semi)@echo a = $(a)
122'
123
124# When a build command fails and the '-k' option has been provided
125# (continue execution on error) no further commands should be executed
126# for the current target.
127testing "make failure of build command with -k" \
128 "make -k -f - 2>/dev/null" "OK\n" "" '
129all: bar baz
130bar:
131 @echo OK
132 @false
133 @echo Not reached
134baz:
135 @:
136'
137# Build commands with a '+' prefix are executed even with the -q option.
138testing "make execute build command with + prefix and -q" \
139 "make -q -f - 2>/dev/null" "OK\n" "" '
140all: bar
141bar:
142 @+echo OK
143'
144
145# The -t option touches files that are out-of-date unless the target
146# has no commands or they're already up-to-date.
147mkdir make.tempdir && cd make.tempdir || exit 1
148touch baz
149testing "make check -t option" \
150 "make -t -f - 2>/dev/null" "touch bar\n" "" '
151all: foo bar baz
152foo:
153bar:
154 @echo bar
155baz:
156 @echo baz
157'
158cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
159
160# Build commands with a '+' prefix are executed even with the -t option.
161mkdir make.tempdir && cd make.tempdir || exit 1
162testing "make execute build command with + prefix and -t" \
163 "make -t -f - 2>/dev/null" "OK\n" "" '
164all: bar
165bar:
166 @+echo OK
167'
168cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
169
170# A macro created using ::= remembers it's of type immediate-expansion.
171# Immediate expansion also occurs when += is used to append to such a macro.
172testing "make appending to immediate-expansion macro" \
173 "make -f -" \
174 "hello 1 2 3\nhello 4 4\n" "" '
175world = 1
176hello ::= hello $(world)
177world = 2
178hello += $(world)
179world = 3
180hello += $(world)
181world = 4
182
183world = 1
184reset ::= hello $(world)
185world = 2
186# No longer immediate-expansion
187reset = hello $(world)
188world = 3
189reset += $(world)
190world = 4
191
192target:
193 @echo $(hello)
194 @echo $(reset)
195'
196
197# Since GNU make and bmake interpret := macro assignments differently,
198# POSIX has ::= for the GNU variant and :::= for BSD.
199testing "make different styles of := macro assignment" \
200 "make -f -" \
201 '65 a a $A\n' "" '
202A = a
203GNU ::= $A
204BSD1 :::= $A
205BSD2 :::= $$A
206A = 65
207
208target:
209 @echo '\''$(A) $(GNU) $(BSD1) $(BSD2)'\''
210'
211
212# Similar to the above but for macro assignments on the command line.
213# POSIX has ::= for the GNU variant and :::= for BSD.
214testing "make := macro assignment on command line" \
215 "make -f - A=a 'GNU::=\$A' 'BSD1:::=\$A' 'BSD2:::=\$\$A' A=65" \
216 '65 a a $A\n' "" '
217target:
218 @echo '\''$(A) $(GNU) $(BSD1) $(BSD2)'\''
219'
220
221# basic pattern macro expansion
222testing "make basic pattern macro expansion" \
223 "make -f -" \
224 "obj/util.o obj/main.o\n" "" '
225SRC = src/util.c src/main.c
226OBJ = $(SRC:src/%.c=obj/%.o)
227
228target:
229 @echo $(OBJ)
230'
231
232# pattern macro expansion; match any value
233testing "make pattern macro expansion; match any value" \
234 "make -f -" \
235 "any_value.o\n" "" '
236SRC = any_value
237OBJ = $(SRC:%=%.o)
238
239target:
240 @echo $(OBJ)
241'
242
243# pattern macro expansion with empty rvalue
244testing "make pattern macro expansion with empty rvalue" \
245 "make -f -" \
246 "\n" "" '
247SRC = util.c main.c
248OBJ = $(SRC:%.c=)
249
250target:
251 @echo $(OBJ)
252'
253
254# pattern macro expansion with multiple <percent> in rvalue
255# POSIX requires the first <percent> to be expanded, others
256# may or may not be expanded. Permit either case.
257testing "make pattern macro expansion with multiple <percent> in rvalue" \
258 "make -f - | sed 's/mainmainmain/main%%/'" \
259 "main%%\n" "" '
260SRC = main.c
261OBJ = $(SRC:%.c=%%%)
262
263target:
264 @echo $(OBJ)
265'
266
267# pattern macro expansion; zero match
268testing "make pattern macro expansion; zero match" \
269 "make -f -" \
270 "nsnp\n" "" '
271WORD = osop
272REPL = $(WORD:os%op=ns%np)
273
274target:
275 @echo $(REPL)
276'
277
278# Check that MAKE will contain argv[0], e.g make in this case
279testing "make basic MAKE macro expansion" \
280 "make -f -" \
281 "make\n" "" '
282target:
283 @echo $(MAKE)
284'
285
286# Check that MAKE defined as environment variable will overwrite default MAKE
287testing "make MAKE macro expansion; overwrite with env macro" \
288 "MAKE=hello make -f -" \
289 "hello\n" "" '
290target:
291 @echo $(MAKE)
292'
293
294# Check that MAKE defined on the command-line will overwrite MAKE defined in
295# Makefile
296testing "make MAKE macro expansion; overwrite with command-line macro" \
297 "make -f - MAKE=hello" \
298 "hello\n" "" '
299MAKE = test
300
301target:
302 @echo $(MAKE)
303'
304
305# POSIX draft states that if make was invoked using relative path, MAKE must
306# contain absolute path, not just argv[0]
307testing "make MAKE macro expansion; turn relative path into absolute" \
308 "../runtest-tempdir-links/make -f -" \
309 "ok\n" "" '
310target:
311 @test -e "$(MAKE)" && test "$(MAKE)" = "$$(env which make)" && echo ok
312'
313
314# $? contains prerequisites newer than target, file2 in this case
315# $^ has all prerequisites, file1 and file2
316touch -t 202206171200 file1
317touch -t 202206171201 target
318touch -t 202206171202 file2
319testing "make compare \$? and \$^ internal macros" \
320 "make -f -" \
321 "file2\nfile1 file2\n" "" '
322target: file1 file2
323 @echo $?
324 @echo $^
325'
326rm -f target file1 file2
327
328# Phony targets are executed (once) even if a matching file exists.
329# A .PHONY target with no prerequisites is ignored.
330touch -t 202206171201 target
331testing "make phony target" \
332 "make -f -" \
333 "phony\n" "" '
334.PHONY: target
335.PHONY:
336target:
337 @echo phony
338'
339rm -f target
340
341# Phony targets aren't touched with -t
342testing "make phony target not touched" \
343 "make -t -f - >/dev/null && test -f target && echo target" \
344 "" "" '
345.PHONY: target
346target:
347 @:
348'
349rm -f target
350
351# Include files are created or brought up-to-date
352mkdir make.tempdir && cd make.tempdir || exit 1
353testing "make create include file" \
354 "make -f -" \
355 "made\n" "" '
356target:
357 @echo $(VAR)
358mk:
359 @echo "VAR = made" >mk
360include mk
361'
362cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
363
364# Include files are created or brought up-to-date even when the -n
365# option is given.
366mkdir make.tempdir && cd make.tempdir || exit 1
367testing "make create include file even with -n" \
368 "make -n -f -" \
369 "echo made\n" "" '
370target:
371 @echo $(VAR)
372mk:
373 @echo "VAR = made" >mk
374include mk
375'
376cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
377
378# Failure to create an include file isn't an error. (Provided the
379# include line is ignoring non-existent files.)
380testing "make failure to create include file is OK" \
381 "make -f -" \
382 "OK\n" "" '
383target:
384 @echo OK
385mk:
386 @:
387-include mk
388'
389
390# $^ skips duplicate prerequisites, $+ doesn't
391mkdir make.tempdir && cd make.tempdir || exit 1
392touch file1 file2 file3
393testing "make skip duplicate entries in \$^ but not \$+" \
394 "make -f -" \
395 "file1 file2 file3\nfile1 file2 file2 file3 file3\n" "" '
396target: file1 file2 file2 file3 file3
397 @echo $^
398 @echo $+
399'
400cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
401
402# Assign the output of a shell command to a macro.
403testing "make shell assignment" \
404 "make -f -" \
405 "1 2 3 4\n" "" '
406hello != echo 1; echo 2; echo 3; echo; echo
407
408target:
409 @echo "$(hello) 4"
410'
411
412# Nested macro expansion is allowed. This should be compatible
413# with other implementations.
414testing "make nested macro expansion" \
415 "make -f -" "0 bc\n1 d\n2\n3\n4 bcd\n5 bcd\n" "" '
416a = b
417b = c
418c = d
419$(a:.q=.v)$(b:.z=.v) = bc
420bcd = bcd
421target:
422 @echo 0 $(bc)
423 @echo 1 $($($(a)))
424 @echo 2 $($(a) $(b) $(c))
425 @echo 3 $($a $b $c)
426 @echo 4 $($(a)$(b)$(c))
427 @echo 5 $($a$b$c)
428'
429
430# .WAIT is allowed as a prerequisite. Since parallel builds aren't
431# implemented it doesn't have any effect.
432mkdir make.tempdir && cd make.tempdir || exit 1
433touch file1 file2
434testing "make .WAIT is allowed as a prerequisite" \
435 "make -f -" \
436 "file1 file2\n" "" '
437target: file1 .WAIT file2
438 @echo $?
439'
440cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
441
442# Escaped newlines inside macro expansions in commands get different
443# treatment than those outside. In POSIX 2017 the output is 'a b ab'.
444testing "make replace escaped NL in macro in command with space" \
445 "make -f -" \
446 "a b a b\n" "" '
447M=word
448N=${M:word=a\\
449b}
450target:
451 @echo ${N} ${M:word=a\\
452b}
453'
454
455# The CURDIR macro is supported in POSIX 2024.
456testing "make CURDIR macro" \
457 "make -f -" \
458 "OK\n" "" '
459target:
460 @test "$(CURDIR)" = "$$(pwd -P)" && echo OK
461'
462# The CURDIR environment variable doesn't affect the macro
463export CURDIR=/you/are/here
464testing "make CURDIR macro not affected by environment" \
465 "make -f -" \
466 "OK\n" "" '
467target:
468 @test "$(CURDIR)" != "/you/are/here" && echo OK
469'
470
471# The -e option makes the CURDIR macro match the environment
472testing "make with -e CURDIR macro is affected by the environment" \
473 "make -e -f -" \
474 "/you/are/here\n" "" '
475target:
476 @echo $(CURDIR)
477'
478unset CURDIR
479
480# The fix for an equal sign in an inline command on a target rule broke
481# a complex chain of macro assignments generated by autotools.
482testing "make complex chain of macro assignments" \
483 "make -f -" "flag 1\n" "" '
484FLAG_ = $(FLAG_$(VALUE))
485FLAG_0 = flag 0
486FLAG_1 = flag 1
487MYFLAG = $(FLAG_$(VALUE))
488VALUE = 1
489
490target:
491 @echo $(MYFLAG)
492'
493
494# POSIX 2024 permits additional characters in macro and target names
495testing "make allow - and / in target names, - in macro names" \
496 "make -f -" \
497 "/hello\nhel-lo\nmac-ro\n" "" '
498target: ./hello hel-lo
499 @echo $(mac-ro)
500./hello:
501 @echo /hello
502hel-lo:
503 @echo hel-lo
504mac-ro = mac-ro
505'
506
507testing "make double-colon rule" \
508 "make -f -" "target1\ntarget2\n" "" '
509target::
510 @echo target1
511target::
512 @echo target2
513'
514
515# There was a bug whereby the modification time of a file created by
516# double-colon rules wasn't correctly updated. This test checks that
517# the bug is now fixed.
518mkdir make.tempdir && cd make.tempdir || exit 1
519touch -t 202206171200 file1
520touch -t 202206171201 intermediate
521touch -t 202206171202 target
522touch -t 202206171203 file2
523testing "make target depends on prerequisite updated by double-colon rule" \
524 "make -f -" \
525 "file2\n" "" '
526target: intermediate
527 @cat intermediate
528intermediate:: file1
529 @echo file1 >>intermediate
530intermediate:: file2
531 @echo file2 >>intermediate
532'
533cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
534
535# Use chained inference rules to determine prerequisites.
536mkdir make.tempdir && cd make.tempdir || exit 1
537touch target.p
538testing "make chained inference rules" \
539 "make -s -f - target.s" \
540 "target.q\ntarget.r\ntarget.s\n" "" '
541.SUFFIXES: .p .q .r .s
542.p.q:
543 @cp $< $*.q
544 @echo $*.q
545.q.r:
546 @cp $< $*.r
547 @echo $*.r
548.r.s:
549 @cp $< $*.s
550 @echo $*.s
551'
552cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
553
554# Suffixes with multiple periods are supported
555mkdir make.tempdir && cd make.tempdir || exit 1
556touch x.c.c
557testing "make support multi-period suffixes" \
558 "make -f -" "cat x.c.c >x.o.o\nx\n" "" '
559.SUFFIXES: .c.c .o.o
560x.o.o:
561.c.c.o.o:
562 cat $< >$@
563 @echo $*
564'
565cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
566
567# Suffixes with no periods are supported
568mkdir make.tempdir && cd make.tempdir || exit 1
569touch filex
570testing "make support suffixes without any periods" \
571 "make -f -" "cp filex fileh\nfile\ncp filex filez\nfile\n" "" '
572.SUFFIXES: x h z
573all: fileh filez
574fileh:
575filez: filex
576 cp filex filez
577 @echo $*
578xh:
579 cp $< $@
580 @echo $*
581'
582cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
583
584# make supports *, ? and [] wildcards in targets and prerequisites
585mkdir make.tempdir && cd make.tempdir || exit 1
586touch -t 202206171201 t1a t2aa t3b
587touch s1a s2aa s3b
588testing "make expand wildcards in filenames" \
589 "make -f - t1a t2aa t3b" \
590 "t1a s1a s2aa s3b\nt2aa s1a s2aa s3b\nt3b s1a s2aa s3b\n" "" '
591t1? t2* t3[abc]: s1? s2* s3[abc]
592 @echo $@ $?
593'
594cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
595
596# A '#' character in a macro expansion doesn't start a comment
597testing "make hash in macro expansion isn't a comment" \
598 "make -f -" \
599 ": hash # hash\n" "" '
600HASH = hash
601hash = $(HASH:hash=#)
602target:
603 : hash $(hash) hash
604'
605
606# A '#' character can be escaped with a backslash
607testing "make backslash-escaped hash isn't a comment" \
608 "make -f -" \
609 ": hash # hash\n" "" '
610hash = \\#
611target:
612 : hash $(hash) hash
613'
614
615# A '#' character in a command line doesn't start a comment
616testing "make hash in command line isn't a comment" \
617 "make -f -" \
618 ": hash # hash\n" "" '
619target:
620 : hash # hash
621'
622
623# Austin Group defect report 875 (mentioned above) actually used
624# suffixes '.a .b .c'. This doesn't matter in POSIX mode but it
625# caused a failure (now fixed) when chained inference rules were
626# allowed. The '.a.c' and the built-in '.c.a' inference rules
627# resulted in a loop.
628mkdir make.tempdir && cd make.tempdir || exit 1
629touch test.a test.b
630testing "make proper handling of inference rules 2" \
631 "make -f -" \
632 ".a.c\n" "" '
633.SUFFIXES: .a .b .c
634.a.c:
635 @echo .a.c
636.b.c:
637 @echo .b.c
638test.c: test.b
639test.a:
640test.b:
641'
642cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
643
644# Don't use the shell -e option when running commands.
645testing "make no shell -e option when running commands" \
646 "make -f -" "OK\n" "" '
647target:
648 @false; echo OK
649'
650
651# Macros and targets may be mixed on the command line
652testing "make allow mixed macros and targets" \
653 "make -f - FOO=foo foo BAR=bar bar" "foo\nbar\nfoo\nbar\n" "" '
654foo:
655 @echo $(FOO)
656 @echo $(BAR)
657bar:
658 @echo $(FOO)
659 @echo $(BAR)
660'
661
662# $* and $< are supported for target rules
663mkdir make.tempdir && cd make.tempdir || exit 1
664touch src.c src.h
665testing 'make support $* and $< for target rules' \
666 "make -f -" "src.c src.h\nsrc.o\nsrc\nsrc.c\n" "" '
667src.o: src.c src.h
668 @echo "$?"
669 @echo "$@"
670 @echo "$*"
671 @echo "$<"
672'
673cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
674
675# ifeq/ifneq conditionals are supported
676testing 'make support ifeq and ifneq conditionals' \
677 "make -f -" "A OK\nB OK\n" "" '
678A = a
679B = b
680target:
681ifeq ($(A),a)
682 @echo A OK
683else
684 @echo A not OK
685endif
686ifneq "a" "$B"
687 @echo B OK
688endif
689'
690
691# An empty original suffix indicates that every word should have
692# the new suffix added. If neither suffix is provided the words
693# remain unchanged.
694testing "make macro expansion and suffix substitution 3" \
695 "make -f -" "src1.c src2.c\nsrc1 src2\n" "" '
696SRCS = src1 src2
697target:
698 @echo $(SRCS:=.c)
699 @echo $(SRCS:=)
700'
701
702# Skip duplicate entries in $? and $^
703mkdir make.tempdir && cd make.tempdir || exit 1
704touch -t 202206171200 file1 file3
705touch -t 202206171201 target
706touch -t 202206171202 file2
707testing "make skip duplicate entries in \$? and \$^" \
708 "make -f -" \
709 "file2\nfile1 file2 file3\n" "" '
710target: file1 file2 file2 file3 file3
711 @echo $?
712 @echo $^
713'
714cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
715
716# Skip duplicate entries in $? and $^, with each double-colon rule
717# handled separately
718mkdir make.tempdir && cd make.tempdir || exit 1
719touch -t 202206171200 file1 file3
720touch -t 202206171201 target
721touch -t 202206171202 file2
722testing "make skip duplicate entries: double-colon rules" \
723 "make -f -" \
724 "file2\nfile1 file3 file2\nfile2\nfile2 file3\n" "" '
725target:: file1 file3 file1 file2 file3
726 @echo $?
727 @echo $^
728target:: file2 file3 file3
729 @echo $?
730 @echo $^
731'
732cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
733
734# Skip duplicate entries in $? and $^, with each double-colon rule
735# handled separately. No prerequisites out-of-date in the first.
736mkdir make.tempdir && cd make.tempdir || exit 1
737touch -t 202206171200 file1 file3
738touch -t 202206171201 target
739touch -t 202206171202 file2
740testing "make skip duplicate entries: double-colon rules, only second invoked" \
741 "make -f -" \
742 "file2\nfile2 file3\n" "" '
743target:: file1 file3 file1 file3
744 @echo $?
745 @echo $^
746target:: file2 file3 file3
747 @echo $?
748 @echo $^
749'
750cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
751
752# .DEFAULT rules with no commands or some prerequisites are ignored.
753# .DEFAULT rules with commands can be redefined.
754testing "make: .DEFAULT rule" \
755 "make -f - default" "default2\n" "" '
756.DEFAULT: ignored
757.DEFAULT:
758 @echo default1
759.DEFAULT:
760 @echo default2
761target:
762'
763
764testing "make: double-colon rule" \
765 "make -f -" "target1\ntarget2\n" "" '
766target::
767 @echo target1
768target::
769 @echo target2
770'
771
772# Double-colon rules didn't work properly if their target was phony:
773# - they didn't ignore the presence of a file matching the target name;
774# - they were also invoked as if they were a single-colon rule.
775mkdir make.tempdir && cd make.tempdir || exit 1
776touch -t 202206171200 file1
777touch -t 202206171201 target
778testing "make phony target of double-colon rule" \
779 "make -f - 2>&1" \
780 "unconditional\nconditional\n" "" '
781.PHONY: target
782target::
783 @echo unconditional
784target:: file1
785 @echo conditional
786file1:
787 @touch file1
788'
789cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
790
791# GNU make and BSD make don't allow the use of inference rules
792# for phony targets. In POSIX mode the output is "phony.xyz\n".
793mkdir make.tempdir && cd make.tempdir || exit 1
794touch phony.xyz
795testing "make don't use inference rule for phony target" \
796 "make -f -" "make: nothing to be done for phony\n" "" '
797.PHONY: phony
798.SUFFIXES: .xyz
799.xyz:
800 @echo $<
801phony:
802'
803cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
804
805exit $FAILCOUNT