加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
#============================================================================
# Copyright (C) 2016, han_gangbiao. All rights reserved.
# Use of this source code is governed by a GPL-v2 license that can be found in the License file.
#
#// CreateDate : [2014-1-26 13:43:52]
#// Creator : han_gangbiao [jackhen] [http://my.oschina.net/jackhen]
#
#// FileInfo : Makefile for smartrpc
#============================================================================
A_TARGET = libsmartrpc$(FN_D).a
SRCS += \
$(wildcard *.cpp) \
$(wildcard base/*.cpp) \
$(wildcard net/*.cpp) \
$(wildcard net/net_inside/*.cpp) \
$(wildcard protocol/*.cpp) \
$(wildcard rpc/*.cpp) \
CFLAGS += -g -pipe -Wall
CFLAGS += \
-I./ \
D?=0
OBJS += $(patsubst %.cpp, %.o, $(filter %.cpp, $(SRCS)))
OBJS += $(patsubst %.cc, %.o, $(filter %.cc, $(SRCS)))
OBJS += $(patsubst %.c, %.o, $(filter %.c, $(SRCS)))
DEPS += $(patsubst %.o, %.d~, $(OBJS))
GCC=gcc
GXX=g++
AR=ar
ifeq ($(D), 0)
CFLAGS += -O2 -fno-strict-aliasing
else
FN_D=_d
endif
ifdef SO_TARGET
LFLAGS += -DPIC -fPIC
endif
.PHONY : all clean
all : $(A_TARGET) $(SO_TARGET) $(EXE_TARGET)
clean:
rm -f $(A_TARGET) $(SO_TARGET) $(EXE_TARGET) $(OBJS) $(DEPS)
ifdef A_TARGET
$(A_TARGET) : $(OBJS)
$(AR) crvs $(A_TARGET) $(OBJS)
endif
ifdef SO_TARGET
$(SO_TARGET) : $(OBJS)
$(GXX) -shared -rdynamic $(CFLAGS) -o $(SO_TARGET) $(OBJS) $(LFLAGS)
endif
ifdef EXE_TARGET
$(EXE_TARGET) : $(OBJS)
$(GXX) $(CFLAGS) -o $(EXE_TARGET) $(OBJS) $(LFLAGS)
endif
.SUFFIXES : .cpp .c .cc
.cpp.o :
$(GXX) $(CFLAGS) -MMD -MF $*.d~ -c -o $@ $<
.c.o :
$(GCC) $(CFLAGS) -MMD -MF $*.d~ -c -o $@ $<
.cc.o :
$(GXX) $(CFLAGS) -MMD -MF $*.d~ -c -o $@ $<
-include $(DEPS)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化