# Written with extensive help from https://makefiletutorial.com CC = g++ TARGET_EXEC = life SRC_DIR = src INC_DIR = include BUILD_DIR = build CFLAGS = -I $(INC_DIR) -MMD -MP -I c:/SDL2/include -I c:/SDL2/include/SDL2 -Dmain=SDL_main LDFLAGS = -L c:/SDL2/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -static-libstdc++ -static-libgcc SRC = $(wildcard $(SRC_DIR)/*.cpp) OBJ = $(SRC:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o) DEP = $(OBJ:%.o=%.d) $(TARGET_EXEC): $(OBJ) $(CC) $(OBJ) -o $(TARGET_EXEC) $(LDFLAGS) $(OBJ): $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp @mkdir -p $(BUILD_DIR) $(CC) $(CFLAGS) -c $< -o $@ clean: @rm -rf $(BUILD_DIR) $(TARGET_EXEC) -include $(DEP)