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 .o at the end. So it's a rule to link foo from foo.o, bar from bar.o and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With