Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 708A82009C6 for ; Tue, 31 May 2016 19:43:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6EFF5160A44; Tue, 31 May 2016 17:43:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8F3B01609AD for ; Tue, 31 May 2016 19:43:32 +0200 (CEST) Received: (qmail 10551 invoked by uid 500); 31 May 2016 17:43:31 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 10538 invoked by uid 99); 31 May 2016 17:43:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 17:43:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 91190DFB74; Tue, 31 May 2016 17:43:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: eclark@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-15851 Makefile update for build env Date: Tue, 31 May 2016 17:43:31 +0000 (UTC) archived-at: Tue, 31 May 2016 17:43:33 -0000 Repository: hbase Updated Branches: refs/heads/HBASE-14850 f49f262f3 -> 5b10031a1 HBASE-15851 Makefile update for build env 1) Makefile to compile protobuf sources which are extracted in build 2) Added -O2 and -D_GLIBCXX_USE_CXX11_ABI=0 compilation flags 3) Header files added in Makefile Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5b10031a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5b10031a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5b10031a Branch: refs/heads/HBASE-14850 Commit: 5b10031a1b1821a4403f63db1728e9f380af14f5 Parents: f49f262 Author: sudeeps Authored: Sun May 22 09:38:47 2016 +1000 Committer: Elliott Clark Committed: Fri May 27 11:32:43 2016 -0700 ---------------------------------------------------------------------- hbase-native-client/Makefile | 132 +++++++++++++++++++++++------ hbase-native-client/Makefile.protos | 53 ++++++++++++ hbase-native-client/core/meta-utils.h | 2 +- 3 files changed, 159 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/5b10031a/hbase-native-client/Makefile ---------------------------------------------------------------------- diff --git a/hbase-native-client/Makefile b/hbase-native-client/Makefile index 826233f..7e68b6a 100644 --- a/hbase-native-client/Makefile +++ b/hbase-native-client/Makefile @@ -1,37 +1,115 @@ -## -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -build: - $(shell buck build core/... ) +#use "gcc" to compile source files +CC:=g++ +LD:=g++ + +DEBUG_PATH = build/debug +RELEASE_PATH = build/release +PROTO_SRC_DIR = build/if +MODULES = connection core serde test-util utils +SRC_DIR = $(MODULES) +DEBUG_BUILD_DIR = $(addprefix $(DEBUG_PATH)/,$(MODULES)) +RELEASE_BUILD_DIR = $(addprefix $(RELEASE_PATH)/,$(MODULES)) +INCLUDE_DIR = . build/ -check: - $(shell buck test --all --no-results-cache ) +#flags to pass to the CPP compiler & linker +CPPFLAGS_DEBUG = -D_GLIBCXX_USE_CXX11_ABI=0 -g -Wall -std=c++14 -pedantic -fPIC +CPPFLAGS_RELEASE = -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG -O2 -Wall -std=c++14 -pedantic -fPIC +LDFLAGS = -lprotobuf -lzookeeper_mt -lsasl2 -lfolly -lwangle +LINKFLAG = -shared -doc: - $(shell doxygen hbase.doxygen > /dev/null ) +#define list of source files and object files +SRC = $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cc)) +PROTOSRC = $(patsubst %.proto, $(addprefix build/,%.pb.cc),$(wildcard if/*.proto)) +DEPS = $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.h)) +PROTODEPS = $(patsubst %.proto, $(addprefix build/,%.pb.h),$(wildcard if/*.proto)) +DEBUG_OBJ = $(patsubst %.cc,$(DEBUG_PATH)/%.o,$(SRC)) +DEBUG_OBJ += $(patsubst %.cc,$(DEBUG_PATH)/%.o,$(PROTOSRC)) +RELEASE_OBJ = $(patsubst %.cc,$(RELEASE_PATH)/%.o,$(SRC)) +INCLUDES = $(addprefix -I,$(INCLUDE_DIR)) + +LIB_DIR = /usr/local +LIB_LIBDIR = $(LIB_DIR)/lib +LIB_INCDIR = $(LIB_DIR)/include +LIB_RELEASE=$(RELEASE_PATH)/libHbaseClient.so +ARC_RELEASE=$(RELEASE_PATH)/libHbaseClient.a +LIB_DEBUG=$(DEBUG_PATH)/libHbaseClient_d.so +ARC_DEBUG=$(DEBUG_PATH)/libHbaseClient_d.a + +vpath %.cc $(SRC_DIR) + +$(LIB_DEBUG): $(DEBUG_BUILD_DIR) +define make-goal-dbg +$1/%.o: %.cc $(DEPS) $(PROTODEPS) $(PROTOSRC) + $(CC) -c $$< -o $$@ $(CPPFLAGS_DEBUG) $(INCLUDES) +endef + +$(LIB_RELEASE): $(RELEASE_BUILD_DIR) +define make-goal-rel +$1/%.o: %.cc $(DEPS) $(PROTODEPS) $(PROTOSRC) + $(CC) -c $$< -o $$@ $(CPPFLAGS_RELEASE) $(INCLUDES) +endef + +.PHONY: all clean install + +build: checkdirs protos $(LIB_DEBUG) $(LIB_RELEASE) $(ARC_DEBUG) $(ARC_RELEASE) + +checkdirs: $(DEBUG_BUILD_DIR) $(RELEASE_BUILD_DIR) $(PROTO_SRC_DIR) + +protos: createprotosrc + @make all -f Makefile.protos + +createprotosrc: $(PROTO_SRC_DIR) + @protoc --proto_path=if --cpp_out=$(PROTO_SRC_DIR) if/*.proto + +install: + cp $(LIB_RELEASE) $(LIB_LIBDIR)/libHbaseClient.so + cp $(ARC_RELEASE) $(LIB_LIBDIR)/libHbaseClient.a + cp $(LIB_DEBUG) $(LIB_LIBDIR)/libHbaseClient_d.so + cp $(ARC_DEBUG) $(LIB_LIBDIR)/libHbaseClient_d.a + +$(PROTO_SRC_DIR): + @mkdir -p $@ + +$(DEBUG_BUILD_DIR): + @mkdir -p $@ +$(RELEASE_BUILD_DIR): + @mkdir -p $@ + +$(ARC_DEBUG): $(DEBUG_OBJ) + ar rcs $@ $^ + +$(ARC_RELEASE): $(RELEASE_OBJ) + ar rcs $@ $^ + +$(LIB_RELEASE): $(RELEASE_OBJ) + $(LD) $(LINKFLAG) -o $@ $(LDFLAGS) $(RELEASE_OBJ) + +$(LIB_DEBUG): $(DEBUG_OBJ) + $(LD) $(LINKFLAG) -o $@ $(LDFLAGS) $(DEBUG_OBJ) + +#to clean re-compilable files clean: - $(shell rm -rf docs ) + @rm -rf $(DEBUG_BUILD_DIR) $(RELEASE_BUILD_DIR) $(LIB_RELEASE) $(LIB_DEBUG) $(ARC_RELEASE) $(ARC_DEBUG) docs buck-out build + +$(foreach bdir,$(DEBUG_BUILD_DIR), $(eval $(call make-goal-dbg,$(bdir)))) + +$(foreach bdir,$(RELEASE_BUILD_DIR),$(eval $(call make-goal-rel,$(bdir)))) + +check: + $(shell buck test --all --no-results-cache) + +doc: + $(shell doxygen hbase.doxygen > /dev/null) help: @echo "Available targets:" @echo "" - @echo " build : will build everything." - @echo " clean : will remove the docs folder" - @echo " check : will test everything." + @echo " build : will build everything." + @echo " clean : will remove the docs folder, object files and local libraries" + @echo " install : will copy the libs to $(LIB_LIBDIR). super user priviliege would be required." + @echo " check : will test everything." + @echo " protos : will build the corresponding sources for protobufs present in if/ directory." all: build doc check + http://git-wip-us.apache.org/repos/asf/hbase/blob/5b10031a/hbase-native-client/Makefile.protos ---------------------------------------------------------------------- diff --git a/hbase-native-client/Makefile.protos b/hbase-native-client/Makefile.protos new file mode 100644 index 0000000..4f1727a --- /dev/null +++ b/hbase-native-client/Makefile.protos @@ -0,0 +1,53 @@ +#use "gcc" to compile source files +CC:=g++ +LD:=g++ + +DEBUG_PATH = build/debug +RELEASE_PATH = build/release +MODULES = build/if +SRC_DIR = $(MODULES) +DEBUG_BUILD_DIR = $(addprefix $(DEBUG_PATH)/,$(MODULES)) +RELEASE_BUILD_DIR = $(addprefix $(RELEASE_PATH)/,$(MODULES)) +INCLUDE_DIR = . + +#flags to pass to the CPP compiler & linker +CPPFLAGS_DEBUG = -D_GLIBCXX_USE_CXX11_ABI=0 -g -Wall -std=c++14 -pedantic -fPIC +CPPFLAGS_RELEASE = -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG -O2 -Wall -std=c++14 -pedantic -fPIC + +#define list of source files and object files +SRC = $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cc)) +DEPS = $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.h)) +DEBUG_OBJ = $(patsubst %.cc,$(DEBUG_PATH)/%.o,$(SRC)) +RELEASE_OBJ = $(patsubst %.cc,$(RELEASE_PATH)/%.o,$(SRC)) +INCLUDES = $(addprefix -I,$(INCLUDE_DIR)) + +vpath %.cc $(SRC_DIR) + +$(DEBUG_OBJ): $(DEBUG_BUILD_DIR) +define make-goal-dbg +$1/%.o: %.cc $(DEPS) + $(CC) -c $$< -o $$@ $(CPPFLAGS_DEBUG) $(INCLUDES) +endef + +$(RELEASE_OBJ): $(RELEASE_BUILD_DIR) +define make-goal-rel +$1/%.o: %.cc $(DEPS) + $(CC) -c $$< -o $$@ $(CPPFLAGS_RELEASE) $(INCLUDES) +endef + +$(DEBUG_BUILD_DIR): + @mkdir -p $@ + +$(RELEASE_BUILD_DIR): + @mkdir -p $@ + +.PHONY: all clean + +all: $(DEBUG_OBJ) $(RELEASE_OBJ) + +clean: + @rm -rf $(DEBUG_OBJ) $(RELEASE_OBJ) + +$(foreach bdir,$(DEBUG_BUILD_DIR), $(eval $(call make-goal-dbg,$(bdir)))) + +$(foreach bdir,$(RELEASE_BUILD_DIR),$(eval $(call make-goal-rel,$(bdir)))) http://git-wip-us.apache.org/repos/asf/hbase/blob/5b10031a/hbase-native-client/core/meta-utils.h ---------------------------------------------------------------------- diff --git a/hbase-native-client/core/meta-utils.h b/hbase-native-client/core/meta-utils.h index f6cc84f..294e17d 100644 --- a/hbase-native-client/core/meta-utils.h +++ b/hbase-native-client/core/meta-utils.h @@ -20,7 +20,7 @@ #include -#include "connection/Request.h" +#include "connection/request.h" #include "if/HBase.pb.h" #include "serde/table-name.h"