1 # $NetBSD: opt-no-action-touch.mk,v 1.1 2021/01/30 12:46:38 rillig Exp $ 2 # 3 # Tests for combining the command line options -n (no action) and -t (touch). 4 # This combination is unusual and probably doesn't ever happen in practice, 5 # but still make needs to behave as expected. The option -n is stronger than 6 # -t, so instead of being touched, the commands of the targets are printed. 7 # 8 # See also: 9 # opt-touch-jobs.mk contains the same test without the option -n. 10 11 .MAKEFLAGS: -j1 -n -t 12 .MAKEFLAGS: opt-touch-phony 13 .MAKEFLAGS: opt-touch-join 14 .MAKEFLAGS: opt-touch-use 15 .MAKEFLAGS: opt-touch-make 16 .MAKEFLAGS: opt-touch-regular 17 18 # .PHONY targets are not touched since they do not represent actual files. 19 # See Job_Touch. 20 opt-touch-phony: .PHONY 21 : Making $@. 22 23 # .JOIN targets are not touched since they do not represent actual files. 24 # See Job_Touch. 25 opt-touch-join: .JOIN 26 : Making $@. 27 28 # .USE targets are not touched since they do not represent actual files. 29 # See Job_Touch. 30 opt-touch-use: .USE 31 : Making use of $@. 32 33 # The attribute .MAKE is stronger than the command line option -n. Therefore 34 # this target is run as usual. It is not prefixed by '@', therefore it is 35 # printed before being run. 36 opt-touch-make: .MAKE 37 echo 'Making $@.' 38 39 # Since the option -n is stronger than the option -t, this target is not 40 # touched either. Without the -n, it would be touched. 41 opt-touch-regular: 42 : Making $@. 43 44 # Since none of the above targets are actually touched, the following command 45 # does not output anything. 46 .END: 47 @files=$$(ls opt-touch-* 2>/dev/null | grep -v -e '\.'); \ 48 [ -z "$$files" ] || { echo "created files: $$files" 1>&2; exit 1; } 49