From f5371efe65a68738a904090a95b0725397a24a1e Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Mon, 12 Jan 2015 16:40:18 -0800
Subject: [PATCH] Fix some C++ test dependencies

---
 templates/Makefile.template | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/templates/Makefile.template b/templates/Makefile.template
index 44144c8f7e..32c2f18b07 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -2,6 +2,7 @@
 # This currently builds C and C++ code.
 <%!
   import re
+  import os
 
   proto_re = re.compile('(.*)\\.proto')
 
@@ -355,7 +356,7 @@ buildtests_c: bins_dep_c privatelibs_c\
 buildtests_cxx: bins_dep_cxx privatelibs_cxx\
 % for tgt in targets:
 % if tgt.build == 'test' and tgt.get('c++', False):
- bins/${tgt.name}\
+ bins/$(CONFIG)/${tgt.name}\
 % endif
 % endfor
 
@@ -687,6 +688,7 @@ libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
 	$(Q) $(AR) rcs libs/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS)
 % if lib.get('baselib', False):
 % if lib.get('secure', True):
+	$(Q) rm -rf tmp-merge
 	$(Q) mkdir tmp-merge
 	$(Q) ( cd tmp-merge ; $(AR) x ../libs/$(CONFIG)/lib${lib.name}.a )
 	$(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge ; <%text>ar x ../$${l}</%text> ) ; done
@@ -836,6 +838,14 @@ bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\
 endif
 % endif
 
+% for src in tgt.src:
+objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
+% for dep in tgt.deps:
+ libs/$(CONFIG)/lib${dep}.a\
+% endfor
+
+% endfor
+
 deps_${tgt.name}: $(${tgt.name.upper()}_DEPS)
 
 % if tgt.get('secure', True):
-- 
GitLab