1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CPP := g++ CPP_ARGS := -Wall -g -I. LD_ARGS := BINARIES := $(patsubst %.cpp, build/%, $(wildcard *.cpp)) .PHONY: all all: $(BINARIES) .PHONY: clean clean: - rm $(BINARIES) build/%: %.cpp - mkdir -p build - $(CPP) $(CPP_ARGS) $< -o $@ $(LD_ARGS)