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