Boris Kolpackov wrote:
foo : bar.o

bar.o : bar.cpp
        g++ -c -o $@ $<

Here I don't have a command for 'foo'. 'foo' is not declared
phony. However make 'imagines' that this target is somehow
gets updated. Obviously there is no way 'foo' can be created
(side-effects aside for a moment) so effectively 'foo' becomes an implicit phony target. My question is when this logic can be useful?

As far as I remember, early make (say 20 years ago) didn't have notion of explicit phony targets. Any such-file-unlikely-to-exist names could be used to define synonyms/aliases for targets:

  all: link
  link: $(EXECUTABLES)
  compile: $(OBJECTS)

Now they are called 'phony targets', but historically, they were just names that
didn't exist as files.

In old days, it worked unless accidentally, someone would accidentally
create files 'all', 'link', or 'compile'. Then later someone didn't
like this accidentality and came up with explicit 'phony' labeling.
But to sum up, this is historic compatibility I think.

Jacob



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to