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