freebsd-src/unit-tests/opt-no-action-touch.mk
Simon J. Gerraty 8b6f73e37b Import bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 17:51:11 -08:00

49 lines
1.6 KiB
Makefile

# $NetBSD: opt-no-action-touch.mk,v 1.1 2021/01/30 12:46:38 rillig Exp $
#
# Tests for combining the command line options -n (no action) and -t (touch).
# This combination is unusual and probably doesn't ever happen in practice,
# but still make needs to behave as expected. The option -n is stronger than
# -t, so instead of being touched, the commands of the targets are printed.
#
# See also:
# opt-touch-jobs.mk contains the same test without the option -n.
.MAKEFLAGS: -j1 -n -t
.MAKEFLAGS: opt-touch-phony
.MAKEFLAGS: opt-touch-join
.MAKEFLAGS: opt-touch-use
.MAKEFLAGS: opt-touch-make
.MAKEFLAGS: opt-touch-regular
# .PHONY targets are not touched since they do not represent actual files.
# See Job_Touch.
opt-touch-phony: .PHONY
: Making $@.
# .JOIN targets are not touched since they do not represent actual files.
# See Job_Touch.
opt-touch-join: .JOIN
: Making $@.
# .USE targets are not touched since they do not represent actual files.
# See Job_Touch.
opt-touch-use: .USE
: Making use of $@.
# The attribute .MAKE is stronger than the command line option -n. Therefore
# this target is run as usual. It is not prefixed by '@', therefore it is
# printed before being run.
opt-touch-make: .MAKE
echo 'Making $@.'
# Since the option -n is stronger than the option -t, this target is not
# touched either. Without the -n, it would be touched.
opt-touch-regular:
: Making $@.
# Since none of the above targets are actually touched, the following command
# does not output anything.
.END:
@files=$$(ls opt-touch-* 2>/dev/null | grep -v -e '\.'); \
[ -z "$$files" ] || { echo "created files: $$files" 1>&2; exit 1; }