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