1 # $NetBSD: opt-chdir.mk,v 1.7 2024/04/02 11:11:00 rillig Exp $ 2 # 3 # Tests for the -C command line option, which changes the directory at the 4 # beginning. 5 # 6 # This option has been available since 2009-08-27. 7 8 .MAKEFLAGS: -d0 # switch stdout to line-buffered 9 10 all: chdir-root 11 all: chdir-nonexistent 12 13 # Changing to another directory is possible via the command line. 14 # In this test, it is the root directory since almost any other directory 15 # is not guaranteed to exist on every platform. 16 chdir-root: .PHONY .IGNORE 17 @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}' 18 19 # Trying to change to a nonexistent directory exits immediately. 20 # Note: just because the whole point of /nonexistent is that it should 21 # not exist - doesn't mean it doesn't. 22 chdir-nonexistent: .PHONY .IGNORE 23 @${MAKE} -C /nonexistent.${.MAKE.PID} 24