link_flag = `mysql_config --libs`
all:server client test
server:server.o connection.o table.o sqlerror.o
g++ -o $@ $^ -lpthread $(link_flag)
server.o:server.cpp connection.hpp table.hpp
g++ -o $@ -c $<
connection.o:connection.cpp sqlerror.hpp
g++ -o $@ -c $<
table.o:table.cpp connection.hpp sqlerror.hpp
g++ -o $@ -c $<
sqlerror.o:sqlerror.cpp
g++ -o $@ -c $<
client:client.o
g++ -o $@ $< -lpthread
client.o:client.cpp
g++ -o $@ -c $<
test:test.o
g++ -o $@ $<
test.o:test.cpp
g++ -o $@ -c $<
clean:
find . | grep [0-9] | xargs rm -rf
rm -rf *.o
rm -rf server
rm -rf client
rm -rf test
all:server client test
server:server.o connection.o table.o sqlerror.o
g++ -o $@ $^ -lpthread $(link_flag)
server.o:server.cpp connection.hpp table.hpp
g++ -o $@ -c $<
connection.o:connection.cpp sqlerror.hpp
g++ -o $@ -c $<
table.o:table.cpp connection.hpp sqlerror.hpp
g++ -o $@ -c $<
sqlerror.o:sqlerror.cpp
g++ -o $@ -c $<
client:client.o
g++ -o $@ $< -lpthread
client.o:client.cpp
g++ -o $@ -c $<
test:test.o
g++ -o $@ $<
test.o:test.cpp
g++ -o $@ -c $<
clean:
find . | grep [0-9] | xargs rm -rf
rm -rf *.o
rm -rf server
rm -rf client
rm -rf test
本文档详细介绍了如何使用mysql_config命令来获取编译MySQL客户端和服务端所需的链接标志,并提供了具体的编译步骤,包括服务器、客户端及测试程序的编译命令。
839

被折叠的 条评论
为什么被折叠?



