phony-target

Makefile: declare all targets PHONY

梦想与她 提交于 2019-12-06 21:55:00
问题 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 c Or: .PHONY: a b c a: do someting a b: do someting b c: do someting c The first option is cumbersome, and the second option is prone to error, when future me adds a target and forget to declare it as PHONY . Is there a standard way to declare all targets in a

Makefile: declare all targets PHONY

两盒软妹~` 提交于 2019-12-05 02:13:48
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 c Or: .PHONY: a b c a: do someting a b: do someting b c: do someting c The first option is cumbersome, and the second option is prone to error, when future me adds a target and forget to declare it as PHONY . Is there a standard way to declare all targets in a makefile as PHONY ? If really all targets are PHONY , this is a bit pointless. make is meant for " do

What is the purpose of .PHONY in a makefile?

徘徊边缘 提交于 2019-11-26 03:31:10
问题 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? 回答1: By default, Makefile targets are "file targets" - they are used to build files from other files. Make assumes its target is a file, and this makes writing Makefiles relatively easy: foo: bar create_one_from_the_other foo bar However, sometimes you want your Makefile to run commands that do not represent physical files in the file system. Good examples