VERSION = 1.0.0 SOURCE = $(wildcard ./*.cpp) OBJ = $(patsubst %.cpp,%.o,$(SOURCE)) INCLUDE = -I /usr/include/mysql/ LIBS = -lmysqlclient LIB_PATH = -L /usr/lib/mysql/ CFALGS = -g TARGET = test $(TARGET): $(OBJ) @mkdir -p output/ g++ $(OBJ) $(LIB_PATH) $(LIBS) -o output/$(TARGET).$(VERSION) %.o : %.cpp g++ $(INCLUDE) $(CFALGS) -c $< -o $@ .PHONY: clean clean: rm -rf $(OBJ) output/