You need a Makefile that would compile only those files that are specified in the SRCS variable.
For example, there is the following file structure:
test/ a.cpp b.cpp c.cpp d.cpp ... Makefile Makefile :
SRCS = a.cpp c.cpp ... OBJS = $(SRCS:.cpp=.o) ??? What to write next so that each file from SRCS compiled into the corresponding object file from OBJS . Not all .cpp files, but only selected ones.
The variable SRCS may change over time. And this is necessary not only for compiling .cpp files to object .o , but also for other tasks.