Monday, September 27, 2010

What is a phony target in Make?

A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request.

There are two reasons to use a phony target:
      a)  To execute the target unconditionally (i.e No dependencies are mentioned)
      b)  to avoid a conflict with a file of the same name
      c) to improve performance.

Example:
PHONY: clean 
clean:
             rm *.o temp

No comments:

Post a Comment