Commit 83507a6b authored by gejun's avatar gejun

Remove build_time related code; Replace test/COMAKE with test/Makefile; Unify…

Remove build_time related code; Replace test/COMAKE with test/Makefile; Unify most Makefile in examples
parent 38c40ad3
include config.mk
CPPFLAGS=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DNDEBUG -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\"$(shell git rev-parse --short HEAD)\"
CPPFLAGS=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\"$(shell git rev-parse --short HEAD)\"
#Add -fno-omit-frame-pointer: perf/tcmalloc-profiler uses frame pointers by default
CXXFLAGS=$(CPPFLAGS) -O2 -g -pipe -Wall -W -Werror -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x -include brpc/config.h
CFLAGS=$(CPPFLAGS) -O2 -g -pipe -Wall -W -Werror -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer
INCPATH=-I. $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
HDRPATHS=-I. $(addprefix -I, $(HDRS))
LIBPATHS = $(addprefix -L, $(LIBS))
SRCEXTS = .c .cc .cpp .proto
HDREXTS = .h .hpp
#dyanmic linking of libprotoc.so crashes on ubuntu when protoc-gen-mcpack is invoked
STATIC_LINKING += -lprotoc
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
STATIC_LINKINGS += -lprotoc
BASE_SOURCES = \
base/third_party/dmg_fp/g_fmt.cc \
......@@ -47,7 +45,6 @@ BASE_SOURCES = \
base/base_switches.cc \
base/big_endian.cc \
base/bind_helpers.cc \
base/build_time.cc \
base/callback_helpers.cc \
base/callback_internal.cc \
base/command_line.cc \
......@@ -171,25 +168,30 @@ BASE_SOURCES = \
BASE_PROTOS = $(filter %.proto,$(BASE_SOURCES))
BASE_CFAMILIES = $(filter-out %.proto,$(BASE_SOURCES))
BASE_OBJS = $(addsuffix .pb.o, $(basename $(BASE_PROTOS))) $(addsuffix .o, $(basename $(BASE_CFAMILIES)))
BASE_OBJS = $(BASE_PROTOS:.proto=.pb.o) $(addsuffix .o, $(basename $(BASE_CFAMILIES)))
BASE_DEBUG_OBJS = $(BASE_OBJS:.o=.dbg.o)
BVAR_DIRS = bvar bvar/detail
BVAR_SOURCES = $(foreach d,$(BVAR_DIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
BVAR_OBJS = $(addsuffix .o, $(basename $(BVAR_SOURCES)))
BVAR_DEBUG_OBJS = $(BVAR_OBJS:.o=.dbg.o)
BTHREAD_DIRS = bthread
BTHREAD_SOURCES = $(foreach d,$(BTHREAD_DIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
BTHREAD_OBJS = $(addsuffix .o, $(basename $(BTHREAD_SOURCES)))
BTHREAD_DEBUG_OBJS = $(BTHREAD_OBJS:.o=.dbg.o)
JSON2PB_DIRS = json2pb
JSON2PB_SOURCES = $(foreach d,$(JSON2PB_DIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
JSON2PB_OBJS = $(addsuffix .o, $(basename $(JSON2PB_SOURCES)))
JSON2PB_DEBUG_OBJS = $(JSON2PB_OBJS:.o=.dbg.o)
BRPC_DIRS = brpc brpc/details brpc/builtin brpc/policy
BRPC_SOURCES = $(foreach d,$(BRPC_DIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
BRPC_PROTOS = $(filter %.proto,$(BRPC_SOURCES))
BRPC_CFAMILIES = $(filter-out %.proto brpc/policy/baidu_naming_service.cpp brpc/policy/giano_authenticator.cpp,$(BRPC_SOURCES))
BRPC_OBJS = $(addsuffix .pb.o, $(basename $(BRPC_PROTOS))) $(addsuffix .o, $(basename $(BRPC_CFAMILIES)))
BRPC_OBJS = $(BRPC_PROTOS:.proto=.pb.o) $(addsuffix .o, $(basename $(BRPC_CFAMILIES)))
BRPC_DEBUG_OBJS = $(BRPC_OBJS:.o=.dbg.o)
MCPACK2PB_SOURCES = \
mcpack2pb/field_type.cpp \
......@@ -197,44 +199,77 @@ MCPACK2PB_SOURCES = \
mcpack2pb/parser.cpp \
mcpack2pb/serializer.cpp
MCPACK2PB_OBJS = idl_options.pb.o $(addsuffix .o, $(basename $(MCPACK2PB_SOURCES)))
MCPACK2PB_DEBUG_OBJS = $(MCPACK2PB_OBJS:.o=.dbg.o)
.PHONY:all
all: libbase.a libbvar.a libbthread.a libjson2pb.a libmcpack2pb.a protoc-gen-mcpack libbrpc.a output/include output/lib output/bin
.PHONY:debug
debug: libbase.dbg.a libbvar.dbg.a libbthread.dbg.a libjson2pb.dbg.a libmcpack2pb.dbg.a libbrpc.dbg.a
.PHONY:clean
clean:
clean:clean_debug
@echo "Cleaning"
@rm -rf libbase.a libbvar.a libbthread.a libjson2pb.a libmcpack2pb.a mcpack2pb/generator.o protoc-gen-mcpack libbrpc.a \
$(BASE_OBJS) $(BVAR_OBJS) $(BTHREAD_OBJS) $(JSON2PB_OBJS) $(MCPACK2PB_OBJS) $(BRPC_OBJS) \
output/include output/lib output/bin
.PHONY:clean_debug
clean_debug:
@rm -rf libbase.dbg.a libbvar.dbg.a libbthread.dbg.a libjson2pb.dbg.a libmcpack2pb.dbg.a libbrpc.dbg.a \
$(BASE_DEBUG_OBJS) $(BVAR_DEBUG_OBJS) $(BTHREAD_DEBUG_OBJS) $(JSON2PB_DEBUG_OBJS) $(MCPACK2PB_DEBUG_OBJS) $(BRPC_DEBUG_OBJS)
libbase.a:$(BASE_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libbase.dbg.a:$(BASE_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libbvar.a:$(BVAR_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libbvar.dbg.a:$(BVAR_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libbthread.a:$(BTHREAD_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libbthread.dbg.a:$(BTHREAD_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libjson2pb.a:$(JSON2PB_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libjson2pb.dbg.a:$(JSON2PB_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libmcpack2pb.a:$(MCPACK2PB_OBJS)
@echo "Packing $@"
@ar crs $@ $^
libmcpack2pb.dbg.a:$(MCPACK2PB_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
protoc-gen-mcpack:mcpack2pb/generator.o libmcpack2pb.a libbase.a libbthread.a libbvar.a
@echo "Linking $@"
@$(CXX) -o protoc-gen-mcpack $(LIBPATH) -Xlinker "-(" $^ -Xlinker "-)" $(LDFLAGS)
@$(CXX) -o $@ $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)"
libbrpc.a:$(BRPC_OBJS)
@echo "Packing $@"
@ar crs libbrpc.a $^
@ar crs $@ $^
libbrpc.dbg.a:$(BRPC_DEBUG_OBJS)
@echo "Packing $@"
@ar crs $@ $^
.PHONY:output/include
output/include:
......@@ -255,18 +290,30 @@ output/bin:protoc-gen-mcpack
@mkdir -p $@
@cp $^ $@
%.pb.cc %.pb.h:%.proto
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. --proto_path=$(PROTOBUF_INC) $<
@$(PROTOC) --cpp_out=. --proto_path=. --proto_path=$(PROTOBUF_HDR) $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) -DNDEBUG $< -o $@
%.dbg.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) -DNDEBUG $< -o $@
%.dbg.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.c
@echo "Compiling $@"
@$(CC) -c $(INCPATH) $(CFLAGS) $< -o $@
@$(CC) -c $(HDRPATHS) $(CFLAGS) -DNDEBUG $< -o $@
%.dbg.o:%.c
@echo "Compiling $@"
@$(CC) -c $(HDRPATHS) $(CFLAGS) $< -o $@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/build_time.h"
#include "base/logging.h"
#include "base/time/time.h"
namespace base {
Time GetBuildTime() {
Time integral_build_time;
// The format of __DATE__ and __TIME__ is specified by the ANSI C Standard,
// section 6.8.8.
//
// __DATE__ is exactly "Mmm DD YYYY".
// __TIME__ is exactly "hh:mm:ss".
const char kDateTime[] = __DATE__ " " __TIME__ " PST";
bool result = Time::FromString(kDateTime, &integral_build_time);
DCHECK(result);
return integral_build_time;
}
} // namespace base
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_BUILD_TIME_
#define BASE_BUILD_TIME_
#include "base/base_export.h"
#include "base/time/time.h"
namespace base {
// GetBuildTime returns the time at which the current binary was built.
//
// This uses the __DATE__ and __TIME__ macros, which don't trigger a rebuild
// when they change. However, official builds will always be rebuilt from
// scratch.
//
// Also, since __TIME__ doesn't include a timezone, this value should only be
// considered accurate to a day.
Time BASE_EXPORT GetBuildTime();
} // namespace base
#endif // BASE_BUILD_TIME_
......@@ -5,7 +5,7 @@ else
fi
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
# separately; see below.
TEMP=`getopt -o v: --long incs:,libs:,cc:,cxx: -n 'config_brpc' -- "$@"`
TEMP=`getopt -o v: --long headers:,libs:,cc:,cxx: -n 'config_brpc' -- "$@"`
if [ $? != 0 ] ; then >&2 $ECHO "Terminating..."; exit 1 ; fi
......@@ -17,7 +17,7 @@ CC=gcc
CXX=g++
while true; do
case "$1" in
--incs ) INCS="$(readlink -f $2)"; shift 2 ;;
--headers ) HDRS="$(readlink -f $2)"; shift 2 ;;
--libs ) LIBS="$(readlink -f $2)"; shift 2 ;;
--cc ) CC=$2; shift 2 ;;
--cxx ) CXX=$2; shift 2 ;;
......@@ -26,8 +26,8 @@ while true; do
esac
done
if [ -z "$INCS" ] || [ -z "$LIBS" ]; then
>&2 $ECHO "config_brpc: --incs=INCPATHS --libs=LIBPATHS must be specified"
if [ -z "$HDRS" ] || [ -z "$LIBS" ]; then
>&2 $ECHO "config_brpc: --headers=HDRPATHS --libs=LIBPATHS must be specified"
exit 1
fi
......@@ -52,7 +52,7 @@ find_bin() {
}
find_dir_of_header() {
find ${INCS} -path "*/$1" | head -n1 | sed "s|$1||g"
find ${HDRS} -path "*/$1" | head -n1 | sed "s|$1||g"
}
find_dir_of_header_or_die() {
local dir=$(find_dir_of_header $1)
......@@ -64,27 +64,27 @@ find_dir_of_header_or_die() {
fi
}
STATIC_LINKING=
DYNAMIC_LINKING="-lpthread -lrt -lssl -lcrypto -ldl -lz"
STATIC_LINKINGS=
DYNAMIC_LINKINGS="-lpthread -lrt -lssl -lcrypto -ldl -lz"
append_linking() {
if [ -f $1/lib${2}.a ]; then
STATIC_LINKING="${STATIC_LINKING} -l$2"
STATIC_LINKINGS="${STATIC_LINKINGS} -l$2"
else
DYNAMIC_LINKING="${DYNAMIC_LINKING} -l$2"
DYNAMIC_LINKINGS="${DYNAMIC_LINKINGS} -l$2"
fi
}
GFLAGS_DIR=$(find_dir_of_lib_or_die gflags)
append_linking $GFLAGS_DIR gflags
PROTOBUF_DIR=$(find_dir_of_lib_or_die protobuf)
append_linking $PROTOBUF_DIR protobuf
PROTOC_DIR=$(find_dir_of_lib_or_die protoc)
LEVELDB_DIR=$(find_dir_of_lib_or_die leveldb)
append_linking $LEVELDB_DIR leveldb
GFLAGS_LIB=$(find_dir_of_lib_or_die gflags)
append_linking $GFLAGS_LIB gflags
PROTOBUF_LIB=$(find_dir_of_lib_or_die protobuf)
append_linking $PROTOBUF_LIB protobuf
PROTOC_LIB=$(find_dir_of_lib_or_die protoc)
LEVELDB_LIB=$(find_dir_of_lib_or_die leveldb)
append_linking $LEVELDB_LIB leveldb
# required by leveldb
SNAPPY_DIR=$(find_dir_of_lib snappy)
if [ ! -z "$SNAPPY_DIR" ]; then
append_linking $SNAPPY_DIR snappy
SNAPPY_LIB=$(find_dir_of_lib snappy)
if [ ! -z "$SNAPPY_LIB" ]; then
append_linking $SNAPPY_LIB snappy
fi
PROTOC=$(which protoc 2>/dev/null)
......@@ -96,12 +96,12 @@ if [ -z "$PROTOC" ]; then
fi
fi
GFLAGS_INC=$(find_dir_of_header gflags/gflags.h)
PROTOBUF_INC=$(find_dir_of_header google/protobuf/message.h)
LEVELDB_INC=$(find_dir_of_header leveldb/db.h)
GFLAGS_HDR=$(find_dir_of_header gflags/gflags.h)
PROTOBUF_HDR=$(find_dir_of_header google/protobuf/message.h)
LEVELDB_HDR=$(find_dir_of_header leveldb/db.h)
INCS2=$($ECHO "$GFLAGS_INC\n$PROTOBUF_INC\n$LEVELDB_INC" | sort | uniq)
LIBS2=$($ECHO "$GFLAGS_DIR\n$PROTOBUF_DIR\n$LEVELDB_DIR\n$SNAPPY_DIR\n$PROTOC_DIR" | sort | uniq)
HDRS2=$($ECHO "$GFLAGS_HDR\n$PROTOBUF_HDR\n$LEVELDB_HDR" | sort | uniq)
LIBS2=$($ECHO "$GFLAGS_LIB\n$PROTOBUF_LIB\n$LEVELDB_LIB\n$SNAPPY_LIB\n$PROTOC_LIB" | sort | uniq)
absent_in_the_list() {
TMP=$($ECHO "`$ECHO "$1\n$2" | sort | uniq`")
......@@ -112,47 +112,73 @@ absent_in_the_list() {
}
#can't use \n in texts because sh does not support -e
CONTENT="INCS=$($ECHO $INCS2)"
CONTENT="HDRS=$($ECHO $HDRS2)"
CONTENT="${CONTENT}\nLIBS=$($ECHO $LIBS2)"
CONTENT="${CONTENT}\nPROTOC=$PROTOC"
CONTENT="${CONTENT}\nPROTOBUF_INC=$PROTOBUF_INC"
CONTENT="${CONTENT}\nPROTOBUF_HDR=$PROTOBUF_HDR"
CONTENT="${CONTENT}\nCC=$CC"
CONTENT="${CONTENT}\nCXX=$CXX"
CONTENT="${CONTENT}\nSTATIC_LINKING=$STATIC_LINKING"
CONTENT="${CONTENT}\nDYNAMIC_LINKING=$DYNAMIC_LINKING"
CONTENT="${CONTENT}\nifeq (\$(LINK_PERFTOOLS), 1)"
CONTENT="${CONTENT}\nSTATIC_LINKINGS=$STATIC_LINKINGS"
CONTENT="${CONTENT}\nDYNAMIC_LINKINGS=$DYNAMIC_LINKINGS"
CONTENT="${CONTENT}\nifeq (\$(NEED_GPERFTOOLS), 1)"
# required by cpu/heap profiler
TCMALLOC_DIR=$(find_dir_of_lib tcmalloc_and_profiler)
if [ ! -z "$TCMALLOC_DIR" ]; then
if absent_in_the_list "$TCMALLOC_DIR" "$LIBS2"; then
CONTENT="${CONTENT}\n LIBS+=$TCMALLOC_DIR"
LIBS2="${LIBS2}\n$TCMALLOC_DIR"
TCMALLOC_LIB=$(find_dir_of_lib tcmalloc_and_profiler)
if [ ! -z "$TCMALLOC_LIB" ]; then
if absent_in_the_list "$TCMALLOC_LIB" "$LIBS2"; then
CONTENT="${CONTENT}\n LIBS+=$TCMALLOC_LIB"
LIBS2="${LIBS2}\n$TCMALLOC_LIB"
fi
TCMALLOC_INC=$(find_dir_of_header google/tcmalloc.h)
if absent_in_the_list "$TCMALLOC_INC" "$INCS2"; then
CONTENT="${CONTENT}\n INCS+=$TCMALLOC_INC"
INCS2="${INCS2}\n$TCMALLOC_INC"
TCMALLOC_HDR=$(find_dir_of_header google/tcmalloc.h)
if absent_in_the_list "$TCMALLOC_HDR" "$HDRS2"; then
CONTENT="${CONTENT}\n HDRS+=$TCMALLOC_HDR"
HDRS2="${HDRS2}\n$TCMALLOC_HDR"
fi
if [ -f $TCMALLOC_DIR/libtcmalloc_and_profiler.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKING+=-ltcmalloc_and_profiler"
if [ -f $TCMALLOC_LIB/libtcmalloc_and_profiler.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKINGS+=-ltcmalloc_and_profiler"
else
CONTENT="${CONTENT}\n DYNAMIC_LINKING+=-ltcmalloc_and_profiler"
CONTENT="${CONTENT}\n DYNAMIC_LINKINGS+=-ltcmalloc_and_profiler"
fi
fi
# required by tcmalloc('s profiler)
UNWIND_DIR=$(find_dir_of_lib unwind)
if [ ! -z "$UNWIND_DIR" ]; then
if absent_in_the_list "$UNWIND_DIR" "$LIBS2"; then
CONTENT="${CONTENT}\n LIBS+=$UNWIND_DIR"
LIBS2="${LIBS2}\n$UNWIND_DIR"
UNWIND_LIB=$(find_dir_of_lib unwind)
if [ ! -z "$UNWIND_LIB" ]; then
if absent_in_the_list "$UNWIND_LIB" "$LIBS2"; then
CONTENT="${CONTENT}\n LIBS+=$UNWIND_LIB"
LIBS2="${LIBS2}\n$UNWIND_LIB"
fi
if [ -f $UNWIND_DIR/libunwind.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKING+=-lunwind"
if [ -f $UNWIND_LIB/libunwind.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKINGS+=-lunwind"
else
CONTENT="${CONTENT}\n DYNAMIC_LINKING+=-lunwind"
CONTENT="${CONTENT}\n DYNAMIC_LINKINGS+=-lunwind"
fi
# required by libunwind
CONTENT="${CONTENT}\n DYNAMIC_LINKING+=-llzma"
CONTENT="${CONTENT}\n DYNAMIC_LINKINGS+=-llzma"
fi
CONTENT="${CONTENT}\nendif"
# required by UT
#gtest
GTEST_LIB=$(find_dir_of_lib gtest)
GTEST_HDR=$(find_dir_of_header gtest/gtest.h)
CONTENT="${CONTENT}\nifeq (\$(NEED_GTEST), 1)"
CONTENT="${CONTENT}\n HDRS+=$GTEST_HDR"
CONTENT="${CONTENT}\n LIBS+=$GTEST_LIB"
if [ -f $GTEST_LIB/libgtest.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKINGS+=-lgtest -lgtest_main"
else
CONTENT="${CONTENT}\n DYNAMIC_LINKINGS+=-lgtest -lgtest_main"
fi
CONTENT="${CONTENT}\nendif"
#gmock
GMOCK_LIB=$(find_dir_of_lib gmock)
GMOCK_HDR=$(find_dir_of_header gmock/gmock.h)
CONTENT="${CONTENT}\nifeq (\$(NEED_GMOCK), 1)"
CONTENT="${CONTENT}\n HDRS+=$GMOCK_HDR"
CONTENT="${CONTENT}\n LIBS+=$GMOCK_LIB"
if [ -f $GMOCK_LIB/libgmock.a ]; then
CONTENT="${CONTENT}\n STATIC_LINKINGS+=-lgmock -lgmock_main"
else
CONTENT="${CONTENT}\n DYNAMIC_LINKINGS+=-lgmock -lgmock_main"
fi
CONTENT="${CONTENT}\nendif"
$ECHO "$CONTENT" > config.mk
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
BRPC_PATH = ../../
include $(BRPC_PATH)/config.mk
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
STATIC_LINKINGS += -lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTOS = $(wildcard *.proto)
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
PROTO_OBJS = $(PROTOS:.proto=.pb.o)
PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
......@@ -26,20 +25,20 @@ clean:
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
@$(PROTOC) --cpp_out=. --proto_path=. $(PROTOC_EXTRA_ARGS) $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --plugin=protoc-gen-mcpack=$(BRPC_PATH)/bin/protoc-gen-mcpack --proto_path=. --proto_path=$(BRPC_PATH)/include --proto_path=$(PROTOBUF_INC) --cpp_out=. --mcpack_out=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
PROTOC_EXTRA_ARGS = --plugin=protoc-gen-mcpack=$(BRPC_PATH)/output/bin/protoc-gen-mcpack --proto_path=$(BRPC_PATH)/output/include --proto_path=$(PROTOBUF_HDR) --mcpack_out=.
include ../echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
NEED_GPERFTOOLS=1
BRPC_PATH=../../
include $(BRPC_PATH)/config.mk
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
ifeq ($(NEED_GPERFTOOLS), 1)
CPPFLAGS+=-DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
STATIC_LINKINGS += -lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
CLIENT_SOURCES = http_client.cpp
BENCHMARK_SOURCES = benchmark_http.cpp
SERVER_SOURCES = http_server.cpp
PROTOS = http.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
PROTO_OBJS = $(PROTOS:.proto=.pb.o)
PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
BENCHMARK_OBJS = $(addsuffix .o, $(basename $(BENCHMARK_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: http_client benchmark_http http_server
......@@ -33,15 +32,15 @@ clean:
http_client:$(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
benchmark_http:$(BENCHMARK_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
http_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
%.pb.cc:%.proto
@echo "Generating $@"
......@@ -49,8 +48,8 @@ http_server:$(PROTO_OBJS) $(SERVER_OBJS)
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
include ../../config.mk
BRPC_PATH = ../../output
BRPC_PATH = ../../
include $(BRPC_PATH)/config.mk
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS += $(wildcard $(BRPC_PATH)/lib/lib*.a)
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
STATIC_LINKINGS += -lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
SOURCES = $(wildcard *.cpp)
OBJS = $(addsuffix .o, $(basename $(SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: memcache_client
......@@ -20,12 +19,12 @@ clean:
memcache_client:$(OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
NEED_GPERFTOOLS=1
BRPC_PATH=../..
include $(BRPC_PATH)/config.mk
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
ifeq ($(NEED_GPERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
HDRPATHS=-I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS=-L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
STATIC_LINKINGS+=-lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTOS = $(wildcard *.proto)
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
PROTO_OBJS = $(PROTOS:.proto=.pb.o)
PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
......@@ -31,20 +30,20 @@ clean:
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
@$(PROTOC) --cpp_out=. --proto_path=. $(PROTOC_EXTRA_ARGS) $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --plugin=protoc-gen-mcpack=$(BRPC_PATH)/bin/protoc-gen-mcpack --proto_path=. --proto_path=$(BRPC_PATH)/include --proto_path=$(PROTOBUF_INC) --cpp_out=. --mcpack_out=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
PROTOC_EXTRA_ARGS = --plugin=protoc-gen-mcpack=$(BRPC_PATH)/output/bin/protoc-gen-mcpack --proto_path=$(BRPC_PATH)/output/include --proto_path=$(PROTOBUF_HDR) --mcpack_out=.
include ../multi_threaded_echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS =
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
BRPC_PATH = ../../
include $(BRPC_PATH)/config.mk
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
DYNAMIC_LINKING += -lreadline -lncurses
HDRPATHS = -I$(BRPC_PATH)/output/include $(addprefix -I, $(HDRS))
LIBPATHS = -L$(BRPC_PATH)/output/lib $(addprefix -L, $(LIBS))
DYNAMIC_LINKINGS += -lreadline -lncurses
STATIC_LINKINGS += -lbase -lbvar -lbthread -lbrpc -ljson2pb -lmcpack2pb
PRESS_SOURCES = redis_press.cpp
CLI_SOURCES = redis_cli.cpp
PRESS_OBJS = $(addsuffix .o, $(basename $(PRESS_SOURCES)))
CLI_OBJS = $(addsuffix .o, $(basename $(CLI_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: redis_press redis_cli
......@@ -24,16 +23,16 @@ clean:
redis_press:$(PRESS_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
redis_cli:$(CLI_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
@$(CXX) $(LIBPATHS) -Xlinker "-(" $^ -Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS) -Xlinker "-)" -o $@
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
LINK_PERFTOOLS=1
include ../../config.mk
BRPC_PATH=../../output
CPPFLAGS=-std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS=$(CPPFLAGS)
CFLAGS=$(CPPFLAGS)
INCPATH=-I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS=$(wildcard $(BRPC_PATH)/lib/lib*.a)
ifeq ($(LINK_PERFTOOLS), 1)
CPPFLAGS += -DBRPC_ENABLE_CPU_PROFILER -DBRPC_ENABLE_HEAP_PROFILER
endif
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../multi_threaded_echo_c++/Makefile
include ../../config.mk
BRPC_PATH = ../../output
CPPFLAGS = -std=c++0x -g -DNDEBUG -O2 -pipe -W -Wall -Werror -fPIC -Wno-deprecated -Wno-unused-parameter -fno-omit-frame-pointer -D__const__=
CXXFLAGS = $(CPPFLAGS)
INCPATH = -I$(BRPC_PATH)/include $(addprefix -I, $(INCS))
LIBPATH = $(addprefix -L, $(LIBS))
BRPC_LIBS = $(wildcard $(BRPC_PATH)/lib/lib*.a)
CLIENT_SOURCES = client.cpp
SERVER_SOURCES = server.cpp
PROTOS = echo.proto
PROTO_OBJS = $(addsuffix .pb.o, $(basename $(PROTOS)))
PROTO_GENS = $(addsuffix .pb.h, $(basename $(PROTOS))) $(addsuffix .pb.cc, $(basename $(PROTOS)))
CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
SERVER_OBJS = $(addsuffix .o, $(basename $(SERVER_SOURCES)))
LDFLAGS = -Wl,-Bstatic $(STATIC_LINKING) -Wl,-Bdynamic $(DYNAMIC_LINKING)
.PHONY:all
all: echo_client echo_server
.PHONY:clean
clean:
@echo "Cleaning"
@rm -rf echo_client echo_server $(PROTO_GENS) $(PROTO_OBJS) $(CLIENT_OBJS) $(SERVER_OBJS)
echo_client:$(PROTO_OBJS) $(CLIENT_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
echo_server:$(PROTO_OBJS) $(SERVER_OBJS)
@echo "Linking $@"
@$(CXX) $(LIBPATH) -Xlinker "-(" $^ $(BRPC_LIBS) -Xlinker "-)" $(LDFLAGS) -o $@
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(INCPATH) $(CXXFLAGS) $< -o $@
include ../echo_c++/Makefile
This diff is collapsed.
NEED_GPERFTOOLS=1
NEED_GTEST=1
NEED_GMOCK=1
include ../config.mk
CPPFLAGS=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
CPPFLAGS+=-DUNIT_TEST -Dprivate=public -Dprotected=public -DBVAR_NOT_LINK_DEFAULT_VARIABLES
CXXFLAGS=$(CPPFLAGS) -g -pipe -Wall -W -Werror -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x
CFLAGS=$(CPPFLAGS) -g -pipe -Wall -W -Werror -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer
HDRPATHS=-I. -I.. $(addprefix -I, $(HDRS))
LIBPATHS=$(addprefix -L, $(LIBS))
LDFLAGS=-Wl,-Bstatic $(STATIC_LINKINGS) -Wl,-Bdynamic $(DYNAMIC_LINKINGS)
TEST_BASE_SOURCES = \
at_exit_unittest.cc \
atomicops_unittest.cc \
barrier_closure_unittest.cc \
base64_unittest.cc \
big_endian_unittest.cc \
bind_unittest.cc \
bits_unittest.cc \
callback_helpers_unittest.cc \
callback_list_unittest.cc \
callback_unittest.cc \
cancelable_callback_unittest.cc \
command_line_unittest.cc \
hash_tables_unittest.cc \
linked_list_unittest.cc \
mru_cache_unittest.cc \
small_map_unittest.cc \
stack_container_unittest.cc \
cpu_unittest.cc \
crash_logging_unittest.cc \
leak_tracker_unittest.cc \
proc_maps_linux_unittest.cc \
stack_trace_unittest.cc \
environment_unittest.cc \
file_util_unittest.cc \
dir_reader_posix_unittest.cc \
file_path_unittest.cc \
file_unittest.cc \
path_service_unittest.cc \
scoped_temp_dir_unittest.cc \
guid_unittest.cc \
hash_unittest.cc \
lazy_instance_unittest.cc \
md5_unittest.cc \
aligned_memory_unittest.cc \
linked_ptr_unittest.cc \
ref_counted_memory_unittest.cc \
ref_counted_unittest.cc \
scoped_ptr_unittest.cc \
scoped_vector_unittest.cc \
singleton_unittest.cc \
weak_ptr_unittest.cc \
observer_list_unittest.cc \
file_descriptor_shuffle_unittest.cc \
process_metrics_unittest.cc \
process_util_unittest.cc \
rand_util_unittest.cc \
safe_numerics_unittest.cc \
scoped_clear_errno_unittest.cc \
scoped_generic_unittest.cc \
security_unittest.cc \
sha1_unittest.cc \
stl_util_unittest.cc \
nullable_string16_unittest.cc \
safe_sprintf_unittest.cc \
string16_unittest.cc \
stringprintf_unittest.cc \
string_number_conversions_unittest.cc \
string_piece_unittest.cc \
string_split_unittest.cc \
string_tokenizer_unittest.cc \
string_util_unittest.cc \
stringize_macros_unittest.cc \
sys_string_conversions_unittest.cc \
utf_offset_string_conversions_unittest.cc \
utf_string_conversions_unittest.cc \
cancellation_flag_unittest.cc \
condition_variable_unittest.cc \
lock_unittest.cc \
waitable_event_unittest.cc \
sys_info_unittest.cc \
type_traits_unittest.cc \
non_thread_safe_unittest.cc \
platform_thread_unittest.cc \
simple_thread_unittest.cc \
thread_checker_unittest.cc \
thread_collision_warner_unittest.cc \
thread_id_name_manager_unittest.cc \
thread_local_storage_unittest.cc \
thread_local_unittest.cc \
watchdog_unittest.cc \
pr_time_unittest.cc \
time_unittest.cc \
version_unittest.cc \
logging_unittest.cc \
tuple_unittest.cc \
xdg_util_unittest.cc \
cacheline_unittest.cpp \
class_name_unittest.cpp \
endpoint_unittest.cpp \
unique_ptr_unittest.cpp \
errno_unittest.cpp \
fd_guard_unittest.cpp \
file_watcher_unittest.cpp \
find_cstr_unittest.cpp \
scoped_lock_unittest.cpp \
status_unittest.cpp \
string_printf_unittest.cpp \
string_splitter_unittest.cpp \
synchronous_event_unittest.cpp \
temp_file_unittest.cpp \
baidu_thread_local_unittest.cpp \
baidu_time_unittest.cpp \
flat_map_unittest.cpp \
crc32c_unittest.cc \
multiprocess_func_list.cc \
test_switches.cc \
test_timeouts.cc \
scoped_locale.cc \
multiprocess_test.cc \
test_file_util.cc \
test_file_util_linux.cc \
base_unittest_main.cpp
TEST_BASE_OBJS = $(addsuffix .o, $(basename $(TEST_BASE_SOURCES)))
TEST_BVAR_SOURCES = $(wildcard bvar_*_unittest.cpp)
TEST_BVAR_OBJS = $(addsuffix .o, $(basename $(TEST_BVAR_SOURCES)))
TEST_BTHREAD_SOURCES = $(wildcard bthread_*unittest.cpp)
TEST_BRPC_SOURCES = $(wildcard brpc_*unittest.cpp)
TEST_PROTO_SOURCES = $(wildcard *.proto)
TEST_PROTO_OBJS = $(TEST_PROTO_SOURCES:.proto=.pb.o)
TEST_BINS = test_base test_bvar $(TEST_BTHREAD_SOURCES:.cpp=) $(TEST_BRPC_SOURCES:.cpp=)
.PHONY:all
all: $(TEST_BINS)
.PHONY:clean
clean:clean_bins
@echo "Cleaning"
@rm -rf $(TEST_BASE_OBJS) $(TEST_BVAR_OBJS) $(TEST_BTHREAD_OBJS) \
$(TEST_BRPC_OBJS) $(TEST_PROTO_OBJS)
.PHONY:clean_bins
clean_bins:
@rm -rf $(TEST_BINS)
../libbase.dbg.a:
@$(MAKE) -C.. libbase.dbg.a
../libbvar.dbg.a:
@$(MAKE) -C.. libbvar.dbg.a
../libbthread.dbg.a:
@$(MAKE) -C.. libbthread.dbg.a
../libbrpc.dbg.a:
@$(MAKE) -C.. libbrpc.dbg.a
../libmcpack2pb.dbg.a:
@$(MAKE) -C.. libmcpack2pb.dbg.a
../libjson2pb.dbg.a:
@$(MAKE) -C.. libjson2pb.dbg.a
test_base:$(TEST_BASE_OBJS) ../libbase.dbg.a
@echo "Linking $@"
@$(CXX) -o $@ $(LIBPATHS) -Xlinker "-(" $^ $(LDFLAGS) -Xlinker "-)"
test_bvar:$(TEST_BVAR_OBJS) ../libbase.dbg.a ../libbvar.dbg.a
@echo "Linking $@"
@$(CXX) -o $@ $(LIBPATHS) -Xlinker "-(" $^ $(LDFLAGS) -Xlinker "-)"
bthread%unittest:bthread%unittest.o ../libbase.dbg.a ../libbvar.dbg.a ../libbthread.dbg.a
@echo "Linking $@"
@$(CXX) -o $@ $(LIBPATHS) -Xlinker "-(" $^ $(LDFLAGS) -Xlinker "-)"
brpc_%_unittest:brpc_%_unittest.o $(TEST_PROTO_OBJS) ../libbase.dbg.a ../libbvar.dbg.a ../libbthread.dbg.a ../libbrpc.dbg.a ../libmcpack2pb.dbg.a ../libjson2pb.dbg.a
@echo "Linking $@"
@$(CXX) -o $@ $(LIBPATHS) -Xlinker "-(" $^ $(LDFLAGS) -Xlinker "-)"
%.pb.cc:%.proto
@echo "Generating $@"
@$(PROTOC) --cpp_out=. --proto_path=. --proto_path=.. --proto_path=$(PROTOBUF_HDR) $<
%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
%.o:%.c
@echo "Compiling $@"
@$(CC) -c $(HDRPATHS) $(CFLAGS) $< -o $@
......@@ -56,7 +56,7 @@ protected:
};
TEST_F(SocketMapTest, idle_timeout) {
const int TIMEOUT = 2;
const int TIMEOUT = 1;
const int NTHREAD = 10;
brpc::FLAGS_defer_close_second = TIMEOUT;
pthread_t tids[NTHREAD];
......@@ -69,7 +69,7 @@ TEST_F(SocketMapTest, idle_timeout) {
brpc::SocketId id;
// Socket still exists since it has not reached timeout yet
ASSERT_EQ(0, brpc::SocketMapFind(g_endpoint, &id));
sleep(TIMEOUT + 2);
sleep(TIMEOUT + 1);
// Socket should be removed after timeout
ASSERT_EQ(-1, brpc::SocketMapFind(g_endpoint, &id));
......@@ -79,7 +79,7 @@ TEST_F(SocketMapTest, idle_timeout) {
ASSERT_EQ(0, brpc::SocketMapFind(g_endpoint, &id));
// Change `FLAGS_idle_timeout_second' to 0 to disable checking
brpc::FLAGS_defer_close_second = 0;
sleep(2);
sleep(1);
// And then Socket should be removed
ASSERT_EQ(-1, brpc::SocketMapFind(g_endpoint, &id));
......@@ -95,7 +95,7 @@ TEST_F(SocketMapTest, idle_timeout) {
id = ptr->id();
ptr->ReturnToPool();
ptr.reset(NULL);
sleep(TIMEOUT + 2);
sleep(TIMEOUT + 1);
// Pooled connection should be `ReleaseAdditionalReference',
// which destroyed the Socket. As a result `GetSocketFromPool'
// should return a new one
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/build_time.h"
#include <gtest/gtest.h>
TEST(BuildTime, DateLooksValid) {
char build_date[] = __DATE__;
EXPECT_EQ(11u, strlen(build_date));
EXPECT_EQ(' ', build_date[3]);
EXPECT_EQ(' ', build_date[6]);
}
TEST(BuildTime, TimeLooksValid) {
char build_time[] = __TIME__;
EXPECT_EQ(8u, strlen(build_time));
EXPECT_EQ(':', build_time[2]);
EXPECT_EQ(':', build_time[5]);
}
TEST(BuildTime, DoesntCrash) {
// Since __DATE__ isn't updated unless one does a clobber build, we can't
// really test the value returned by it, except to check that it doesn't
// crash.
base::GetBuildTime();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment