[Makefile] Create object list automatically

From the list of source files you can automatically create the list of object files by  either using patsubst or the following handy trick

SRC_FILES:= test.cpp foo.cpp bar.cpp
OBJ_FILES:= $(SRC_FILES:%.cpp=%.o)

Using patsubst the same thing can be achieved.

OBJ_FILES:=$(patsubst %.cpp,%.o,$(SRC_FILES))



No comments: