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