码迷,mamicode.com
首页 > 其他好文 > 详细

老大写得一个很高大上的Makefile,包含很多语法:

时间:2014-10-25 18:49:29      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:makefile

一个很高大上的Makefile,包含很多语法:

TARGET = api-login
INSTALL_PATH = /huishoubao/cgi

include ../../implements/log/Makefile.log
include ../../implements/tools/Makefile.tools
include ../../implements/db/Makefile.db
include ../../implements/configure/Makefile.configure
include ../../implements/protocol/Makefile.protocol
include ../../implements/user/Makefile.user
include ../../implements/logic/Makefile.logic

vpath %.cpp ../../implements/log
vpath %.cpp ../../implements/tools
vpath %.cpp ../../implements/db
vpath %.cpp ../../implements/configure
vpath %.cpp ../../implements/protocol
vpath %.cpp ../../implements/user
vpath %.cpp ../../implements/logic

INCLUDES = -I/usr/local/include/log4cplus            -I/usr/local/include/ClearSilver            -I/usr/include/mysql            -I../../implements/log            -I../../implements/tools            -I../../implements/db            -I../../implements/configure            -I../../implements/protocol            -I../../implements/user            -I../../implements/logic

LIBDIRS = -L/usr/local/lib           -L/usr/lib64/mysql

LIBS += -lfcgi         -ljson         -lmysqlclient         -llog4cplus -lpthread         -lcrypto         -lmemcached         -lneo_cgi -lneo_utl -lneo_cs         -lcurl

CC = gcc
CXX = g++

CXXFLAGES += -Wall -O2
LDFLAGS = -Wl,-R /usr/local/lib

RM = rm -f
CP = cp -f

SOURCES += api-login.cpp 

OBJECTS = $(SOURCES:.cpp=.o)

.PHONY : all clean install mem

all:$(TARGET)

mem:
	$(CXX) -c -std=c++0x ../../implements/tools/memcached.cpp -o memcached.o

$(TARGET):$(OBJECTS)
	$(CXX) -o $(TARGET) memcached.o $(OBJECTS) $(LDFLAGS) $(LIBDIRS) $(LIBS)

$(OBJECTS):%.o:%.cpp
	$(CXX) -c $(CXXFLAGES) $(INCLUDES) $< -o $@

clean:
	-$(RM) $(TARGET) $(OBJECTS) memcached.o

install:
	-$(CP) $(TARGET) $(INSTALL_PATH)/$(TARGET)
	-$(CP) ../../implements/log/log4cplus.properties /data/log/


老大写得一个很高大上的Makefile,包含很多语法:

标签:makefile

原文地址:http://blog.csdn.net/nyist327/article/details/40454669

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!