xref: /freebsd/contrib/bmake/unit-tests/varname-dot-make-ppid.mk (revision 8881d206f4e68b564c2c5f50fc717086fc3e827a)
1# $NetBSD: varname-dot-make-ppid.mk,v 1.3 2022/01/23 21:48:59 rillig Exp $
2#
3# Tests for the special .MAKE.PPID variable, which contains the process ID of
4# make's parent process.
5
6# The parent process ID must be a positive integer.
7.if ${.MAKE.PPID:C,[0-9],,g} != ""
8.  error
9.elif !(${.MAKE.PPID} > 0)
10.  error
11.endif
12
13# Ensure that the process exists.
14_!=	kill -0 ${.MAKE.PPID}
15
16# The parent process ID must be different from the process ID.  If they were
17# the same, make would run as process 1, which is not a good idea because make
18# is not prepared to clean up after other processes.
19.if ${.MAKE.PPID} == ${.MAKE.PID}
20.  error
21.endif
22
23all: .PHONY
24