tags:

views:

206

answers:

1

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)
+6  A: 

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.

Andy White
Here's a good reference: http://web.mit.edu/gnu/doc/html/make_6.html
Andy White