diff options
author | 2016-01-26 22:33:19 +0100 | |
---|---|---|
committer | 2016-01-26 22:33:19 +0100 | |
commit | 1a8eb85eff43423e3f383a7a5d2133e5bfc3d4f9 (patch) | |
tree | 408ea9087315c4a4fbc57f77df4a295e974e3b5c | |
parent | 6236718f158654c99b2c2eb52b1e991ce3195c28 (diff) |
Cleaning up our Makefile.
-) Adding question marks to important tools so they can be overriden from environment variables.
-) Removing all traces of -ldl since BoringSSL doesn't implement OpenSSL's DSO and doesn't require it.
-rw-r--r-- | Makefile | 53 | ||||
-rw-r--r-- | templates/Makefile.template | 53 |
2 files changed, 34 insertions, 72 deletions
@@ -226,26 +226,26 @@ DEFINES_mutrace = _DEBUG DEBUG prefix ?= /usr/local -PROTOC = protoc -DTRACE = dtrace +PROTOC ?= protoc +DTRACE ?= dtrace CONFIG ?= opt -CC = $(CC_$(CONFIG)) -CXX = $(CXX_$(CONFIG)) -LD = $(LD_$(CONFIG)) -LDXX = $(LDXX_$(CONFIG)) -AR = ar +CC ?= $(CC_$(CONFIG)) +CXX ?= $(CXX_$(CONFIG)) +LD ?= $(LD_$(CONFIG)) +LDXX ?= $(LDXX_$(CONFIG)) +AR ?= ar ifeq ($(SYSTEM),Linux) -STRIP = strip --strip-unneeded +STRIP ?= strip --strip-unneeded else ifeq ($(SYSTEM),Darwin) -STRIP = strip -x +STRIP ?= strip -x else -STRIP = strip +STRIP ?= strip endif endif -INSTALL = install -RM = rm -f -PKG_CONFIG = pkg-config +INSTALL ?= install +RM ?= rm -f +PKG_CONFIG ?= pkg-config ifndef VALID_CONFIG_$(CONFIG) $(error Invalid CONFIG value '$(CONFIG)') @@ -266,10 +266,10 @@ HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) # cross-compiling, you can override these variables from GNU make's # command line: make CC=cross-gcc HOST_CC=gcc -HOST_CC = $(CC) -HOST_CXX = $(CXX) -HOST_LD = $(LD) -HOST_LDXX = $(LDXX) +HOST_CC ?= $(CC) +HOST_CXX ?= $(CXX) +HOST_LD ?= $(LD) +HOST_LDXX ?= $(LDXX) ifdef EXTRA_DEFINES DEFINES += $(EXTRA_DEFINES) @@ -400,14 +400,6 @@ else IS_GIT_FOLDER = true endif -ifeq ($(SYSTEM),Linux) -OPENSSL_REQUIRES_DL = true -endif - -ifeq ($(SYSTEM),Darwin) -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) --atleast-version=1.0.1 openssl @@ -426,11 +418,6 @@ OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/open ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) -ifeq ($(OPENSSL_REQUIRES_DL),true) -OPENSSL_ALPN_CHECK_CMD += -ldl -OPENSSL_NPN_CHECK_CMD += -ldl -endif - endif # HAS_PKG_CONFIG PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) @@ -594,9 +581,6 @@ OPENSSL_DEP += $(LIBDIR)/$(CONFIG)/libboringssl.a OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a # need to prefix these to ensure overriding system libraries CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) -ifeq ($(OPENSSL_REQUIRES_DL),true) -LIBS_SECURE = dl -endif # OPENSSL_REQUIRES_DL else # EMBED_OPENSSL=false ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_PKG_CONFIG = true @@ -616,10 +600,7 @@ ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_SYSTEM_OPENSSL_NPN -ifeq ($(OPENSSL_REQUIRES_DL),true) -LIBS_SECURE += dl PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) -endif # OPENSSL_REQUIRES_DL=true endif # EMBED_OPENSSL endif # NO_SECURE diff --git a/templates/Makefile.template b/templates/Makefile.template index 589f724fd1..351d5ecd03 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -130,26 +130,26 @@ prefix ?= /usr/local - PROTOC = protoc - DTRACE = dtrace + PROTOC ?= protoc + DTRACE ?= dtrace CONFIG ?= opt - CC = $(CC_$(CONFIG)) - CXX = $(CXX_$(CONFIG)) - LD = $(LD_$(CONFIG)) - LDXX = $(LDXX_$(CONFIG)) - AR = ar + CC ?= $(CC_$(CONFIG)) + CXX ?= $(CXX_$(CONFIG)) + LD ?= $(LD_$(CONFIG)) + LDXX ?= $(LDXX_$(CONFIG)) + AR ?= ar ifeq ($(SYSTEM),Linux) - STRIP = strip --strip-unneeded + STRIP ?= strip --strip-unneeded else ifeq ($(SYSTEM),Darwin) - STRIP = strip -x + STRIP ?= strip -x else - STRIP = strip + STRIP ?= strip endif endif - INSTALL = install - RM = rm -f - PKG_CONFIG = pkg-config + INSTALL ?= install + RM ?= rm -f + PKG_CONFIG ?= pkg-config ifndef VALID_CONFIG_$(CONFIG) $(error Invalid CONFIG value '$(CONFIG)') @@ -170,10 +170,10 @@ # cross-compiling, you can override these variables from GNU make's # command line: make CC=cross-gcc HOST_CC=gcc - HOST_CC = $(CC) - HOST_CXX = $(CXX) - HOST_LD = $(LD) - HOST_LDXX = $(LDXX) + HOST_CC ?= $(CC) + HOST_CXX ?= $(CXX) + HOST_LD ?= $(LD) + HOST_LDXX ?= $(LDXX) ifdef EXTRA_DEFINES DEFINES += $(EXTRA_DEFINES) @@ -315,14 +315,6 @@ IS_GIT_FOLDER = true endif - ifeq ($(SYSTEM),Linux) - OPENSSL_REQUIRES_DL = true - endif - - ifeq ($(SYSTEM),Darwin) - 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) --atleast-version=1.0.1 openssl @@ -341,11 +333,6 @@ ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) - ifeq ($(OPENSSL_REQUIRES_DL),true) - OPENSSL_ALPN_CHECK_CMD += -ldl - OPENSSL_NPN_CHECK_CMD += -ldl - endif - endif # HAS_PKG_CONFIG PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) @@ -509,9 +496,6 @@ OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a # need to prefix these to ensure overriding system libraries CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) - ifeq ($(OPENSSL_REQUIRES_DL),true) - LIBS_SECURE = dl - endif # OPENSSL_REQUIRES_DL else # EMBED_OPENSSL=false ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_PKG_CONFIG = true @@ -531,10 +515,7 @@ CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_SYSTEM_OPENSSL_NPN - ifeq ($(OPENSSL_REQUIRES_DL),true) - LIBS_SECURE += dl PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) - endif # OPENSSL_REQUIRES_DL=true endif # EMBED_OPENSSL endif # NO_SECURE |