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