Questions tagged [phony-target]

A phony makefile target is a target that is not associated with a file name. Make would not search for the file and its timestamp.

A phony makefile target is a target that is not associated with a file name. Make would not search for the file and its timestamp.

Targets that do not write or modify an eponymous file, should be declared PHONY.

See also the GNU manual.

3 questions
2452
votes
10 answers

What is the purpose of .PHONY in a Makefile?

What does .PHONY mean in a Makefile? I have gone through this, but it is too complicated. Can somebody explain it to me in simple terms?
Lazer
  • 90,700
  • 113
  • 281
  • 364
42
votes
4 answers

Declare all targets PHONY

Consider a long makefile with numerous targets, all of which are PHONY (meaning that the target name does not represent an existing file). I can do either: .PHONY: a a: do someting a .PHONY: b b: do someting b .PHONY: c c: do someting…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
0
votes
0 answers

Can I use pattern in phony target?

I'd like to declare a-test, b-test, c-test as phony targets. Can I declare: .PHONY : *-test instead of .PHONY : a-test b-test c-test Also, how about declaring .PHONY : %-test?
Leedehai
  • 3,660
  • 3
  • 21
  • 44