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 pages