Home | History | Annotate | Line # | Download | only in unit-tests
      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 
     10 all: .PHONY
     11 all: no_prerequisites prerequisite
     12 all: unique duplicate
     13 all: dir_part file_part
     14 all: implicit.tout
     15 all: wait
     16 
     17 .if defined(^)
     18 .  error
     19 .endif
     20 
     21 no_prerequisites:
     22 	@echo $@: $^
     23 
     24 prerequisite: file1.o
     25 	@echo $@: $^
     26 
     27 unique: file1.o file2.o file3.o
     28 	@echo $@: $^
     29 
     30 duplicate: file1.o file2.o file3.o file3.o
     31 	@echo $@: $^
     32 
     33 dir_part: /usr/include/stdio.h /usr/include/unistd.h foo.h
     34 	@echo $@: $(^D)
     35 
     36 file_part: /usr/include/stdio.h /usr/include/unistd.h foo.h
     37 	@echo $@: ${^F}
     38 
     39 wait: file1.o .WAIT file2.o
     40 	@echo $@: $^
     41 
     42 .SUFFIXES:
     43 .SUFFIXES: .tin .tout
     44 
     45 .tin.tout:
     46 	@echo $@: $^
     47 
     48 file1.o file2.o file3.o:
     49 /usr/include/stdio.h /usr/include/unistd.h foo.h implicit.tin:
     50