1 1.5 sjg # $NetBSD: opt-chdir.mk,v 1.5 2020/11/15 05:43:56 sjg 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-filename-too-long 11 1.4 rillig all: chdir-root 12 1.4 rillig all: chdir-nonexistent 13 1.4 rillig 14 1.4 rillig # Try to overflow the internal buffer for .CURDIR, which is curdir. 15 1.4 rillig chdir-filename-too-long: .PHONY .IGNORE 16 1.4 rillig # 5000 slashes, separated by dots: /./././.../././ 17 1.4 rillig @${MAKE} -C ${:U:range=5000:@@/@:ts.} 18 1.4 rillig 19 1.4 rillig # Changing to another directory is possible via the command line. 20 1.4 rillig # In this test, it is the root directory since almost any other directory 21 1.4 rillig # is not guaranteed to exist on every platform. 22 1.4 rillig chdir-root: .PHONY .IGNORE 23 1.5 sjg @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}' 24 1.4 rillig 25 1.4 rillig # Trying to change to a nonexistent directory exits immediately. 26 1.4 rillig chdir-nonexistent: .PHONY .IGNORE 27 1.4 rillig @${MAKE} -C /nonexistent 28