makefile链接库

CXX=g++
TARGET=main
SRC=$(wildcard *.cpp)
OBJ=$(patsubst *.cpp ,-o ,$(SRC))
CXXFLAGS=-c -Wall
LIBS=-I /usr/include/mysql -L /usr/lib64/mysql 	#链接库

$(TARGET):$(OBJ)
	$(CXX) -o $(TARGET) $(OBJ) 

%.o:%.cpp
	$(CXX) $(CXXFLAGS) $< -o $@ $(LIBS)

clean:
	rm -rf *.o $(TARGET)

posted @ 2023-03-14 14:59  对CSDN使用炎拳吧  阅读(22)  评论(0编辑  收藏  举报