On 2021-12-27 19:30, Paul Smith wrote:
On Sun, 2021-12-26 at 04:46 +0100, Reto wrote:
Is this a bug or am I missing something from the docs?
The -r and -R options don't take effect until the makefiles are all
parsed.
By the way, how is that to be understood?
Because if I, say, expand RM using $(info $(RM)) right in top-level
syntax outside of any rule, I get the expected behavior:
it expands to blank with "make -R", otherwise "rm -f".
$ make
rm -f
make: *** No targets. Stop.
$ make -R
make: *** No targets. Stop.
$ cat Makefile
$(info $(RM))
So if that effect is not until makefiles are parsed, that would
mean that make is parsing the entire file without expanding variables,
then putting the -R into effect, and then doing a second pass over
the parsed file to expand variables in $(info ...) and execute its
effect.