17.05.2024 15:50:06 Edgar Fuß <e...@math.uni-bonn.de>: >> main: .PHONY >> make -V X | wc -c > Wow, I didn't know that worked. > > How on earth /does/ it work? If a command happens to be "make", make just > forks without the child process exec()ing anything, so all the make variables > etc. are inherited?
No, that would be too much magic. While there is some magic that is activated whenever the command contains the string "make" or "${MAKE}", it doesn't go this far. What happens here is that the child "make -V" reads the complete Makefile again, and after that, it prints the variable value. So no magic, just a bit of duplicate effort.