diff options
Diffstat (limited to 'templates/Makefile.template')
-rw-r--r-- | templates/Makefile.template | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template index 52eb593cc8..84822ab80f 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -229,6 +229,7 @@ endif endif INSTALL = install RM = rm -f +PKG_CONFIG = pkg-config ifndef VALID_CONFIG_$(CONFIG) $(error Invalid CONFIG value '$(CONFIG)') @@ -345,7 +346,7 @@ HOST_LDLIBS = $(LDLIBS) # These are automatically computed variables. # There shouldn't be any need to change anything from now on. -HAS_PKG_CONFIG = $(shell command -v pkg-config >/dev/null 2>&1 && echo true || echo false) +HAS_PKG_CONFIG = $(shell command -v $(PKG_CONFIG) >/dev/null 2>&1 && echo true || echo false) PC_TEMPLATE = prefix=$(prefix)\n\ exec_prefix=${'\$${prefix}'}\n\ @@ -357,7 +358,7 @@ Description: $(PC_DESCRIPTION)\n\ Version: $(VERSION)\n\ Cflags: -I${'\$${includedir}'} $(PC_CFLAGS)\n\ Requires.private: $(PC_REQUIRES_PRIVATE)\n\ -Libs: -L${'\$${libdir}'}\n\ +Libs: -L${'\$${libdir}'} $(PC_LIB)\n\ Libs.private: $(PC_LIBS_PRIVATE) # gpr .pc file @@ -366,7 +367,8 @@ PC_DESCRIPTION = gRPC Portable Runtime PC_CFLAGS = -pthread PC_REQUIRES_PRIVATE = PC_LIBS_PRIVATE = -lpthread -ifeq ($(SYSTEM),Darwin) +PC_LIB = -lgpr +ifneq ($(SYSTEM),Darwin) PC_LIBS_PRIVATE += -lrt endif GPR_PC_FILE := $(PC_TEMPLATE) @@ -396,11 +398,10 @@ OPENSSL_REQUIRES_DL = true endif ifeq ($(HAS_PKG_CONFIG),true) -OPENSSL_ALPN_CHECK_CMD = pkg-config --atleast-version=1.0.2 openssl -OPENSSL_NPN_CHECK_CMD = pkg-config --alteast-version=1.0.1 openssl -ZLIB_CHECK_CMD = pkg-config --exists zlib -PERFTOOLS_CHECK_CMD = pkg-config --exists profiler -PROTOBUF_CHECK_CMD = pkg-config --atleast-version=3.0.0-alpha-3 protobuf +OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl +OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl +ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib +PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.0.0-alpha-3 protobuf else # HAS_PKG_CONFIG ifeq ($(SYSTEM),MINGW32) @@ -412,7 +413,6 @@ endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) -PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) ifeq ($(OPENSSL_REQUIRES_DL),true) @@ -422,6 +422,8 @@ endif endif # HAS_PKG_CONFIG +PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) + PROTOC_CHECK_CMD = which protoc > /dev/null PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3 DTRACE_CHECK_CMD = which dtrace > /dev/null @@ -509,8 +511,8 @@ DEP_MISSING += zlib endif else ifeq ($(HAS_PKG_CONFIG),true) -CPPFLAGS += $(shell pkg-config --cflags zlib) -LDFLAGS += $(shell pkg-config --libs-only-L zlib) +CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib) +LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib) PC_REQUIRES_GRPC += zlib else PC_LIBS_GRPC += -lz @@ -526,11 +528,11 @@ ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_PKG_CONFIG = true PC_REQUIRES_SECURE = openssl -CPPFLAGS := $(shell pkg-config --cflags openssl) $(CPPFLAGS) -LDFLAGS_OPENSSL_PKG_CONFIG = $(shell pkg-config --libs-only-L openssl) +CPPFLAGS := $(shell $(PKG_CONFIG) --cflags openssl) $(CPPFLAGS) +LDFLAGS_OPENSSL_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L openssl) ifeq ($(SYSTEM),Linux) ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),) -LDFLAGS_OPENSSL_PKG_CONFIG += $(shell pkg-config --libs-only-L openssl | sed s/L/Wl,-rpath,/) +LDFLAGS_OPENSSL_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L openssl | sed s/L/Wl,-rpath,/) endif endif LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) @@ -567,7 +569,7 @@ endif endif ifeq ($(OPENSSL_PKG_CONFIG),true) -LDLIBS_SECURE += $(shell pkg-config --libs-only-l openssl) +LDLIBS_SECURE += $(shell $(PKG_CONFIG) --libs-only-l openssl) else LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) endif @@ -578,6 +580,7 @@ PC_DESCRIPTION = high performance general RPC framework PC_CFLAGS = PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) $(PC_REQUIRES_SECURE) PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) $(PC_LIBS_SECURE) +PC_LIB = -lgrpc GRPC_PC_FILE := $(PC_TEMPLATE) # gprc_unsecure .pc file @@ -586,6 +589,7 @@ PC_DESCRIPTION = high performance general RPC framework without SSL PC_CFLAGS = PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) +PC_LIB = -lgrpc GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) PROTOBUF_PKG_CONFIG = false @@ -597,11 +601,11 @@ ifeq ($(HAS_SYSTEM_PROTOBUF),true) ifeq ($(HAS_PKG_CONFIG),true) PROTOBUF_PKG_CONFIG = true PC_REQUIRES_GRPCXX = protobuf -CPPFLAGS := $(shell pkg-config --cflags protobuf) $(CPPFLAGS) -LDFLAGS_PROTOBUF_PKG_CONFIG = $(shell pkg-config --libs-only-L protobuf) +CPPFLAGS := $(shell $(PKG_CONFIG) --cflags protobuf) $(CPPFLAGS) +LDFLAGS_PROTOBUF_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L protobuf) ifeq ($(SYSTEM),Linux) ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),) -LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell pkg-config --libs-only-L protobuf | sed s/L/Wl,-rpath,/) +LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L protobuf | sed s/L/Wl,-rpath,/) endif endif else @@ -624,7 +628,7 @@ LIBS_PROTOC = protoc protobuf HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) ifeq ($(PROTOBUF_PKG_CONFIG),true) -LDLIBS_PROTOBUF += $(shell pkg-config --libs-only-l protobuf) +LDLIBS_PROTOBUF += $(shell $(PKG_CONFIG) --libs-only-l protobuf) else LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) endif @@ -635,6 +639,7 @@ PC_DESCRIPTION = C++ wrapper for gRPC PC_CFLAGS = PC_REQUIRES_PRIVATE = grpc $(PC_REQUIRES_GRPCXX) PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) +PC_LIB = -lgrpc++ GRPCXX_PC_FILE := $(PC_TEMPLATE) # grpc++_unsecure .pc file @@ -643,6 +648,7 @@ PC_DESCRIPTION = C++ wrapper for gRPC without SSL PC_CFLAGS = PC_REQUIRES_PRIVATE = grpc_unsecure $(PC_REQUIRES_GRPCXX) PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) +PC_LIB = -lgrpc++ GRPCXX_UNSECURE_PC_FILE := $(PC_TEMPLATE) ifeq ($(MAKECMDGOALS),clean) |