CC = g++ CFLAGS = -Wall TARGET = tetris SRCDIR = src OBJDIR = build BASENM = $(notdir $(basename $(wildcard src/*.cpp))) OBJS = $(addsuffix .o, $(addprefix $(OBJDIR)/, $(BASENM)) ) all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(OBJS) -o $(TARGET) -lSDL2 -lSDL2_image $(OBJS): $(OBJDIR)/%.o: $(SRCDIR)/%.cpp mkdir -p $(OBJDIR) $(CC) $(CFLAGS) -o $@ -c $< clean: rm -r $(OBJDIR) $(TARGET) .PHONY: all clean