CXX := g++ CXXFLAGS := -Wall -Wextra -O2 -std=c++11 SOURCES := $(wildcard *.cpp) BINARIES := $(SOURCES:.cpp=) space := space += #$(space) now contains a space comma := , PLAYERLIST := $(subst $(space),$(comma),$(filter player_%,$(BINARIES))) all: $(BINARIES) clean: rm -f $(BINARIES) cleanlogs: find playerlogs/ -type f -delete find refereelogs/ -type f -delete remake: clean all competition: all ./caiaio -f $(PLAYERLIST) -m manager