4 ms·
For anyone who's curious: you can use a ".PHONY" target to force targets to be rebuilt (i.e. that they don't correspond to real files). All dependencies of the
by nneonneo 10y ago
For anyone who's curious: you can use a ".PHONY" target to force targets to be rebuilt (i.e. that they don't correspond to real files). All dependencies of the .PHONY pseudo-target will be rebuilt unconditionally when encountered. Typically, "all", "clean", "install", etc. will all be phony targets as the goal isn't to literally make a file called "all".
The syntax is simple:
.PHONY: all clean install
marks "all", "clean" and "install" as phony. Even if the file "all" happens to exist, "make all" will still trigger the build.
- Bromskloss 10y ago> All dependencies of the .PHONY pseudo-target will be rebuilt unconditionally when encountered. To be clear, they will rebuilt only if they are not already up to date relative to their own dependencies, right?
- rahkiin 10y agoyes. Phony is only about making sure that 'all' is seen as target, not as file or folder
- lifthrasiir 10y agoI prefer to put the phony rule right before the actual rules, it's better for understanding: .PHONY: all all: ... .PHONY: clean clean: ...