|  | @@ -39,30 +39,48 @@ CPPFLAGS_dbg = -O0
 | 
	
		
			
				|  |  |  LDFLAGS_dbg =
 | 
	
		
			
				|  |  |  DEFINES_dbg = _DEBUG DEBUG
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +VALID_CONFIG_valgrind = 1
 | 
	
		
			
				|  |  | +REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
 | 
	
		
			
				|  |  | +CC_valgrind = gcc
 | 
	
		
			
				|  |  | +CXX_valgrind = g++
 | 
	
		
			
				|  |  | +LD_valgrind = gcc
 | 
	
		
			
				|  |  | +LDXX_valgrind = g++
 | 
	
		
			
				|  |  | +CPPFLAGS_valgrind = -O0
 | 
	
		
			
				|  |  | +OPENSSL_CFLAGS_valgrind = -DPURIFY
 | 
	
		
			
				|  |  | +LDFLAGS_valgrind =
 | 
	
		
			
				|  |  | +DEFINES_valgrind = _DEBUG DEBUG
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  VALID_CONFIG_tsan = 1
 | 
	
		
			
				|  |  | +REQUIRE_CUSTOM_LIBRARIES_tsan = 1
 | 
	
		
			
				|  |  |  CC_tsan = clang
 | 
	
		
			
				|  |  |  CXX_tsan = clang++
 | 
	
		
			
				|  |  |  LD_tsan = clang
 | 
	
		
			
				|  |  |  LDXX_tsan = clang++
 | 
	
		
			
				|  |  |  CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer
 | 
	
		
			
				|  |  | +OPENSSL_CONFIG_tsan = no-asm
 | 
	
		
			
				|  |  |  LDFLAGS_tsan = -fsanitize=thread
 | 
	
		
			
				|  |  |  DEFINES_tsan = NDEBUG
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  VALID_CONFIG_asan = 1
 | 
	
		
			
				|  |  | +REQUIRE_CUSTOM_LIBRARIES_asan = 1
 | 
	
		
			
				|  |  |  CC_asan = clang
 | 
	
		
			
				|  |  |  CXX_asan = clang++
 | 
	
		
			
				|  |  |  LD_asan = clang
 | 
	
		
			
				|  |  |  LDXX_asan = clang++
 | 
	
		
			
				|  |  |  CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer
 | 
	
		
			
				|  |  | +OPENSSL_CONFIG_asan = no-asm
 | 
	
		
			
				|  |  |  LDFLAGS_asan = -fsanitize=address
 | 
	
		
			
				|  |  |  DEFINES_asan = NDEBUG
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  VALID_CONFIG_msan = 1
 | 
	
		
			
				|  |  | +REQUIRE_CUSTOM_LIBRARIES_msan = 1
 | 
	
		
			
				|  |  |  CC_msan = clang
 | 
	
		
			
				|  |  |  CXX_msan = clang++
 | 
	
		
			
				|  |  |  LD_msan = clang
 | 
	
		
			
				|  |  |  LDXX_msan = clang++
 | 
	
		
			
				|  |  |  CPPFLAGS_msan = -O1 -fsanitize=memory -fno-omit-frame-pointer
 | 
	
		
			
				|  |  | +OPENSSL_CFLAGS_msan = -DPURIFY
 | 
	
		
			
				|  |  | +OPENSSL_CONFIG_msan = no-asm
 | 
	
		
			
				|  |  |  LDFLAGS_msan = -fsanitize=memory
 | 
	
		
			
				|  |  |  DEFINES_msan = NDEBUG
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -172,8 +190,14 @@ endif
 | 
	
		
			
				|  |  |  OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS)
 | 
	
		
			
				|  |  |  ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
 | 
	
		
			
				|  |  |  HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
 | 
	
		
			
				|  |  |  HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
 | 
	
		
			
				|  |  | +else
 | 
	
		
			
				|  |  | +# override system libraries if the config requires a custom compiled library
 | 
	
		
			
				|  |  | +HAS_SYSTEM_OPENSSL_ALPN = false
 | 
	
		
			
				|  |  | +HAS_SYSTEM_ZLIB = false
 | 
	
		
			
				|  |  | +endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
 | 
	
		
			
				|  |  |  HAS_EMBEDDED_OPENSSL_ALPN = false
 | 
	
	
		
			
				|  | @@ -189,7 +213,7 @@ endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  ifeq ($(HAS_SYSTEM_ZLIB),false)
 | 
	
		
			
				|  |  |  ifeq ($(HAS_EMBEDDED_ZLIB),true)
 | 
	
		
			
				|  |  | -ZLIB_DEP = third_party/zlib/libz.a
 | 
	
		
			
				|  |  | +ZLIB_DEP = libs/$(CONFIG)/zlib/libz.a
 | 
	
		
			
				|  |  |  CPPFLAGS += -Ithird_party/zlib
 | 
	
		
			
				|  |  |  LDFLAGS += -Lthird_party/zlib
 | 
	
		
			
				|  |  |  else
 | 
	
	
		
			
				|  | @@ -199,10 +223,10 @@ endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),false)
 | 
	
		
			
				|  |  |  ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true)
 | 
	
		
			
				|  |  | -OPENSSL_DEP = third_party/openssl/libssl.a
 | 
	
		
			
				|  |  | -OPENSSL_MERGE_LIBS += third_party/openssl/libssl.a third_party/openssl/libcrypto.a
 | 
	
		
			
				|  |  | +OPENSSL_DEP = libs/$(CONFIG)/openssl/libssl.a
 | 
	
		
			
				|  |  | +OPENSSL_MERGE_LIBS += libs/$(CONFIG)/openssl/libssl.a libs/$(CONFIG)/openssl/libcrypto.a
 | 
	
		
			
				|  |  |  CPPFLAGS += -Ithird_party/openssl/include
 | 
	
		
			
				|  |  | -LDFLAGS += -Lthird_party/openssl
 | 
	
		
			
				|  |  | +LDFLAGS += -Llibs/$(CONFIG)/openssl
 | 
	
		
			
				|  |  |  LIBS_SECURE = dl
 | 
	
		
			
				|  |  |  else
 | 
	
		
			
				|  |  |  NO_SECURE = true
 | 
	
	
		
			
				|  | @@ -213,16 +237,19 @@ endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -ifneq ($(DEP_MISSING),)
 | 
	
		
			
				|  |  | -NO_DEPS = true
 | 
	
		
			
				|  |  | -endif
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -ifneq ($(MAKECMDGOALS),clean)
 | 
	
		
			
				|  |  | +ifeq ($(MAKECMDGOALS),clean)
 | 
	
		
			
				|  |  |  NO_DEPS = true
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  .SECONDARY = %.pb.h %.pb.cc
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +PROTOC_PLUGINS=\
 | 
	
		
			
				|  |  | +% for tgt in targets:
 | 
	
		
			
				|  |  | +% if tgt.build == 'protoc':
 | 
	
		
			
				|  |  | + bins/$(CONFIG)/${tgt.name}\
 | 
	
		
			
				|  |  | +% endif
 | 
	
		
			
				|  |  | +% endfor
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  ifeq ($(DEP_MISSING),)
 | 
	
		
			
				|  |  |  all: static shared\
 | 
	
		
			
				|  |  |  % for tgt in targets:
 | 
	
	
		
			
				|  | @@ -290,17 +317,23 @@ run_dep_checks:
 | 
	
		
			
				|  |  |  	$(OPENSSL_ALPN_CHECK_CMD) || true
 | 
	
		
			
				|  |  |  	$(ZLIB_CHECK_CMD) || true
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -third_party/zlib/libz.a:
 | 
	
		
			
				|  |  | -	(cd third_party/zlib ; CFLAGS="-fPIC -fvisibility=hidden" ./configure --static)
 | 
	
		
			
				|  |  | +libs/$(CONFIG)/zlib/libz.a:
 | 
	
		
			
				|  |  | +	(cd third_party/zlib ; CC="$(CC)" CFLAGS="-fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG))" ./configure --static)
 | 
	
		
			
				|  |  | +	$(MAKE) -C third_party/zlib clean
 | 
	
		
			
				|  |  |  	$(MAKE) -C third_party/zlib
 | 
	
		
			
				|  |  | +	mkdir -p libs/$(CONFIG)/zlib
 | 
	
		
			
				|  |  | +	cp third_party/zlib/libz.a libs/$(CONFIG)/zlib
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -third_party/openssl/libssl.a:
 | 
	
		
			
				|  |  | -	(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden" ./config)
 | 
	
		
			
				|  |  | +libs/$(CONFIG)/openssl/libssl.a:
 | 
	
		
			
				|  |  | +	(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config $(OPENSSL_CONFIG_$(CONFIG)))
 | 
	
		
			
				|  |  | +	$(MAKE) -C third_party/openssl clean
 | 
	
		
			
				|  |  |  	$(MAKE) -C third_party/openssl build_crypto build_ssl
 | 
	
		
			
				|  |  | +	mkdir -p libs/$(CONFIG)/openssl
 | 
	
		
			
				|  |  | +	cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a libs/$(CONFIG)/openssl
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static: static_c static_cxx
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -static_c: dep_c\
 | 
	
		
			
				|  |  | +static_c: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'all' and not lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.a\
 | 
	
	
		
			
				|  | @@ -308,7 +341,7 @@ static_c: dep_c\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -static_cxx: dep_cxx\
 | 
	
		
			
				|  |  | +static_cxx: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'all' and lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.a\
 | 
	
	
		
			
				|  | @@ -318,7 +351,7 @@ static_cxx: dep_cxx\
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  shared: shared_c shared_cxx
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -shared_c: dep_c\
 | 
	
		
			
				|  |  | +shared_c: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'all' and not lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
 | 
	
	
		
			
				|  | @@ -326,7 +359,7 @@ shared_c: dep_c\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -shared_cxx: dep_cxx\
 | 
	
		
			
				|  |  | +shared_cxx: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'all' and lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
 | 
	
	
		
			
				|  | @@ -336,7 +369,7 @@ shared_cxx: dep_cxx\
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  privatelibs: privatelibs_c privatelibs_cxx
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -privatelibs_c: dep_c\
 | 
	
		
			
				|  |  | +privatelibs_c: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'private' and not lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.a\
 | 
	
	
		
			
				|  | @@ -344,7 +377,7 @@ privatelibs_c: dep_c\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -privatelibs_cxx: dep_cxx\
 | 
	
		
			
				|  |  | +privatelibs_cxx: \
 | 
	
		
			
				|  |  |  % for lib in libs:
 | 
	
		
			
				|  |  |  % if lib.build == 'private' and lib.get('c++', False):
 | 
	
		
			
				|  |  |   libs/$(CONFIG)/lib${lib.name}.a\
 | 
	
	
		
			
				|  | @@ -354,7 +387,7 @@ privatelibs_cxx: dep_cxx\
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  buildtests: buildtests_c buildtests_cxx
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -buildtests_c: bins_dep_c privatelibs_c\
 | 
	
		
			
				|  |  | +buildtests_c: privatelibs_c\
 | 
	
		
			
				|  |  |  % for tgt in targets:
 | 
	
		
			
				|  |  |  % if tgt.build == 'test' and not tgt.get('c++', False):
 | 
	
		
			
				|  |  |   bins/$(CONFIG)/${tgt.name}\
 | 
	
	
		
			
				|  | @@ -362,7 +395,7 @@ buildtests_c: bins_dep_c privatelibs_c\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -buildtests_cxx: bins_dep_cxx privatelibs_cxx\
 | 
	
		
			
				|  |  | +buildtests_cxx: privatelibs_cxx\
 | 
	
		
			
				|  |  |  % for tgt in targets:
 | 
	
		
			
				|  |  |  % if tgt.build == 'test' and tgt.get('c++', False):
 | 
	
		
			
				|  |  |   bins/$(CONFIG)/${tgt.name}\
 | 
	
	
		
			
				|  | @@ -398,14 +431,6 @@ tools: privatelibs\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -protoc_plugins:\
 | 
	
		
			
				|  |  | -% for tgt in targets:
 | 
	
		
			
				|  |  | -% if tgt.build == 'protoc':
 | 
	
		
			
				|  |  | - bins/$(CONFIG)/${tgt.name}\
 | 
	
		
			
				|  |  | -% endif
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  buildbenchmarks: privatelibs\
 | 
	
		
			
				|  |  |  % for tgt in targets:
 | 
	
		
			
				|  |  |  % if tgt.build == 'benchmark':
 | 
	
	
		
			
				|  | @@ -463,79 +488,32 @@ strip-shared_cxx: shared_cxx
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % for p in protos:
 | 
	
		
			
				|  |  | -deps/$(CONFIG)/gens/${p}.pb.dep:
 | 
	
		
			
				|  |  | -	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) touch $@
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -gens/${p}.pb.cc: ${p}.proto protoc_plugins
 | 
	
		
			
				|  |  | +gens/${p}.pb.cc: ${p}.proto $(PROTOC_PLUGINS)
 | 
	
		
			
				|  |  |  	$(E) "[PROTOC]  Generating protobuf CC file from $<"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  |  	$(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $<
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -deps/$(CONFIG)/%.dep : %.c
 | 
	
		
			
				|  |  | -	$(E) "[DEP]     Generating dependencies for $<"
 | 
	
		
			
				|  |  | -	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(CC) $(CFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -deps/$(CONFIG)/%.dep : %.cc
 | 
	
		
			
				|  |  | -	$(E) "[DEP]     Generating dependencies for $<"
 | 
	
		
			
				|  |  | -	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  objs/$(CONFIG)/%.o : %.c
 | 
	
		
			
				|  |  |  	$(E) "[C]       Compiling $<"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 | 
	
		
			
				|  |  | +	$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  objs/$(CONFIG)/%.o : gens/%.pb.cc
 | 
	
		
			
				|  |  |  	$(E) "[CXX]     Compiling $<"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
 | 
	
		
			
				|  |  | +	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  objs/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc
 | 
	
		
			
				|  |  |  	$(E) "[HOSTCXX] Compiling $<"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -c -o $@ $<
 | 
	
		
			
				|  |  | +	$(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  objs/$(CONFIG)/%.o : %.cc
 | 
	
		
			
				|  |  |  	$(E) "[CXX]     Compiling $<"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
		
			
				|  |  | -	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -dep: dep_c dep_cxx
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -dep_c:\
 | 
	
		
			
				|  |  | -% for lib in libs:
 | 
	
		
			
				|  |  | -% if not lib.get('c++', False):
 | 
	
		
			
				|  |  | - deps_lib${lib.name}\
 | 
	
		
			
				|  |  | -% endif
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -bins_dep_c:\
 | 
	
		
			
				|  |  | -% for tgt in targets:
 | 
	
		
			
				|  |  | -% if not tgt.get('c++', False):
 | 
	
		
			
				|  |  | - deps_${tgt.name}\
 | 
	
		
			
				|  |  | -% endif
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -dep_cxx:\
 | 
	
		
			
				|  |  | -% for lib in libs:
 | 
	
		
			
				|  |  | -% if lib.get('c++', False):
 | 
	
		
			
				|  |  | - deps_lib${lib.name}\
 | 
	
		
			
				|  |  | -% endif
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -bins_dep_cxx:\
 | 
	
		
			
				|  |  | -% for tgt in targets:
 | 
	
		
			
				|  |  | -% if tgt.get('c++', False):
 | 
	
		
			
				|  |  | - deps_${tgt.name}\
 | 
	
		
			
				|  |  | -% endif
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | +	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  install: install_c install_cxx
 | 
	
	
		
			
				|  | @@ -624,15 +602,8 @@ ifneq ($(SYSTEM),Darwin)
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -clean:\
 | 
	
		
			
				|  |  | -% for lib in libs:
 | 
	
		
			
				|  |  | - clean_lib${lib.name}\
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -% for tgt in targets:
 | 
	
		
			
				|  |  | - clean_${tgt.name}\
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	$(Q) $(RM) -r deps objs libs bins gens
 | 
	
		
			
				|  |  | +clean:
 | 
	
		
			
				|  |  | +	$(Q) $(RM) -rf objs libs bins gens
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  # The various libraries
 | 
	
	
		
			
				|  | @@ -671,7 +642,6 @@ PUBLIC_HEADERS_C += \\
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  LIB${lib.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
 | 
	
		
			
				|  |  | -LIB${lib.name.upper()}_DEPS = $(addprefix deps/$(CONFIG)/, $(addsuffix .dep, $(basename $(LIB${lib.name.upper()}_SRC))))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % if lib.get('secure', True):
 | 
	
		
			
				|  |  |  ifeq ($(NO_SECURE),true)
 | 
	
	
		
			
				|  | @@ -688,9 +658,9 @@ endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  else
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -libs/$(CONFIG)/lib${lib.name}.a: $(OPENSSL_DEP) $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  | +libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  |  % else:
 | 
	
		
			
				|  |  | -libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  | +libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  	$(E) "[AR]      Creating $@"
 | 
	
		
			
				|  |  |  	$(Q) mkdir -p `dirname $@`
 | 
	
	
		
			
				|  | @@ -719,12 +689,12 @@ libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  |    common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    libs = ''
 | 
	
		
			
				|  |  | -  lib_deps = ''
 | 
	
		
			
				|  |  | +  lib_deps = ' $(ZLIB_DEP)'
 | 
	
		
			
				|  |  |    mingw_libs = ''
 | 
	
		
			
				|  |  | -  mingw_lib_deps = ''
 | 
	
		
			
				|  |  | +  mingw_lib_deps = ' $(ZLIB_DEP)'
 | 
	
		
			
				|  |  |    for dep in lib.get('deps', []):
 | 
	
		
			
				|  |  |      libs = libs + ' -l' + dep
 | 
	
		
			
				|  |  | -    lib_deps = lib_deps + 'libs/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)'
 | 
	
		
			
				|  |  | +    lib_deps = lib_deps + ' libs/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)'
 | 
	
		
			
				|  |  |      mingw_libs = mingw_libs + ' -l' + dep + '-imp'
 | 
	
		
			
				|  |  |      mingw_lib_deps = mingw_lib_deps + 'libs/$(CONFIG)/' + dep + '.$(SHARED_EXT)'
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -732,7 +702,6 @@ libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  |      common = common + ' $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS)'
 | 
	
		
			
				|  |  |      lib_deps = lib_deps + ' $(OPENSSL_DEP)'
 | 
	
		
			
				|  |  |      mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  %>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % if lib.build == "all":
 | 
	
	
		
			
				|  | @@ -759,13 +728,11 @@ endif
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -deps_lib${lib.name}: $(LIB${lib.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  % if lib.get('secure', True):
 | 
	
		
			
				|  |  |  ifneq ($(NO_SECURE),true)
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  ifneq ($(NO_DEPS),true)
 | 
	
		
			
				|  |  | --include $(LIB${lib.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | +-include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  % if lib.get('secure', True):
 | 
	
		
			
				|  |  |  endif
 | 
	
	
		
			
				|  | @@ -782,13 +749,6 @@ objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -clean_lib${lib.name}:
 | 
	
		
			
				|  |  | -	$(E) "[CLEAN]   Cleaning lib${lib.name} files"
 | 
	
		
			
				|  |  | -	$(Q) $(RM) $(LIB${lib.name.upper()}_OBJS)
 | 
	
		
			
				|  |  | -	$(Q) $(RM) $(LIB${lib.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | -	$(Q) $(RM) libs/$(CONFIG)/lib${lib.name}.a
 | 
	
		
			
				|  |  | -	$(Q) $(RM) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
 | 
	
		
			
				|  |  |  </%def>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <%def name="maketarget(tgt)">
 | 
	
	
		
			
				|  | @@ -800,7 +760,6 @@ ${tgt.name.upper()}_SRC = \\
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  ${tgt.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC))))
 | 
	
		
			
				|  |  | -${tgt.name.upper()}_DEPS = $(addprefix deps/$(CONFIG)/, $(addsuffix .dep, $(basename $(${tgt.name.upper()}_SRC))))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % if tgt.get('secure', True):
 | 
	
		
			
				|  |  |  ifeq ($(NO_SECURE),true)
 | 
	
	
		
			
				|  | @@ -867,23 +826,17 @@ objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % endfor
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -deps_${tgt.name}: $(${tgt.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | +deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  % if tgt.get('secure', True):
 | 
	
		
			
				|  |  |  ifneq ($(NO_SECURE),true)
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  |  ifneq ($(NO_DEPS),true)
 | 
	
		
			
				|  |  | --include $(${tgt.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | +-include $(${tgt.name.upper()}_OBJS:.o=.dep)
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  % if tgt.get('secure', True):
 | 
	
		
			
				|  |  |  endif
 | 
	
		
			
				|  |  |  % endif
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -clean_${tgt.name}:
 | 
	
		
			
				|  |  | -	$(E) "[CLEAN]   Cleaning ${tgt.name} files"
 | 
	
		
			
				|  |  | -	$(Q) $(RM) $(${tgt.name.upper()}_OBJS)
 | 
	
		
			
				|  |  | -	$(Q) $(RM) $(${tgt.name.upper()}_DEPS)
 | 
	
		
			
				|  |  | -	$(Q) $(RM) bins/$(CONFIG)/${tgt.name}
 | 
	
		
			
				|  |  |  </%def>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  .PHONY: all strip tools \
 | 
	
	
		
			
				|  | @@ -897,12 +850,6 @@ install-static install-static_c install-static_cxx \
 | 
	
		
			
				|  |  |  strip strip-shared strip-static \
 | 
	
		
			
				|  |  |  strip_c strip-shared_c strip-static_c \
 | 
	
		
			
				|  |  |  strip_cxx strip-shared_cxx strip-static_cxx \
 | 
	
		
			
				|  |  | -clean \
 | 
	
		
			
				|  |  | -dep_c dep_cxx bins_dep_c bins_dep_cxx\
 | 
	
		
			
				|  |  | -% for lib in libs:
 | 
	
		
			
				|  |  | - deps_lib${lib.name} clean_lib${lib.name}\
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | -% for tgt in targets:
 | 
	
		
			
				|  |  | - deps_${tgt.name} clean_${tgt.name}\
 | 
	
		
			
				|  |  | -% endfor
 | 
	
		
			
				|  |  | +dep_c dep_cxx bins_dep_c bins_dep_cxx \
 | 
	
		
			
				|  |  | +clean
 | 
	
		
			
				|  |  |  
 |