[Bug 230492] make: -C options doesn't work as explained in man page about value of ${.CURDIR} when logical and physical directory are different.
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Aug 10 01:39:45 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230492
Bug ID: 230492
Summary: make: -C options doesn't work as explained in man page
about value of ${.CURDIR} when logical and physical
directory are different.
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: yasu at utahime.org
In the man page of make(1) '-C' options is explained as following.
----------------------------------------------------------------------
-C directory
Change to directory before reading the makefiles or doing
anything else. If multiple -C options are specified, each is
interpreted relative to the previous one: -C / -C etc is
equivalent to -C /etc.
----------------------------------------------------------------------
This means 'make -C /foo/bar/baz' works same as 'cd /foo/bar/baz; make'.
But there is an case that make doesn't behaves so. As explained in summary it
is about value of ${.CURDIR} and happens when logical and physical directory
are different.
Let me explain it by providing an example.
----------------------------------------------------------------------
yasu at rolling-vm-freebsd1[2018]% pwd
/home/yasu/tmp
yasu at rolling-vm-freebsd1[2019]% ls -l
total 1
lrwxr-xr-x 1 yasu user 3 8月 10 08:21 bar@ -> foo
drwxr-xr-x 2 yasu user 3 8月 10 08:20 foo/
----------------------------------------------------------------------
/home/yasu/tmp/foo is real directory and /home/yasu/tmp/bar is symbolic link to
it. So logical and physical expression of /home/yasu/tmp/bar is different.
----------------------------------------------------------------------
yasu at rolling-vm-freebsd1[2020]% cd /home/yasu/tmp/bar
yasu at rolling-vm-freebsd1[2021]% /bin/pwd -L
/home/yasu/tmp/bar
yasu at rolling-vm-freebsd1[2022]% /bin/pwd -P
/home/yasu/tmp/foo
----------------------------------------------------------------------
And there is following Makefile under /home/yasu/tmp/bar.
----------------------------------------------------------------------
yasu at rolling-vm-freebsd1[2023]% cat Makefile
~/tmp/bar
all:
@echo ${.CURDIR}
----------------------------------------------------------------------
It simply displays value of ${.CURDIR}.
Now let's execute make without any arguments. It causes following result.
----------------------------------------------------------------------
yasu at rolling-vm-freebsd1[2024]% make
~/tmp/bar
/home/yasu/tmp/foo
----------------------------------------------------------------------
Physical expression of current working directory is displayed.
Next, let's execute make with -C options and logical expression of current
working directory. In this case it result as following.
----------------------------------------------------------------------
yasu at rolling-vm-freebsd1[2025]% make -C /home/yasu/tmp/bar
~/tmp/bar
/home/yasu/tmp/bar
----------------------------------------------------------------------
If '-C' options works exactly as explained in man page, same value as previous
execution, that is, physical expression of current working directory should be
displayed. Actually, however, what is displayed is logical expression of
current working directory. This means '-C' option doesn't work as explained in
man page.
I confirmed it happens on both 11.2-RELEASE and 12.0-CURRENT (r337160).
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list