I am new to writing makefiles. Recently I have seen pattern rules in makefiles. For example:
%.o: %.cc
# command to compile comes here
After rigourous searching in the net, I found out what the above statement does,
But I came across another statement below.
%: %.o
# Command to link lies here
I do not understand this rule. Can anyone explain the second pattern rule?
The second rule is also a pattern rule, it says how to make a file with no extension from a file with the same name, but
.oat the end. So it’s a rule to linkfoofromfoo.o,barfrombar.oand so on.