I still don't understand why the "fake" rules in Make files have ".PHONY" as their target. This would be much more logical as a prerequisite.
Should I dwell on this in detail? If A depends on B and B is false, then A also false. Therefore, the dependency graph .PHONY ← B → A is unexpected compared to .PHONY → B → A (Another argument is that the make implementation must handle the target .PHONY object .PHONY very special.)
Although this criticism may seem rather theoretical (meaningless) - "since the brand is so ancient, its syntax is here to stay." But I do not suggest any syntactic changes, there is an alternative:
With GNU Make (at least), the following Makefile declares a fake target_A :
target_A: _PHONY touch target_A _PHONY:
Question 1 : It is so simple and clean, of course, I am not its first inventor. In fact, given this alternative, why do you need special syntax?
It seems to me that this would also very well solve wildcard issues for fake purposes and even shed some light on .PHONY means when beginners doubt it.
Question 2 : Can you come up with any circumstance when this approach is inferior? ( make .PHONY any use called?)
(I should mention that although I called other make s, GNU Make is the only implementation I have experience with reading and writing Make files.)
tiwo
source share