Skip to content

Commit

Permalink
Add proto to make all
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebore committed Mar 26, 2015
1 parent e16e957 commit 679a1aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ install:
- git clone https://github.com/google/snappy
- ( cd snappy && sh ./autogen.sh && ./configure && make -j2 && sudo make install )
- sudo apt-get install zlib1g-dev
script: make proto && make -j4 && make install
script: make -j4 && make install
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ INC=src/sofa/pbrpc/pbrpc.h src/sofa/pbrpc/closure_helper.h src/sofa/pbrpc/closur
src/sofa/pbrpc/builtin_service.proto src/sofa/pbrpc/builtin_service.pb.h

LIB=libsofa-pbrpc.a
LIB_SRC=$(wildcard src/sofa/pbrpc/*.cc)
LIB_OBJ=$(patsubst %.cc,%.o,$(LIB_SRC))
PROTO_FILE=$(wildcard src/sofa/pbrpc/*.proto)
PROTO_SRC=$(PROTO_FILE:.proto=.pb.cc)
PROTO_HEADER=$(PROTO_FILE:.proto=.pb.h)

LIB_SRC=$(wildcard src/sofa/pbrpc/*.cc) $(PROTO_SRC)
LIB_OBJ=$(patsubst %.cc,%.o,$(LIB_SRC))

BIN=sofa-pbrpc-client
BIN_SRC=$(wildcard src/sofa/pbrpc/http-agent/*.cc)
BIN_OBJ=$(patsubst %.cc,%.o,$(BIN_SRC))
Expand Down Expand Up @@ -84,7 +85,9 @@ check_depends:
clean:
rm -f $(LIB) $(LIB_OBJ) $(BIN) $(BIN_OBJ) $(PROTO_HEADER) $(PROTO_SRC)

proto:
proto: $(PROTO_SRC) $(PROTO_HEADER)

last:
cd src && sh compile_proto.sh ${PROTOBUF_DIR}/include

rebuild: clean all
Expand All @@ -98,6 +101,11 @@ $(BIN): $(LIB) $(BIN_OBJ)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c$< -o $@

%.pb.cc %.pb.h: %.proto
$(PROTOC) --proto_path=${PROTOBUF_DIR}/include --proto_path=/usr/local/include \
--proto_path=./src/sofa/pbrpc \
--cpp_out=./src/proto $<j

build: $(LIB) $(BIN)
@echo
@echo 'Build succeed, run "make install" to install sofa-pbrpc.'
Expand Down

0 comments on commit 679a1aa

Please sign in to comment.