While searching for the usage of .PHONY
in makefile, i came accross this which says something like
.PHONY also allows you to have targets that do not have an associated rule
I put the example metioned in that post in a makefile and I ran that but it is not showing me any error as mentioned in the OP. Can someone please detail it?
The makefile
target1: dostuff
.PHONY: target2
target2: dostuff
dostuff:
@echo "Stuff gets done!!!!"
O/P
[sourav@titan temp]$ make target1
Stuff gets done!!!!
[sourav@titan temp]$ make target2
Stuff gets done!!!!
[sourav@titan temp]$ make
Stuff gets done!!!!
[sourav@titan temp]$
As per the OP, make target1 should throw an error. Please enlight.
Some Info
[sourav@titan temp]$ uname -r
2.6.18-194.el5PAE
[sourav@titan temp]$ make --version
GNU Make 3.81
[sourav@titan temp]$