What does TEMP0_FILES
below compute to? SOURCE_FILES
can equal to multiple source files. Please tell me the purpose of the following syntax :.cpp=.o
SOURCE_FILES = main.cpp
TEMP0_FILES = $(SOURCE_FILES:.cpp=.o)
Double-colon rules are rules written with '::' instead of ':' after the target names. They are handled differently from ordinary rules when the same target appears in more than one rule. When a target appears in multiple rules, all the rules must be the same type: all ordinary, or all double-colon.
The @ symbol is commonly seen at the beginning of an action lines and means that the action line itself is not be be echoed on the screen as it is executed. Macros are commonly used in makefiles to decrease the amount of typing required.
= defines a recursively-expanded variable. := defines a simply-expanded variable.
The : syntax causes a substitution to occur on the variable. In this case it will replace ".cpp" with ".o" in all of the items in the SOURCE_FILES variable.
TEMP0_FILES will be "main.o"
If SOURCE_FILES is "main.cpp otherfile.cpp otherfile2.cpp" TEMP0_FILES will become: "main.o otherfile.o otherfile2.o" etc.
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