OBJS = DatabaseManager.o
GCC = g++
ROOTPATH = ../../..
INCS = -I./ -I$(ROOTPATH)/include -I/usr/include
LIBS = -L./ -L$(ROOTPATH)/lib/ -L/usr/lib/mysql/ \
-lDatabase -lUtility -lmysqlclient //若要找到lmysqlclient,需加 -L/usr/lib/mysql/ 这是让我困惑好久的!!
all:makedir copyHeader libDatabaseManager.a CoreaddrToDatabase_Test.e finalcopy
libDatabaseManager.a:$(OBJS)
ar cr $@ $^
DatabaseManager.o:DatabaseManager.cpp
$(GCC) $(INCS) -g -o $@ -c $^
CoreaddrToDatabase_Test.e:CoreaddrToDatabase_Test.cpp
$(GCC) $(INCS) -g -o $@ $^ $(LIBS) -lDatabaseManager
makedir:
@( if [ ! -d $(ROOTPATH)/include/MAGServer/ ]; then mkdir -p $(ROOTPATH)/include/MAGServer/ ; fi )
@( if [ ! -d $(ROOTPATH)/lib/MAGServer/ ]; then mkdir -p $(ROOTPATH)/lib/MAGServer/ ; fi )
clean:
rm -f *.o
rm -f *.a
rm -f *.e
copyHeader:
cp -f ./*.h $(ROOTPATH)/include/MAGServer/
finalcopy:
cp -f ./*.a $(ROOTPATH)/lib/MAGServer/