1 Star 0 Fork 0

MrMriacle/pbc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
Cloud Wu 提交于 2015-01-22 20:10 +08:00 . lua 5.3 binding
CC = gcc
CFLAGS = -O2 -fPIC -Wall
AR = ar rc
BUILD = build
.PHONY : all lib clean tool
LIBSRCS = context.c varint.c array.c pattern.c register.c proto.c map.c alloc.c rmessage.c wmessage.c bootstrap.c stringpool.c decode.c
LIBNAME = libpbc.a
TESTSRCS = addressbook.c pattern.c pbc.c float.c map.c test.c decode.c
PROTOSRCS = addressbook.proto descriptor.proto float.proto test.proto
BUILD_O = $(BUILD)/o
all : lib test
lib : $(LIBNAME)
clean :
rm -rf $(BUILD)
$(BUILD) : $(BUILD_O)
$(BUILD_O) :
mkdir -p $@
TOOL := $(BUILD)/dump
tool : $(TOOL)
$(TOOL) : | $(BUILD)
$(TOOL) : $(LIBNAME)
$(TOOL) : tool/dump.c
cd $(BUILD) && $(CC) $(CFLAGS) -I.. -L. -o dump ../$< -lpbc
LIB_O :=
define BUILD_temp
TAR := $(BUILD_O)/$(notdir $(basename $(1)))
LIB_O := $(LIB_O) $$(TAR).o
$$(TAR).o : | $(BUILD_O)
-include $$(TAR).d
$$(TAR).o : src/$(1)
$(CC) $(CFLAGS) -c -Isrc -I. -o $$@ -MMD $$<
endef
$(foreach s,$(LIBSRCS),$(eval $(call BUILD_temp,$(s))))
$(LIBNAME) : $(LIB_O)
cd $(BUILD) && $(AR) $(LIBNAME) $(addprefix ../,$^)
TEST :=
define TEST_temp
TAR := $(BUILD)/$(notdir $(basename $(1)))
TEST := $(TEST) $$(TAR)
$$(TAR) : | $(BUILD)
$$(TAR) : $(LIBNAME)
$$(TAR) : test/$(1)
cd $(BUILD) && $(CC) $(CFLAGS) -I.. -L. -o $$(notdir $$@) ../$$< -lpbc
endef
$(foreach s,$(TESTSRCS),$(eval $(call TEST_temp,$(s))))
test : $(TEST) proto
PROTO :=
define PROTO_temp
TAR := $(BUILD)/$(notdir $(basename $(1)))
PROTO := $(PROTO) $$(TAR).pb
$$(TAR).pb : | $(BUILD)
$$(TAR).pb : test/$(1)
protoc -o$$@ $$<
endef
$(foreach s,$(PROTOSRCS),$(eval $(call PROTO_temp,$(s))))
proto : $(PROTO)
.PHONY : all lib test proto clean
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mrmriacle/pbc.git
git@gitee.com:mrmriacle/pbc.git
mrmriacle
pbc
pbc
master

搜索帮助