/
make wildcard matching list of files

make wildcard matching list of files

This is useful trick for in this case generating a list of all the cpp files in local directory of the makefile that is running this instruction:

SRCS := $(wildcard *.cpp)

This is GNU specific extension of the makefile system. See:

Wildcard Function (GNU make)

Having learned this technique I always wonder why most makefile authors maintain manual lists of source or object files in their makefiles. That is a lot of unnecessary work.

One can overcome the problem of excluding platform specific files using this trick.

 

Related content

Make recipe rule
Make recipe rule
More like this
Excluding platform specific files for a build
Excluding platform specific files for a build
More like this
makefile - sandbox example
makefile - sandbox example
More like this
Make Dependency Files for C/C++ Headers
Make Dependency Files for C/C++ Headers
More like this
Assign and use make variable
Assign and use make variable
More like this
Linking an Executable - Example
Linking an Executable - Example
Read with this