Home | History | Annotate | Line # | Download | only in unit-tests
      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 
     23 all: .PHONY
     24