make(1): add very basic test about meta mode

This test is just meant to cover the existing code, it still needs to be
cleaned up to serve as a tutorial and to highlight the really
interesting points.
This commit is contained in:
rillig 2020-11-27 08:36:10 +00:00
parent 357a62a61b
commit 053b08eb2b
2 changed files with 28 additions and 2 deletions

View File

@ -1 +1,5 @@
Skipping meta for actual-test: no commands
Skipping meta for .END: .SPECIAL
Targets from meta mode:
| TARGET depsrc-meta-target
exit status 0

View File

@ -1,8 +1,30 @@
# $NetBSD: depsrc-meta.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: depsrc-meta.mk,v 1.3 2020/11/27 08:36:11 rillig Exp $
#
# Tests for the special source .META in dependency declarations.
# TODO: Implementation
# TODO: Explanation
.if make(actual-test)
.MAKEFLAGS: -dM
.MAKE.MODE= meta curDirOk=true
actual-test: depsrc-meta-target
depsrc-meta-target: .META
@> ${.TARGET}-file
@rm -f ${.TARGET}-file
.elif make(check-results)
check-results:
@echo 'Targets from meta mode:'
@awk '/^TARGET/ { print "| " $$0 }' depsrc-meta-target.meta
.else
all:
@:;
@${MAKE} -f ${MAKEFILE} actual-test
@${MAKE} -f ${MAKEFILE} check-results
.endif