A pseudo-target is a goal that is always executed, and a pseudo-target does not take into account the new and old relationship between its dependent timestamp and its own timestamp, relative to the target, and thus decides whether to execute the rule. Pseudo-Target format:
. Phony:cleanclean: -rm *.O
In makefile, the goal of clean is usually specified as a pseudo-target, which has a feature of no dependency, then every time the make is executed its rules:-rm *.O, then why to specify as a pseudo-target, Usually see the makefile is the general goal of it. Assuming that clean is not specified as a pseudo target, there are 1 files under my current folder:
A.C. My makefile:
1 All : 2 gcc a.c-o clean35clean:6 rm Clean
After you execute make, the clean executable is generated, assuming now that I want to clear the generated file, I'll execute make, and the result is prompt:
Make: ' Clean ' is up to date.
This is because clean is treated as a common goal, according to make automatic rule deduction, it was intended to execute: GCC clean.c-o clean, the results found that no dependent clean.c, it thought clean is the latest to do nothing. If you add:
. Phony:clean
To declare as a pseudo-target, it is enforced regardless of dependencies or dependencies.
Pseudo-Targets in makefile