help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug or Feature? make follows symbolic link for current directory


From: Christian Hujer
Subject: Bug or Feature? make follows symbolic link for current directory
Date: Fri, 7 Jul 2023 22:22:36 +0530

Hello folks,

Is this a bug or a feature?

mkdir foo
ln -s foo bar
cd bar
echo -e 'all:\n\tpwd' >Makefile
make

I would have expected the output to be …/bar but it actually is …/foo.
It appears that GNU make follows the symbolic link in case the current
directory is a symbolic link.
I could not find this behavior in the documentation, and find it a bit
unexpected.

I thought that using $(lastword $(subst /, ,$(abspath .))) I would get
bar and $(lastword $(subst /, ,$(realpath .))) I would get foo.
But because make has already followed the symlink for the current
directory, both return foo.

Is this behavior documented?
And does this behavior make sense?

Tested versions of GNU make: 4.3 (Ubuntu) and 4.4.1.

Best regards,
Christian Hujer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]