1 # $NetBSD: opt-chdir.mk,v 1.6 2021/05/18 17:05:45 sjg Exp $
3 # Tests for the -C command line option, which changes the directory at the
6 # This option has been available since 2009-08-27.
8 .MAKEFLAGS: -d0 # switch stdout to line-buffered
10 all: chdir-filename-too-long
12 all: chdir-nonexistent
14 # Try to overflow the internal buffer for .CURDIR, which is curdir.
15 chdir-filename-too-long: .PHONY .IGNORE
16 # 5000 slashes, separated by dots: /./././.../././
17 @${MAKE} -C ${:U:range=5000:@@/@:ts.}
19 # Changing to another directory is possible via the command line.
20 # In this test, it is the root directory since almost any other directory
21 # is not guaranteed to exist on every platform.
22 chdir-root: .PHONY .IGNORE
23 @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}'
25 # Trying to change to a nonexistent directory exits immediately.
26 # Note: just because the whole point of /nonexistent is that it should
27 # not exist - doesn't mean it doesn't.
28 chdir-nonexistent: .PHONY .IGNORE
29 @${MAKE} -C /nonexistent.${.MAKE.PID}