xref: /freebsd/contrib/bmake/unit-tests/varname-circumflex.mk (revision c60f6422ffae3ea85e7b10bad950ad27c463af18)
1# $NetBSD: varname-circumflex.mk,v 1.2 2025/08/09 23:13:29 rillig Exp $
2#
3# Tests for the target-local variable "^", which is required by POSIX 2024
4# and provided by GNU make.
5#
6# https://gnats.netbsd.org/59018
7
8# TODO: Support $^.
9
10all: .PHONY
11all: no_prerequisites prerequisite
12all: unique duplicate
13all: dir_part file_part
14all: implicit.tout
15all: wait
16
17.if defined(^)
18.  error
19.endif
20
21no_prerequisites:
22	@echo $@: $^
23
24prerequisite: file1.o
25	@echo $@: $^
26
27unique: file1.o file2.o file3.o
28	@echo $@: $^
29
30duplicate: file1.o file2.o file3.o file3.o
31	@echo $@: $^
32
33dir_part: /usr/include/stdio.h /usr/include/unistd.h foo.h
34	@echo $@: $(^D)
35
36file_part: /usr/include/stdio.h /usr/include/unistd.h foo.h
37	@echo $@: ${^F}
38
39wait: file1.o .WAIT file2.o
40	@echo $@: $^
41
42.SUFFIXES:
43.SUFFIXES: .tin .tout
44
45.tin.tout:
46	@echo $@: $^
47
48file1.o file2.o file3.o:
49/usr/include/stdio.h /usr/include/unistd.h foo.h implicit.tin:
50