Merge github.com:grpc/grpc into immolating-conversion
diff --git a/Makefile b/Makefile
index 4359f78..f8da666 100644
--- a/Makefile
+++ b/Makefile
@@ -251,7 +251,7 @@
 else
 CXXFLAGS += -std=c++0x
 endif
-CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter
+CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wsign-conversion
 LDFLAGS += -g
 
 CPPFLAGS += $(CPPFLAGS_$(CONFIG))
diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c
index 54ee75a..31ce3a8 100644
--- a/src/core/channel/channel_args.c
+++ b/src/core/channel/channel_args.c
@@ -177,9 +177,9 @@
 
   if (states_arg_found) {
     if (state != 0) {
-      GPR_BITSET(states_arg, algorithm);
+      GPR_BITSET((unsigned *)states_arg, algorithm);
     } else {
-      GPR_BITCLEAR(states_arg, algorithm);
+      GPR_BITCLEAR((unsigned *)states_arg, algorithm);
     }
   } else {
     /* create a new arg */
@@ -189,9 +189,9 @@
     /* all enabled by default */
     tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1;
     if (state != 0) {
-      GPR_BITSET(&tmp.value.integer, algorithm);
+      GPR_BITSET((unsigned *)&tmp.value.integer, algorithm);
     } else {
-      GPR_BITCLEAR(&tmp.value.integer, algorithm);
+      GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm);
     }
     result = grpc_channel_args_copy_and_add(*a, &tmp, 1);
     grpc_channel_args_destroy(*a);
diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c
index cd7c182..4eb5df5 100644
--- a/src/core/channel/channel_stack.c
+++ b/src/core/channel/channel_stack.c
@@ -57,7 +57,7 @@
 
 /* Given a size, round up to the next multiple of sizeof(void*) */
 #define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
-  (((x) + GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1))
+  (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u))
 
 size_t grpc_channel_stack_size(const grpc_channel_filter **filters,
                                size_t filter_count) {
diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c
index 762a4ed..0b85c7b 100644
--- a/src/core/channel/compress_filter.c
+++ b/src/core/channel/compress_filter.c
@@ -48,7 +48,8 @@
   gpr_slice_buffer slices; /**< Buffers up input slices to be compressed */
   grpc_linked_mdelem compression_algorithm_storage;
   grpc_linked_mdelem accept_encoding_storage;
-  int remaining_slice_bytes; /**< Input data to be read, as per BEGIN_MESSAGE */
+  gpr_uint32
+      remaining_slice_bytes; /**< Input data to be read, as per BEGIN_MESSAGE */
   int written_initial_metadata; /**< Already processed initial md? */
   /** Compression algorithm we'll try to use. It may be given by incoming
    * metadata, or by the channel's default compression settings. */
diff --git a/src/core/client_config/connector.h b/src/core/client_config/connector.h
index edcb10a..39f3467 100644
--- a/src/core/client_config/connector.h
+++ b/src/core/client_config/connector.h
@@ -50,7 +50,7 @@
   grpc_pollset_set *interested_parties;
   /** address to connect to */
   const struct sockaddr *addr;
-  int addr_len;
+  size_t addr_len;
   /** deadline for connection */
   gpr_timespec deadline;
   /** channel arguments (to be passed to transport) */
diff --git a/src/core/client_config/resolvers/dns_resolver.c b/src/core/client_config/resolvers/dns_resolver.c
index 84643c4..5124c44 100644
--- a/src/core/client_config/resolvers/dns_resolver.c
+++ b/src/core/client_config/resolvers/dns_resolver.c
@@ -140,7 +140,7 @@
     for (i = 0; i < addresses->naddrs; i++) {
       memset(&args, 0, sizeof(args));
       args.addr = (struct sockaddr *)(addresses->addrs[i].addr);
-      args.addr_len = addresses->addrs[i].len;
+      args.addr_len = (size_t)addresses->addrs[i].len;
       subchannels[i] = grpc_subchannel_factory_create_subchannel(
           r->subchannel_factory, &args);
     }
diff --git a/src/core/client_config/resolvers/sockaddr_resolver.c b/src/core/client_config/resolvers/sockaddr_resolver.c
index 0d8540a..4a3c145 100644
--- a/src/core/client_config/resolvers/sockaddr_resolver.c
+++ b/src/core/client_config/resolvers/sockaddr_resolver.c
@@ -63,7 +63,7 @@
   /** the addresses that we've 'resolved' */
   struct sockaddr_storage *addrs;
   /** the corresponding length of the addresses */
-  int *addrs_len;
+  size_t *addrs_len;
   /** how many elements in \a addrs */
   size_t num_addrs;
 
@@ -157,7 +157,8 @@
 }
 
 #ifdef GPR_POSIX_SOCKET
-static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, int *len) {
+static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr,
+                      size_t *len) {
   struct sockaddr_un *un = (struct sockaddr_un *)addr;
 
   un->sun_family = AF_UNIX;
@@ -189,7 +190,8 @@
   return ip_get_default_authority(uri);
 }
 
-static int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr, int *len) {
+static int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr,
+                      size_t *len) {
   const char *host_port = uri->path;
   char *host;
   char *port;
@@ -229,7 +231,8 @@
   return result;
 }
 
-static int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr, int *len) {
+static int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr,
+                      size_t *len) {
   const char *host_port = uri->path;
   char *host;
   char *port;
@@ -275,7 +278,7 @@
     grpc_lb_policy *(*lb_policy_factory)(grpc_subchannel **subchannels,
                                          size_t num_subchannels),
     grpc_subchannel_factory *subchannel_factory,
-    int parse(grpc_uri *uri, struct sockaddr_storage *dst, int *len)) {
+    int parse(grpc_uri *uri, struct sockaddr_storage *dst, size_t *len)) {
   size_t i;
   int errors_found = 0; /* GPR_FALSE */
   sockaddr_resolver *r;
@@ -296,7 +299,7 @@
   gpr_slice_split(path_slice, ",", &path_parts);
   r->num_addrs = path_parts.count;
   r->addrs = gpr_malloc(sizeof(struct sockaddr_storage) * r->num_addrs);
-  r->addrs_len = gpr_malloc(sizeof(int) * r->num_addrs);
+  r->addrs_len = gpr_malloc(sizeof(*r->addrs_len) * r->num_addrs);
 
   for(i = 0; i < r->num_addrs; i++) {
     grpc_uri ith_uri = *uri;
diff --git a/src/core/client_config/uri_parser.c b/src/core/client_config/uri_parser.c
index 410a61c..5c2aa46 100644
--- a/src/core/client_config/uri_parser.c
+++ b/src/core/client_config/uri_parser.c
@@ -39,10 +39,10 @@
 #include <grpc/support/log.h>
 #include <grpc/support/string_util.h>
 
-static grpc_uri *bad_uri(const char *uri_text, int pos, const char *section,
+static grpc_uri *bad_uri(const char *uri_text, size_t pos, const char *section,
                          int suppress_errors) {
   char *line_prefix;
-  int pfx_len;
+  size_t pfx_len;
 
   if (!suppress_errors) {
     gpr_asprintf(&line_prefix, "bad uri.%s: '", section);
@@ -60,8 +60,10 @@
   return NULL;
 }
 
-static char *copy_fragment(const char *src, int begin, int end) {
-  char *out = gpr_malloc(end - begin + 1);
+static char *copy_fragment(const char *src, size_t begin, size_t end) {
+  char *out;
+  GPR_ASSERT(end >= begin);
+  out = gpr_malloc(end - begin + 1);
   memcpy(out, src + begin, end - begin);
   out[end - begin] = 0;
   return out;
@@ -69,13 +71,14 @@
 
 grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) {
   grpc_uri *uri;
-  int scheme_begin = 0;
-  int scheme_end = -1;
-  int authority_begin = -1;
-  int authority_end = -1;
-  int path_begin = -1;
-  int path_end = -1;
-  int i;
+  size_t scheme_begin = 0;
+#define NOT_SET (~(size_t)0)
+  size_t scheme_end = NOT_SET;
+  size_t authority_begin = NOT_SET;
+  size_t authority_end = NOT_SET;
+  size_t path_begin = NOT_SET;
+  size_t path_end = NOT_SET;
+  size_t i;
 
   for (i = scheme_begin; uri_text[i] != 0; i++) {
     if (uri_text[i] == ':') {
@@ -92,13 +95,14 @@
     }
     break;
   }
-  if (scheme_end == -1) {
+  if (scheme_end == NOT_SET) {
     return bad_uri(uri_text, i, "scheme", suppress_errors);
   }
 
   if (uri_text[scheme_end + 1] == '/' && uri_text[scheme_end + 2] == '/') {
     authority_begin = scheme_end + 3;
-    for (i = authority_begin; uri_text[i] != 0 && authority_end == -1; i++) {
+    for (i = authority_begin; uri_text[i] != 0 && authority_end == NOT_SET;
+         i++) {
       if (uri_text[i] == '/') {
         authority_end = i;
       }
@@ -109,10 +113,10 @@
         return bad_uri(uri_text, i, "fragment_not_supported", suppress_errors);
       }
     }
-    if (authority_end == -1 && uri_text[i] == 0) {
+    if (authority_end == NOT_SET && uri_text[i] == 0) {
       authority_end = i;
     }
-    if (authority_end == -1) {
+    if (authority_end == NOT_SET) {
       return bad_uri(uri_text, i, "authority", suppress_errors);
     }
     /* TODO(ctiller): parse the authority correctly */
diff --git a/src/core/debug/trace.c b/src/core/debug/trace.c
index 1014b1f..3b35d81 100644
--- a/src/core/debug/trace.c
+++ b/src/core/debug/trace.c
@@ -59,9 +59,13 @@
 static void add(const char *beg, const char *end, char ***ss, size_t *ns) {
   size_t n = *ns;
   size_t np = n + 1;
-  char *s = gpr_malloc(end - beg + 1);
-  memcpy(s, beg, end - beg);
-  s[end - beg] = 0;
+  char *s;
+  size_t len;
+  GPR_ASSERT(end >= beg);
+  len = (size_t)(end - beg);
+  s = gpr_malloc(len + 1);
+  memcpy(s, beg, len);
+  s[len] = 0;
   *ss = gpr_realloc(*ss, sizeof(char **) * np);
   (*ss)[n] = s;
   *ns = np;
diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c
index 7b2a620..404906d 100644
--- a/src/core/httpcli/parser.c
+++ b/src/core/httpcli/parser.c
@@ -96,13 +96,15 @@
     gpr_log(GPR_ERROR, "Didn't find ':' in header string");
     goto error;
   }
-  hdr.key = buf2str(beg, cur - beg);
+  GPR_ASSERT(cur >= beg);
+  hdr.key = buf2str(beg, (size_t)(cur - beg));
   cur++; /* skip : */
 
   while (cur != end && (*cur == ' ' || *cur == '\t')) {
     cur++;
   }
-  hdr.value = buf2str(cur, end - cur - 2);
+  GPR_ASSERT(end - cur >= 2);
+  hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
 
   if (parser->r.hdr_count == parser->hdr_capacity) {
     parser->hdr_capacity =
@@ -171,7 +173,7 @@
         parser->r.body =
             gpr_realloc((void *)parser->r.body, parser->body_capacity);
       }
-      ((char *)parser->r.body)[parser->r.body_length] = byte;
+      parser->r.body[parser->r.body_length] = (char)byte;
       parser->r.body_length++;
       return 1;
   }
diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c
index ddb30dc..e317934 100644
--- a/src/core/iomgr/alarm.c
+++ b/src/core/iomgr/alarm.c
@@ -83,7 +83,7 @@
 }
 
 void grpc_alarm_list_init(gpr_timespec now) {
-  int i;
+  gpr_uint32 i;
 
   gpr_mu_init(&g_mu);
   gpr_mu_init(&g_checker_mu);
diff --git a/src/core/iomgr/alarm_heap.c b/src/core/iomgr/alarm_heap.c
index daed251..7bafdff 100644
--- a/src/core/iomgr/alarm_heap.c
+++ b/src/core/iomgr/alarm_heap.c
@@ -43,9 +43,9 @@
    position. This functor is called each time immediately after modifying a
    value in the underlying container, with the offset of the modified element as
    its argument. */
-static void adjust_upwards(grpc_alarm **first, int i, grpc_alarm *t) {
+static void adjust_upwards(grpc_alarm **first, gpr_uint32 i, grpc_alarm *t) {
   while (i > 0) {
-    int parent = (i - 1) / 2;
+    gpr_uint32 parent = (i - 1u) / 2u;
     if (gpr_time_cmp(first[parent]->deadline, t->deadline) >= 0) break;
     first[i] = first[parent];
     first[i]->heap_index = i;
@@ -58,12 +58,12 @@
 /* Adjusts a heap so as to move a hole at position i farther away from the root,
    until a suitable position is found for element t.  Then, copies t into that
    position. */
-static void adjust_downwards(grpc_alarm **first, int i, int length,
-                             grpc_alarm *t) {
+static void adjust_downwards(grpc_alarm **first, gpr_uint32 i,
+                             gpr_uint32 length, grpc_alarm *t) {
   for (;;) {
-    int left_child = 1 + 2 * i;
-    int right_child;
-    int next_i;
+    gpr_uint32 left_child = 1u + 2u * i;
+    gpr_uint32 right_child;
+    gpr_uint32 next_i;
     if (left_child >= length) break;
     right_child = left_child + 1;
     next_i = right_child < length &&
@@ -93,8 +93,8 @@
 }
 
 static void note_changed_priority(grpc_alarm_heap *heap, grpc_alarm *alarm) {
-  int i = alarm->heap_index;
-  int parent = (i - 1) / 2;
+  gpr_uint32 i = alarm->heap_index;
+  gpr_uint32 parent = (i - 1u) / 2u;
   if (gpr_time_cmp(heap->alarms[parent]->deadline, alarm->deadline) < 0) {
     adjust_upwards(heap->alarms, i, alarm);
   } else {
@@ -122,7 +122,7 @@
 }
 
 void grpc_alarm_heap_remove(grpc_alarm_heap *heap, grpc_alarm *alarm) {
-  int i = alarm->heap_index;
+  gpr_uint32 i = alarm->heap_index;
   if (i == heap->alarm_count - 1) {
     heap->alarm_count--;
     maybe_shrink(heap);
diff --git a/src/core/iomgr/alarm_heap.h b/src/core/iomgr/alarm_heap.h
index 60db6c9..91d6ee3 100644
--- a/src/core/iomgr/alarm_heap.h
+++ b/src/core/iomgr/alarm_heap.h
@@ -38,8 +38,8 @@
 
 typedef struct {
   grpc_alarm **alarms;
-  int alarm_count;
-  int alarm_capacity;
+  gpr_uint32 alarm_count;
+  gpr_uint32 alarm_capacity;
 } grpc_alarm_heap;
 
 /* return 1 if the new alarm is the first alarm in the heap */
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 6bd1b61..93aa3ad 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -420,7 +420,7 @@
   grpc_fd_watcher fd_watcher;
   int timeout;
   int r;
-  int nfds;
+  nfds_t nfds;
 
   if (pollset->in_flight_cbs) {
     /* Give do_promote priority so we don't starve it out */
diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h
index cc1bd42..9f361cb 100644
--- a/src/core/iomgr/resolve_address.h
+++ b/src/core/iomgr/resolve_address.h
@@ -40,7 +40,7 @@
 
 typedef struct {
   char addr[GRPC_MAX_SOCKADDR_SIZE];
-  int len;
+  size_t len;
 } grpc_resolved_address;
 
 typedef struct {
diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h
index 8ad9b81..12296bd 100644
--- a/src/core/iomgr/tcp_client.h
+++ b/src/core/iomgr/tcp_client.h
@@ -46,7 +46,7 @@
    in this connection being established (in order to continue their work) */
 void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *tcp),
                              void *arg, grpc_pollset_set *interested_parties,
-                             const struct sockaddr *addr, int addr_len,
+                             const struct sockaddr *addr, size_t addr_len,
                              gpr_timespec deadline);
 
 #endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H */
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c
index 66027f8..7ca0a60 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/iomgr/tcp_client_posix.c
@@ -195,7 +195,7 @@
 
 void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep),
                              void *arg, grpc_pollset_set *interested_parties,
-                             const struct sockaddr *addr, int addr_len,
+                             const struct sockaddr *addr, size_t addr_len,
                              gpr_timespec deadline) {
   int fd;
   grpc_dualstack_mode dsmode;
diff --git a/src/core/security/base64.c b/src/core/security/base64.c
index 8dfaef8..5226d2c 100644
--- a/src/core/security/base64.c
+++ b/src/core/security/base64.c
@@ -125,13 +125,14 @@
 
 static void decode_one_char(const unsigned char *codes, unsigned char *result,
                             size_t *result_offset) {
-  gpr_uint32 packed = (codes[0] << 2) | (codes[1] >> 4);
+  gpr_uint32 packed = ((gpr_uint32)codes[0] << 2) | ((gpr_uint32)codes[1] >> 4);
   result[(*result_offset)++] = (unsigned char)packed;
 }
 
 static void decode_two_chars(const unsigned char *codes, unsigned char *result,
                              size_t *result_offset) {
-  gpr_uint32 packed = (codes[0] << 10) | (codes[1] << 4) | (codes[2] >> 2);
+  gpr_uint32 packed = ((gpr_uint32)codes[0] << 10) |
+                      ((gpr_uint32)codes[1] << 4) | ((gpr_uint32)codes[2] >> 2);
   result[(*result_offset)++] = (unsigned char)(packed >> 8);
   result[(*result_offset)++] = (unsigned char)(packed);
 }
@@ -171,8 +172,9 @@
     decode_two_chars(codes, result, result_offset);
   } else {
     /* No padding. */
-    gpr_uint32 packed =
-        (codes[0] << 18) | (codes[1] << 12) | (codes[2] << 6) | codes[3];
+    gpr_uint32 packed = ((gpr_uint32)codes[0] << 18) |
+                        ((gpr_uint32)codes[1] << 12) |
+                        ((gpr_uint32)codes[2] << 6) | codes[3];
     result[(*result_offset)++] = (unsigned char)(packed >> 16);
     result[(*result_offset)++] = (unsigned char)(packed >> 8);
     result[(*result_offset)++] = (unsigned char)(packed);
diff --git a/src/core/security/jwt_verifier.c b/src/core/security/jwt_verifier.c
index 38ad134..03f8c37 100644
--- a/src/core/security/jwt_verifier.c
+++ b/src/core/security/jwt_verifier.c
@@ -769,7 +769,7 @@
   GPR_ASSERT(verifier != NULL && jwt != NULL && audience != NULL && cb != NULL);
   dot = strchr(cur, '.');
   if (dot == NULL) goto error;
-  json = parse_json_part_from_jwt(cur, dot - cur, &header_buffer);
+  json = parse_json_part_from_jwt(cur, (size_t)(dot - cur), &header_buffer);
   if (json == NULL) goto error;
   header = jose_header_from_json(json, header_buffer);
   if (header == NULL) goto error;
@@ -777,7 +777,7 @@
   cur = dot + 1;
   dot = strchr(cur, '.');
   if (dot == NULL) goto error;
-  json = parse_json_part_from_jwt(cur, dot - cur, &claims_buffer);
+  json = parse_json_part_from_jwt(cur, (size_t)(dot - cur), &claims_buffer);
   if (json == NULL) goto error;
   claims = grpc_jwt_claims_from_json(json, claims_buffer);
   if (claims == NULL) goto error;
diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c
index 35b60bd..9b554ee 100644
--- a/src/core/surface/secure_channel_create.c
+++ b/src/core/surface/secure_channel_create.c
@@ -197,7 +197,7 @@
   subchannel_factory *f;
 #define MAX_FILTERS 3
   const grpc_channel_filter *filters[MAX_FILTERS];
-  int n = 0;
+  size_t n = 0;
 
   GPR_ASSERT(reserved == NULL);
   if (grpc_find_security_connector_in_args(args) != NULL) {
diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c
index 29127c4..a813c30 100644
--- a/src/core/tsi/fake_transport_security.c
+++ b/src/core/tsi/fake_transport_security.c
@@ -171,7 +171,7 @@
       memcpy(frame->data + frame->offset, bytes_cursor, available_size);
       bytes_cursor += available_size;
       frame->offset += available_size;
-      *incoming_bytes_size = bytes_cursor - incoming_bytes;
+      *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes);
       return TSI_INCOMPLETE_DATA;
     }
     memcpy(frame->data + frame->offset, bytes_cursor, to_read_size);
@@ -187,12 +187,12 @@
     memcpy(frame->data + frame->offset, bytes_cursor, available_size);
     frame->offset += available_size;
     bytes_cursor += available_size;
-    *incoming_bytes_size = bytes_cursor - incoming_bytes;
+    *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes);
     return TSI_INCOMPLETE_DATA;
   }
   memcpy(frame->data + frame->offset, bytes_cursor, to_read_size);
   bytes_cursor += to_read_size;
-  *incoming_bytes_size = bytes_cursor - incoming_bytes;
+  *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes);
   tsi_fake_frame_reset(frame, 1 /* needs_draining */);
   return TSI_OK;
 }
@@ -384,7 +384,8 @@
     return TSI_OK;
   }
   if (!impl->outgoing.needs_draining) {
-    int next_message_to_send = impl->next_message_to_send + 2;
+    tsi_fake_handshake_message next_message_to_send =
+        impl->next_message_to_send + 2;
     const char* msg_string =
         tsi_fake_handshake_message_to_string(impl->next_message_to_send);
     result = bytes_to_frame((unsigned char*)msg_string, strlen(msg_string),
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 0b416f6..6add492 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -131,10 +131,13 @@
 
 static void init_openssl(void) {
   int i;
+  int num_locks;
   SSL_library_init();
   SSL_load_error_strings();
   OpenSSL_add_all_algorithms();
-  openssl_mutexes = malloc(CRYPTO_num_locks() * sizeof(gpr_mu));
+  num_locks = CRYPTO_num_locks();
+  GPR_ASSERT(num_locks > 0);
+  openssl_mutexes = malloc((size_t)num_locks * sizeof(gpr_mu));
   GPR_ASSERT(openssl_mutexes != NULL);
   for (i = 0; i < CRYPTO_num_locks(); i++) {
     gpr_mu_init(&openssl_mutexes[i]);
@@ -249,7 +252,7 @@
     gpr_log(GPR_ERROR, "Could not extract utf8 from asn1 string.");
     return TSI_OUT_OF_RESOURCES;
   }
-  *utf8_size = utf8_returned_size;
+  *utf8_size = (size_t)utf8_returned_size;
   return TSI_OK;
 }
 
@@ -279,8 +282,8 @@
 /* Gets the subject SANs from an X509 cert as a tsi_peer_property. */
 static tsi_result add_subject_alt_names_properties_to_peer(
     tsi_peer* peer, GENERAL_NAMES* subject_alt_names,
-    int subject_alt_name_count) {
-  int i;
+    size_t subject_alt_name_count) {
+  size_t i;
   tsi_result result = TSI_OK;
 
   /* Reset for DNS entries filtering. */
@@ -301,7 +304,7 @@
       }
       result = tsi_construct_string_peer_property(
           TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY,
-          (const char*)dns_name, dns_name_size,
+          (const char*)dns_name, (size_t)dns_name_size,
           &peer->properties[peer->property_count++]);
       OPENSSL_free(dns_name);
       if (result != TSI_OK) break;
@@ -318,9 +321,12 @@
       X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0);
   int subject_alt_name_count =
       (subject_alt_names != NULL) ? sk_GENERAL_NAME_num(subject_alt_names) : 0;
-  size_t property_count = (include_certificate_type ? 1 : 0) +
-                          1 /* common name */ + subject_alt_name_count;
-  tsi_result result = tsi_construct_peer(property_count, peer);
+  size_t property_count;
+  tsi_result result;
+  GPR_ASSERT(subject_alt_name_count >= 0);
+  property_count = (include_certificate_type ? (size_t)1 : 0) +
+                   1 /* common name */ + (size_t)subject_alt_name_count;
+  result = tsi_construct_peer(property_count, peer);
   if (result != TSI_OK) return result;
   do {
     if (include_certificate_type) {
@@ -334,8 +340,8 @@
     if (result != TSI_OK) break;
 
     if (subject_alt_name_count != 0) {
-      result = add_subject_alt_names_properties_to_peer(peer, subject_alt_names,
-                                                        subject_alt_name_count);
+      result = add_subject_alt_names_properties_to_peer(
+          peer, subject_alt_names, (size_t)subject_alt_name_count);
       if (result != TSI_OK) break;
     }
   } while (0);
@@ -387,7 +393,7 @@
         return TSI_PROTOCOL_FAILURE;
     }
   }
-  *unprotected_bytes_size = read_from_ssl;
+  *unprotected_bytes_size = (size_t)read_from_ssl;
   return TSI_OK;
 }
 
@@ -616,7 +622,7 @@
       gpr_log(GPR_ERROR, "Invalid 0-length protocol name.");
       return TSI_INVALID_ARGUMENT;
     }
-    *protocol_name_list_length += alpn_protocols_lengths[i] + 1;
+    *protocol_name_list_length += (size_t)alpn_protocols_lengths[i] + 1;
   }
   *protocol_name_list = malloc(*protocol_name_list_length);
   if (*protocol_name_list == NULL) return TSI_OUT_OF_RESOURCES;
@@ -648,7 +654,7 @@
   tsi_result result = TSI_OK;
 
   /* First see if we have some pending data in the SSL BIO. */
-  size_t pending_in_ssl = BIO_pending(impl->from_ssl);
+  int pending_in_ssl = BIO_pending(impl->from_ssl);
   if (pending_in_ssl > 0) {
     *unprotected_bytes_size = 0;
     read_from_ssl = BIO_read(impl->from_ssl, protected_output_frames,
@@ -658,7 +664,7 @@
               "Could not read from BIO even though some data is pending");
       return TSI_INTERNAL_ERROR;
     }
-    *protected_output_frames_size = read_from_ssl;
+    *protected_output_frames_size = (size_t)read_from_ssl;
     return TSI_OK;
   }
 
@@ -684,7 +690,7 @@
     gpr_log(GPR_ERROR, "Could not read from BIO after SSL_write.");
     return TSI_INTERNAL_ERROR;
   }
-  *protected_output_frames_size = read_from_ssl;
+  *protected_output_frames_size = (size_t)read_from_ssl;
   *unprotected_bytes_size = available;
   impl->buffer_offset = 0;
   return TSI_OK;
@@ -696,6 +702,7 @@
   tsi_result result = TSI_OK;
   tsi_ssl_frame_protector* impl = (tsi_ssl_frame_protector*)self;
   int read_from_ssl = 0;
+  int pending;
 
   if (impl->buffer_offset != 0) {
     result = do_ssl_write(impl->ssl, impl->buffer, impl->buffer_offset);
@@ -703,7 +710,9 @@
     impl->buffer_offset = 0;
   }
 
-  *still_pending_size = BIO_pending(impl->from_ssl);
+  pending = BIO_pending(impl->from_ssl);
+  GPR_ASSERT(pending >= 0);
+  *still_pending_size = (size_t)pending;
   if (*still_pending_size == 0) return TSI_OK;
 
   read_from_ssl = BIO_read(impl->from_ssl, protected_output_frames,
@@ -712,8 +721,10 @@
     gpr_log(GPR_ERROR, "Could not read from BIO after SSL_write.");
     return TSI_INTERNAL_ERROR;
   }
-  *protected_output_frames_size = read_from_ssl;
-  *still_pending_size = BIO_pending(impl->from_ssl);
+  *protected_output_frames_size = (size_t)read_from_ssl;
+  pending = BIO_pending(impl->from_ssl);
+  GPR_ASSERT(pending >= 0);
+  *still_pending_size = (size_t)pending;
   return TSI_OK;
 }
 
@@ -747,7 +758,7 @@
             written_into_ssl);
     return TSI_INTERNAL_ERROR;
   }
-  *protected_frames_bytes_size = written_into_ssl;
+  *protected_frames_bytes_size = (size_t)written_into_ssl;
 
   /* Now try to read some data again. */
   result = do_ssl_read(impl->ssl, unprotected_bytes, unprotected_bytes_size);
@@ -817,7 +828,7 @@
     impl->result = TSI_INTERNAL_ERROR;
     return impl->result;
   }
-  *bytes_size = bytes_written_into_ssl_size;
+  *bytes_size = (size_t)bytes_written_into_ssl_size;
 
   if (!tsi_handshaker_is_in_progress(self)) {
     impl->result = TSI_OK;
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 6069d6d..5be4eed 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -1,1876 +1,1874 @@
-%YAML 1.2
---- |
-  # GRPC global makefile
-  # This currently builds C and C++ code.
-  # This file has been automatically generated from a template file.
-  # Please look at the templates directory instead.
-  # This file can be regenerated from the template by running
-  # tools/buildgen/generate_projects.sh
+# GRPC global makefile
+# This currently builds C and C++ code.
+# This file has been automatically generated from a template file.
+# Please look at the templates directory instead.
+# This file can be regenerated from the template by running
+# tools/buildgen/generate_projects.sh
 
-  # Copyright 2015, Google Inc.
-  # All rights reserved.
-  #
-  # Redistribution and use in source and binary forms, with or without
-  # modification, are permitted provided that the following conditions are
-  # met:
-  #
-  #     * Redistributions of source code must retain the above copyright
-  # notice, this list of conditions and the following disclaimer.
-  #     * Redistributions in binary form must reproduce the above
-  # copyright notice, this list of conditions and the following disclaimer
-  # in the documentation and/or other materials provided with the
-  # distribution.
-  #     * Neither the name of Google Inc. nor the names of its
-  # contributors may be used to endorse or promote products derived from
-  # this software without specific prior written permission.
-  #
-  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-  # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-  # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-  # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-  # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-  # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-  # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-  # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-  # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  <%!
-    import re
-    import os
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+<%!
+  import re
+  import os
 
-    proto_re = re.compile('(.*)\\.proto')
+  proto_re = re.compile('(.*)\\.proto')
 
-    def proto_to_cc(filename):
-      m = proto_re.match(filename)
-      if not m:
-        return filename
-      return '$(GENDIR)/' + m.group(1) + '.pb.cc $(GENDIR)/' + m.group(1) + '.grpc.pb.cc'
+  def proto_to_cc(filename):
+    m = proto_re.match(filename)
+    if not m:
+      return filename
+    return '$(GENDIR)/' + m.group(1) + '.pb.cc $(GENDIR)/' + m.group(1) + '.grpc.pb.cc'
 
-    sources_that_need_openssl = set()
-    sources_that_don_t_need_openssl = set()
-  %>
+  sources_that_need_openssl = set()
+  sources_that_don_t_need_openssl = set()
+%>
 
 
-  # Basic platform detection
-  HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
-  ifeq ($(SYSTEM),)
-  SYSTEM = $(HOST_SYSTEM)
-  endif
-  ifeq ($(SYSTEM),MSYS)
-  SYSTEM = MINGW32
-  endif
-  ifeq ($(SYSTEM),MINGW64)
-  SYSTEM = MINGW32
-  endif
+# Basic platform detection
+HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
+ifeq ($(SYSTEM),)
+SYSTEM = $(HOST_SYSTEM)
+endif
+ifeq ($(SYSTEM),MSYS)
+SYSTEM = MINGW32
+endif
+ifeq ($(SYSTEM),MINGW64)
+SYSTEM = MINGW32
+endif
 
 
-  ifndef BUILDDIR
-  BUILDDIR = .
-  endif
+ifndef BUILDDIR
+BUILDDIR = .
+endif
 
-  HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false)
-  HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false)
-  HAS_CLANG = $(shell which clang > /dev/null 2> /dev/null && echo true || echo false)
+HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false)
+HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false)
+HAS_CLANG = $(shell which clang > /dev/null 2> /dev/null && echo true || echo false)
 
-  ifeq ($(HAS_CC),true)
-  DEFAULT_CC = cc
-  DEFAULT_CXX = c++
-  else
-  ifeq ($(HAS_GCC),true)
-  DEFAULT_CC = gcc
-  DEFAULT_CXX = g++
-  else
-  ifeq ($(HAS_CLANG),true)
-  DEFAULT_CC = clang
-  DEFAULT_CXX = clang++
-  else
-  DEFAULT_CC = no_c_compiler
-  DEFAULT_CXX = no_c++_compiler
-  endif
-  endif
-  endif
+ifeq ($(HAS_CC),true)
+DEFAULT_CC = cc
+DEFAULT_CXX = c++
+else
+ifeq ($(HAS_GCC),true)
+DEFAULT_CC = gcc
+DEFAULT_CXX = g++
+else
+ifeq ($(HAS_CLANG),true)
+DEFAULT_CC = clang
+DEFAULT_CXX = clang++
+else
+DEFAULT_CC = no_c_compiler
+DEFAULT_CXX = no_c++_compiler
+endif
+endif
+endif
 
 
-  BINDIR = $(BUILDDIR)/bins
-  OBJDIR = $(BUILDDIR)/objs
-  LIBDIR = $(BUILDDIR)/libs
-  GENDIR = $(BUILDDIR)/gens
+BINDIR = $(BUILDDIR)/bins
+OBJDIR = $(BUILDDIR)/objs
+LIBDIR = $(BUILDDIR)/libs
+GENDIR = $(BUILDDIR)/gens
 
-  # Configurations
+# Configurations
 
-  VALID_CONFIG_opt = 1
-  CC_opt = $(DEFAULT_CC)
-  CXX_opt = $(DEFAULT_CXX)
-  LD_opt = $(DEFAULT_CC)
-  LDXX_opt = $(DEFAULT_CXX)
-  CPPFLAGS_opt = -O2
-  LDFLAGS_opt =
-  DEFINES_opt = NDEBUG
+VALID_CONFIG_opt = 1
+CC_opt = $(DEFAULT_CC)
+CXX_opt = $(DEFAULT_CXX)
+LD_opt = $(DEFAULT_CC)
+LDXX_opt = $(DEFAULT_CXX)
+CPPFLAGS_opt = -O2
+LDFLAGS_opt =
+DEFINES_opt = NDEBUG
 
-  VALID_CONFIG_basicprof = 1
-  CC_basicprof = $(DEFAULT_CC)
-  CXX_basicprof = $(DEFAULT_CXX)
-  LD_basicprof = $(DEFAULT_CC)
-  LDXX_basicprof = $(DEFAULT_CXX)
-  CPPFLAGS_basicprof = -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC
-  LDFLAGS_basicprof =
-  DEFINES_basicprof = NDEBUG
+VALID_CONFIG_basicprof = 1
+CC_basicprof = $(DEFAULT_CC)
+CXX_basicprof = $(DEFAULT_CXX)
+LD_basicprof = $(DEFAULT_CC)
+LDXX_basicprof = $(DEFAULT_CXX)
+CPPFLAGS_basicprof = -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC
+LDFLAGS_basicprof =
+DEFINES_basicprof = NDEBUG
 
-  VALID_CONFIG_stapprof = 1
-  CC_stapprof = $(DEFAULT_CC)
-  CXX_stapprof = $(DEFAULT_CXX)
-  LD_stapprof = $(DEFAULT_CC)
-  LDXX_stapprof = $(DEFAULT_CXX)
-  CPPFLAGS_stapprof = -O2 -DGRPC_STAP_PROFILER
-  LDFLAGS_stapprof =
-  DEFINES_stapprof = NDEBUG
+VALID_CONFIG_stapprof = 1
+CC_stapprof = $(DEFAULT_CC)
+CXX_stapprof = $(DEFAULT_CXX)
+LD_stapprof = $(DEFAULT_CC)
+LDXX_stapprof = $(DEFAULT_CXX)
+CPPFLAGS_stapprof = -O2 -DGRPC_STAP_PROFILER
+LDFLAGS_stapprof =
+DEFINES_stapprof = NDEBUG
 
-  VALID_CONFIG_dbg = 1
-  CC_dbg = $(DEFAULT_CC)
-  CXX_dbg = $(DEFAULT_CXX)
-  LD_dbg = $(DEFAULT_CC)
-  LDXX_dbg = $(DEFAULT_CXX)
-  CPPFLAGS_dbg = -O0
-  LDFLAGS_dbg =
-  DEFINES_dbg = _DEBUG DEBUG
+VALID_CONFIG_dbg = 1
+CC_dbg = $(DEFAULT_CC)
+CXX_dbg = $(DEFAULT_CXX)
+LD_dbg = $(DEFAULT_CC)
+LDXX_dbg = $(DEFAULT_CXX)
+CPPFLAGS_dbg = -O0
+LDFLAGS_dbg =
+DEFINES_dbg = _DEBUG DEBUG
 
-  VALID_CONFIG_mutrace = 1
-  CC_mutrace = $(DEFAULT_CC)
-  CXX_mutrace = $(DEFAULT_CXX)
-  LD_mutrace = $(DEFAULT_CC)
-  LDXX_mutrace = $(DEFAULT_CXX)
-  CPPFLAGS_mutrace = -O0
-  LDFLAGS_mutrace = -rdynamic
-  DEFINES_mutrace = _DEBUG DEBUG
+VALID_CONFIG_mutrace = 1
+CC_mutrace = $(DEFAULT_CC)
+CXX_mutrace = $(DEFAULT_CXX)
+LD_mutrace = $(DEFAULT_CC)
+LDXX_mutrace = $(DEFAULT_CXX)
+CPPFLAGS_mutrace = -O0
+LDFLAGS_mutrace = -rdynamic
+DEFINES_mutrace = _DEBUG DEBUG
 
-  VALID_CONFIG_valgrind = 1
-  REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
-  CC_valgrind = $(DEFAULT_CC)
-  CXX_valgrind = $(DEFAULT_CXX)
-  LD_valgrind = $(DEFAULT_CC)
-  LDXX_valgrind = $(DEFAULT_CXX)
-  CPPFLAGS_valgrind = -O0
-  OPENSSL_CFLAGS_valgrind = -DPURIFY
-  LDFLAGS_valgrind =
-  DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
+VALID_CONFIG_valgrind = 1
+REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
+CC_valgrind = $(DEFAULT_CC)
+CXX_valgrind = $(DEFAULT_CXX)
+LD_valgrind = $(DEFAULT_CC)
+LDXX_valgrind = $(DEFAULT_CXX)
+CPPFLAGS_valgrind = -O0
+OPENSSL_CFLAGS_valgrind = -DPURIFY
+LDFLAGS_valgrind =
+DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20
 
-  VALID_CONFIG_tsan = 1
-  REQUIRE_CUSTOM_LIBRARIES_tsan = 1
-  CC_tsan = clang
-  CXX_tsan = clang++
-  LD_tsan = clang
-  LDXX_tsan = clang++
-  CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
-  LDFLAGS_tsan = -fsanitize=thread
-  DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
+VALID_CONFIG_tsan = 1
+REQUIRE_CUSTOM_LIBRARIES_tsan = 1
+CC_tsan = clang
+CXX_tsan = clang++
+LD_tsan = clang
+LDXX_tsan = clang++
+CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
+LDFLAGS_tsan = -fsanitize=thread
+DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10
 
-  VALID_CONFIG_asan = 1
-  REQUIRE_CUSTOM_LIBRARIES_asan = 1
-  CC_asan = clang
-  CXX_asan = clang++
-  LD_asan = clang
-  LDXX_asan = clang++
-  CPPFLAGS_asan = -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
-  LDFLAGS_asan = -fsanitize=address
-  DEFINES_asan = GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
+VALID_CONFIG_asan = 1
+REQUIRE_CUSTOM_LIBRARIES_asan = 1
+CC_asan = clang
+CXX_asan = clang++
+LD_asan = clang
+LDXX_asan = clang++
+CPPFLAGS_asan = -O0 -fsanitize=address -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
+LDFLAGS_asan = -fsanitize=address
+DEFINES_asan = GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
 
-  VALID_CONFIG_msan = 1
-  REQUIRE_CUSTOM_LIBRARIES_msan = 1
-  CC_msan = clang
-  CXX_msan = clang++-libc++
-  LD_msan = clang
-  LDXX_msan = clang++-libc++
-  CPPFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-error=unused-command-line-argument
-  OPENSSL_CFLAGS_msan = -DPURIFY
-  LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
-  DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=4
+VALID_CONFIG_msan = 1
+REQUIRE_CUSTOM_LIBRARIES_msan = 1
+CC_msan = clang
+CXX_msan = clang++-libc++
+LD_msan = clang
+LDXX_msan = clang++-libc++
+CPPFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-error=unused-command-line-argument
+OPENSSL_CFLAGS_msan = -DPURIFY
+LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1
+DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=4
 
-  VALID_CONFIG_ubsan = 1
-  REQUIRE_CUSTOM_LIBRARIES_ubsan = 1
-  CC_ubsan = clang
-  CXX_ubsan = clang++
-  LD_ubsan = clang
-  LDXX_ubsan = clang++
-  CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
-  OPENSSL_CFLAGS_ubsan = -DPURIFY
-  LDFLAGS_ubsan = -fsanitize=undefined
-  DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
+VALID_CONFIG_ubsan = 1
+REQUIRE_CUSTOM_LIBRARIES_ubsan = 1
+CC_ubsan = clang
+CXX_ubsan = clang++
+LD_ubsan = clang
+LDXX_ubsan = clang++
+CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer -Wno-error=unused-command-line-argument
+OPENSSL_CFLAGS_ubsan = -DPURIFY
+LDFLAGS_ubsan = -fsanitize=undefined
+DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3
 
-  VALID_CONFIG_gcov = 1
-  CC_gcov = gcc
-  CXX_gcov = g++
-  LD_gcov = gcc
-  LDXX_gcov = g++
-  CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage
-  LDFLAGS_gcov = -fprofile-arcs -ftest-coverage
-  DEFINES_gcov = _DEBUG DEBUG
+VALID_CONFIG_gcov = 1
+CC_gcov = gcc
+CXX_gcov = g++
+LD_gcov = gcc
+LDXX_gcov = g++
+CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage
+LDFLAGS_gcov = -fprofile-arcs -ftest-coverage
+DEFINES_gcov = _DEBUG DEBUG
 
 
-  # General settings.
-  # You may want to change these depending on your system.
+# General settings.
+# You may want to change these depending on your system.
 
-  prefix ?= /usr/local
+prefix ?= /usr/local
 
-  PROTOC = protoc
-  DTRACE = dtrace
-  CONFIG ?= opt
-  CC = $(CC_$(CONFIG))
-  CXX = $(CXX_$(CONFIG))
-  LD = $(LD_$(CONFIG))
-  LDXX = $(LDXX_$(CONFIG))
-  AR = ar
-  ifeq ($(SYSTEM),Linux)
-  STRIP = strip --strip-unneeded
-  else
-  ifeq ($(SYSTEM),Darwin)
-  STRIP = strip -x
-  else
-  STRIP = strip
-  endif
-  endif
-  INSTALL = install
-  RM = rm -f
-  PKG_CONFIG = pkg-config
+PROTOC = protoc
+DTRACE = dtrace
+CONFIG ?= opt
+CC = $(CC_$(CONFIG))
+CXX = $(CXX_$(CONFIG))
+LD = $(LD_$(CONFIG))
+LDXX = $(LDXX_$(CONFIG))
+AR = ar
+ifeq ($(SYSTEM),Linux)
+STRIP = strip --strip-unneeded
+else
+ifeq ($(SYSTEM),Darwin)
+STRIP = strip -x
+else
+STRIP = strip
+endif
+endif
+INSTALL = install
+RM = rm -f
+PKG_CONFIG = pkg-config
 
-  ifndef VALID_CONFIG_$(CONFIG)
-  $(error Invalid CONFIG value '$(CONFIG)')
-  endif
+ifndef VALID_CONFIG_$(CONFIG)
+$(error Invalid CONFIG value '$(CONFIG)')
+endif
 
-  ifeq ($(SYSTEM),Linux)
-  TMPOUT = /dev/null
-  else
-  TMPOUT = `mktemp /tmp/test-out-XXXXXX`
-  endif
+ifeq ($(SYSTEM),Linux)
+TMPOUT = /dev/null
+else
+TMPOUT = `mktemp /tmp/test-out-XXXXXX`
+endif
 
-  # Detect if we can use C++11
-  CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc
-  HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
+# Detect if we can use C++11
+CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc
+HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
 
-  # The HOST compiler settings are used to compile the protoc plugins.
-  # In most cases, you won't have to change anything, but if you are
-  # cross-compiling, you can override these variables from GNU make's
-  # command line: make CC=cross-gcc HOST_CC=gcc
+# The HOST compiler settings are used to compile the protoc plugins.
+# In most cases, you won't have to change anything, but if you are
+# 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)
-  endif
+ifdef EXTRA_DEFINES
+DEFINES += $(EXTRA_DEFINES)
+endif
 
-  CFLAGS += -std=c89 -pedantic
-  ifeq ($(HAS_CXX11),true)
-  CXXFLAGS += -std=c++11
-  else
-  CXXFLAGS += -std=c++0x
-  endif
-  CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter
-  LDFLAGS += -g
+CFLAGS += -std=c89 -pedantic
+ifeq ($(HAS_CXX11),true)
+CXXFLAGS += -std=c++11
+else
+CXXFLAGS += -std=c++0x
+endif
+CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wsign-conversion
+LDFLAGS += -g
 
-  CPPFLAGS += $(CPPFLAGS_$(CONFIG))
-  DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
-  LDFLAGS += $(LDFLAGS_$(CONFIG))
+CPPFLAGS += $(CPPFLAGS_$(CONFIG))
+DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
+LDFLAGS += $(LDFLAGS_$(CONFIG))
 
-  ifneq ($(SYSTEM),MINGW32)
-  PIC_CPPFLAGS = -fPIC
-  CPPFLAGS += -fPIC
-  LDFLAGS += -fPIC
-  endif
+ifneq ($(SYSTEM),MINGW32)
+PIC_CPPFLAGS = -fPIC
+CPPFLAGS += -fPIC
+LDFLAGS += -fPIC
+endif
 
-  INCLUDES = . include $(GENDIR)
-  LDFLAGS += -Llibs/$(CONFIG)
+INCLUDES = . include $(GENDIR)
+LDFLAGS += -Llibs/$(CONFIG)
 
-  ifeq ($(SYSTEM),Darwin)
-  ifneq ($(wildcard /usr/local/ssl/include),)
-  INCLUDES += /usr/local/ssl/include
-  endif
-  ifneq ($(wildcard /opt/local/include),)
-  INCLUDES += /opt/local/include
-  endif
-  ifneq ($(wildcard /usr/local/include),)
-  INCLUDES += /usr/local/include
-  endif
-  LIBS = m z
-  ifneq ($(wildcard /usr/local/ssl/lib),)
-  LDFLAGS += -L/usr/local/ssl/lib
-  endif
-  ifneq ($(wildcard /opt/local/lib),)
-  LDFLAGS += -L/opt/local/lib
-  endif
-  ifneq ($(wildcard /usr/local/lib),)
-  LDFLAGS += -L/usr/local/lib
-  endif
-  endif
+ifeq ($(SYSTEM),Darwin)
+ifneq ($(wildcard /usr/local/ssl/include),)
+INCLUDES += /usr/local/ssl/include
+endif
+ifneq ($(wildcard /opt/local/include),)
+INCLUDES += /opt/local/include
+endif
+ifneq ($(wildcard /usr/local/include),)
+INCLUDES += /usr/local/include
+endif
+LIBS = m z
+ifneq ($(wildcard /usr/local/ssl/lib),)
+LDFLAGS += -L/usr/local/ssl/lib
+endif
+ifneq ($(wildcard /opt/local/lib),)
+LDFLAGS += -L/opt/local/lib
+endif
+ifneq ($(wildcard /usr/local/lib),)
+LDFLAGS += -L/usr/local/lib
+endif
+endif
 
-  ifeq ($(SYSTEM),Linux)
-  LIBS = rt m z pthread
-  LDFLAGS += -pthread
-  endif
+ifeq ($(SYSTEM),Linux)
+LIBS = rt m z pthread
+LDFLAGS += -pthread
+endif
 
-  ifeq ($(SYSTEM),MINGW32)
-  LIBS = m z pthread
-  LDFLAGS += -pthread
-  endif
+ifeq ($(SYSTEM),MINGW32)
+LIBS = m z pthread
+LDFLAGS += -pthread
+endif
 
-  GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc
-  GTEST_LIB += -lgflags
-  ifeq ($(V),1)
-  E = @:
-  Q =
-  else
-  E = @echo
-  Q = @
-  endif
+GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc
+GTEST_LIB += -lgflags
+ifeq ($(V),1)
+E = @:
+Q =
+else
+E = @echo
+Q = @
+endif
 
-  VERSION = ${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build}
+VERSION = ${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build}
 
-  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
-  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
+CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
+CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
 
-  LDFLAGS += $(ARCH_FLAGS)
-  LDLIBS += $(addprefix -l, $(LIBS))
-  LDLIBSXX += $(addprefix -l, $(LIBSXX))
+LDFLAGS += $(ARCH_FLAGS)
+LDLIBS += $(addprefix -l, $(LIBS))
+LDLIBSXX += $(addprefix -l, $(LIBSXX))
 
-  HOST_CPPFLAGS = $(CPPFLAGS)
-  HOST_CFLAGS = $(CFLAGS)
-  HOST_CXXFLAGS = $(CXXFLAGS)
-  HOST_LDFLAGS = $(LDFLAGS)
-  HOST_LDLIBS = $(LDLIBS)
+HOST_CPPFLAGS = $(CPPFLAGS)
+HOST_CFLAGS = $(CFLAGS)
+HOST_CXXFLAGS = $(CXXFLAGS)
+HOST_LDFLAGS = $(LDFLAGS)
+HOST_LDLIBS = $(LDLIBS)
 
 
-  # These are automatically computed variables.
-  # There shouldn't be any need to change anything from now on.
+# These are automatically computed variables.
+# There shouldn't be any need to change anything from now on.
 
-  -include cache.mk
+-include cache.mk
 
-  CACHE_MK =
+CACHE_MK =
 
-  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)
 
-  ifeq ($(HAS_PKG_CONFIG), true)
-  CACHE_MK += HAS_PKG_CONFIG = true,
-  endif
+ifeq ($(HAS_PKG_CONFIG), true)
+CACHE_MK += HAS_PKG_CONFIG = true,
+endif
 
-  PC_TEMPLATE = prefix=$(prefix),\
-  exec_prefix=${'\$${prefix}'},\
-  includedir=${'\$${prefix}'}/include,\
-  libdir=${'\$${exec_prefix}'}/lib,\
-  ,\
-  Name: $(PC_NAME),\
-  Description: $(PC_DESCRIPTION),\
-  Version: $(VERSION),\
-  Cflags: -I${'\$${includedir}'} $(PC_CFLAGS),\
-  Requires.private: $(PC_REQUIRES_PRIVATE),\
-  Libs: -L${'\$${libdir}'} $(PC_LIB),\
-  Libs.private: $(PC_LIBS_PRIVATE)
+PC_TEMPLATE = prefix=$(prefix),\
+exec_prefix=${'\$${prefix}'},\
+includedir=${'\$${prefix}'}/include,\
+libdir=${'\$${exec_prefix}'}/lib,\
+,\
+Name: $(PC_NAME),\
+Description: $(PC_DESCRIPTION),\
+Version: $(VERSION),\
+Cflags: -I${'\$${includedir}'} $(PC_CFLAGS),\
+Requires.private: $(PC_REQUIRES_PRIVATE),\
+Libs: -L${'\$${libdir}'} $(PC_LIB),\
+Libs.private: $(PC_LIBS_PRIVATE)
 
-  # gpr .pc file
-  PC_NAME = gRPC Portable Runtime
-  PC_DESCRIPTION = gRPC Portable Runtime
-  PC_CFLAGS = -pthread
-  PC_REQUIRES_PRIVATE =
-  PC_LIBS_PRIVATE = -lpthread
-  PC_LIB = -lgpr
-  ifneq ($(SYSTEM),Darwin)
-  PC_LIBS_PRIVATE += -lrt
-  endif
-  GPR_PC_FILE := $(PC_TEMPLATE)
+# gpr .pc file
+PC_NAME = gRPC Portable Runtime
+PC_DESCRIPTION = gRPC Portable Runtime
+PC_CFLAGS = -pthread
+PC_REQUIRES_PRIVATE =
+PC_LIBS_PRIVATE = -lpthread
+PC_LIB = -lgpr
+ifneq ($(SYSTEM),Darwin)
+PC_LIBS_PRIVATE += -lrt
+endif
+GPR_PC_FILE := $(PC_TEMPLATE)
 
-  ifeq ($(SYSTEM),MINGW32)
-  SHARED_EXT = dll
-  endif
-  ifeq ($(SYSTEM),Darwin)
-  SHARED_EXT = dylib
-  endif
-  ifeq ($(SHARED_EXT),)
-  SHARED_EXT = so.$(VERSION)
-  endif
+ifeq ($(SYSTEM),MINGW32)
+SHARED_EXT = dll
+endif
+ifeq ($(SYSTEM),Darwin)
+SHARED_EXT = dylib
+endif
+ifeq ($(SHARED_EXT),)
+SHARED_EXT = so.$(VERSION)
+endif
 
-  ifeq ($(wildcard .git),)
-  IS_GIT_FOLDER = false
-  else
-  IS_GIT_FOLDER = true
-  endif
+ifeq ($(wildcard .git),)
+IS_GIT_FOLDER = false
+else
+IS_GIT_FOLDER = true
+endif
 
-  ifeq ($(SYSTEM),Linux)
-  OPENSSL_REQUIRES_DL = true
-  endif
+ifeq ($(SYSTEM),Linux)
+OPENSSL_REQUIRES_DL = true
+endif
 
-  ifeq ($(SYSTEM),Darwin)
-  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
-  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 ($(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
+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)
-  OPENSSL_LIBS = ssl32 eay32
-  else
-  OPENSSL_LIBS = ssl crypto
-  endif
+ifeq ($(SYSTEM),MINGW32)
+OPENSSL_LIBS = ssl32 eay32
+else
+OPENSSL_LIBS = ssl crypto
+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)
-  PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS)
+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)
+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
+ifeq ($(OPENSSL_REQUIRES_DL),true)
+OPENSSL_ALPN_CHECK_CMD += -ldl
+OPENSSL_NPN_CHECK_CMD += -ldl
+endif
 
-  endif # HAS_PKG_CONFIG
+endif # HAS_PKG_CONFIG
 
-  PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS)
+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
-  SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS)
-  ZOOKEEPER_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt
+PROTOC_CHECK_CMD = which protoc > /dev/null
+PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3
+DTRACE_CHECK_CMD = which dtrace > /dev/null
+SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS)
+ZOOKEEPER_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt
 
-  ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
-  HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  ifeq ($(HAS_SYSTEM_PERFTOOLS),true)
-  DEFINES += GRPC_HAVE_PERFTOOLS
-  LIBS += profiler
-  CACHE_MK += HAS_SYSTEM_PERFTOOLS = true,
-  endif
-  endif
+ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
+HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_SYSTEM_PERFTOOLS),true)
+DEFINES += GRPC_HAVE_PERFTOOLS
+LIBS += profiler
+CACHE_MK += HAS_SYSTEM_PERFTOOLS = true,
+endif
+endif
 
-  HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
-  HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true)
-  HAS_SYSTEM_OPENSSL_NPN = true
-  CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true,
-  else
-  HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  endif
-  ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
-  CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true,
-  endif
-  HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  ifeq ($(HAS_SYSTEM_ZLIB),true)
-  CACHE_MK += HAS_SYSTEM_ZLIB = true,
-  endif
-  HAS_SYSTEM_PROTOBUF ?= $(HAS_SYSTEM_PROTOBUF_VERIFY)
-  ifeq ($(HAS_SYSTEM_PROTOBUF),true)
-  CACHE_MK += HAS_SYSTEM_PROTOBUF = true,
-  endif
-  else
-  # override system libraries if the config requires a custom compiled library
-  HAS_SYSTEM_OPENSSL_ALPN = false
-  HAS_SYSTEM_OPENSSL_NPN = false
-  HAS_SYSTEM_ZLIB = false
-  HAS_SYSTEM_PROTOBUF = false
-  endif
+HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
+HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true)
+HAS_SYSTEM_OPENSSL_NPN = true
+CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true,
+else
+HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
+endif
+ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
+CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true,
+endif
+HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_SYSTEM_ZLIB),true)
+CACHE_MK += HAS_SYSTEM_ZLIB = true,
+endif
+HAS_SYSTEM_PROTOBUF ?= $(HAS_SYSTEM_PROTOBUF_VERIFY)
+ifeq ($(HAS_SYSTEM_PROTOBUF),true)
+CACHE_MK += HAS_SYSTEM_PROTOBUF = true,
+endif
+else
+# override system libraries if the config requires a custom compiled library
+HAS_SYSTEM_OPENSSL_ALPN = false
+HAS_SYSTEM_OPENSSL_NPN = false
+HAS_SYSTEM_ZLIB = false
+HAS_SYSTEM_PROTOBUF = false
+endif
 
-  HAS_PROTOC ?= $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  ifeq ($(HAS_PROTOC),true)
-  CACHE_MK += HAS_PROTOC = true,
-  HAS_VALID_PROTOC ?= $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || echo false)
-  ifeq ($(HAS_VALID_PROTOC),true)
-  CACHE_MK += HAS_VALID_PROTOC = true,
-  endif
-  else
-  HAS_VALID_PROTOC = false
-  endif
+HAS_PROTOC ?= $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_PROTOC),true)
+CACHE_MK += HAS_PROTOC = true,
+HAS_VALID_PROTOC ?= $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_VALID_PROTOC),true)
+CACHE_MK += HAS_VALID_PROTOC = true,
+endif
+else
+HAS_VALID_PROTOC = false
+endif
 
-  # Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present
-  # in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap
-  # distribution. It's part of the base system on BSD/Solaris machines).
-  ifndef HAS_SYSTEMTAP
-  HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false)
-  HAS_SYSTEMTAP = false
-  ifeq ($(HAS_SYSTEMTAP_HEADERS),true)
-  ifeq ($(HAS_DTRACE),true)
-  HAS_SYSTEMTAP = true
-  endif
-  endif
-  endif
+# Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present
+# in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap
+# distribution. It's part of the base system on BSD/Solaris machines).
+ifndef HAS_SYSTEMTAP
+HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false)
+HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false)
+HAS_SYSTEMTAP = false
+ifeq ($(HAS_SYSTEMTAP_HEADERS),true)
+ifeq ($(HAS_DTRACE),true)
+HAS_SYSTEMTAP = true
+endif
+endif
+endif
 
-  ifeq ($(HAS_SYSTEMTAP),true)
-  CACHE_MK += HAS_SYSTEMTAP = true,
-  endif
+ifeq ($(HAS_SYSTEMTAP),true)
+CACHE_MK += HAS_SYSTEMTAP = true,
+endif
 
-  HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false)
+HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false)
 
-  # Note that for testing purposes, one can do:
-  #   make HAS_EMBEDDED_OPENSSL_ALPN=false
-  # to emulate the fact we do not have OpenSSL in the third_party folder.
-  ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
-  HAS_EMBEDDED_OPENSSL_ALPN = false
-  else
-  HAS_EMBEDDED_OPENSSL_ALPN = true
-  endif
+# Note that for testing purposes, one can do:
+#   make HAS_EMBEDDED_OPENSSL_ALPN=false
+# to emulate the fact we do not have OpenSSL in the third_party folder.
+ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
+HAS_EMBEDDED_OPENSSL_ALPN = false
+else
+HAS_EMBEDDED_OPENSSL_ALPN = true
+endif
 
-  ifeq ($(wildcard third_party/zlib/zlib.h),)
-  HAS_EMBEDDED_ZLIB = false
-  else
-  HAS_EMBEDDED_ZLIB = true
-  endif
+ifeq ($(wildcard third_party/zlib/zlib.h),)
+HAS_EMBEDDED_ZLIB = false
+else
+HAS_EMBEDDED_ZLIB = true
+endif
 
-  ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),)
-  HAS_EMBEDDED_PROTOBUF = false
-  ifneq ($(HAS_VALID_PROTOC),true)
-  NO_PROTOC = true
-  endif
-  else
-  HAS_EMBEDDED_PROTOBUF = true
-  endif
+ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),)
+HAS_EMBEDDED_PROTOBUF = false
+ifneq ($(HAS_VALID_PROTOC),true)
+NO_PROTOC = true
+endif
+else
+HAS_EMBEDDED_PROTOBUF = true
+endif
 
-  PC_REQUIRES_GRPC = gpr
-  PC_LIBS_GRPC =
+PC_REQUIRES_GRPC = gpr
+PC_LIBS_GRPC =
 
-  ifeq ($(HAS_SYSTEM_ZLIB),false)
-  ifeq ($(HAS_EMBEDDED_ZLIB),true)
-  ZLIB_DEP = $(LIBDIR)/$(CONFIG)/zlib/libz.a
-  CPPFLAGS += -Ithird_party/zlib
-  LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib
-  else
-  DEP_MISSING += zlib
-  endif
-  else
-  ifeq ($(HAS_PKG_CONFIG),true)
-  CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib)
-  LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib)
-  PC_REQUIRES_GRPC += zlib
-  else
-  PC_LIBS_GRPC += -lz
-  endif
-  endif
+ifeq ($(HAS_SYSTEM_ZLIB),false)
+ifeq ($(HAS_EMBEDDED_ZLIB),true)
+ZLIB_DEP = $(LIBDIR)/$(CONFIG)/zlib/libz.a
+CPPFLAGS += -Ithird_party/zlib
+LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib
+else
+DEP_MISSING += zlib
+endif
+else
+ifeq ($(HAS_PKG_CONFIG),true)
+CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib)
+LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib)
+PC_REQUIRES_GRPC += zlib
+else
+PC_LIBS_GRPC += -lz
+endif
+endif
 
-  OPENSSL_PKG_CONFIG = false
+OPENSSL_PKG_CONFIG = false
 
-  PC_REQUIRES_SECURE =
-  PC_LIBS_SECURE =
+PC_REQUIRES_SECURE =
+PC_LIBS_SECURE =
 
-  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)
-  ifeq ($(SYSTEM),Linux)
-  ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),)
-  LDFLAGS_OPENSSL_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L openssl | sed s/L/Wl,-rpath,/)
-  endif
-  endif
-  LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS)
-  else
-  LIBS_SECURE = $(OPENSSL_LIBS)
-  ifeq ($(OPENSSL_REQUIRES_DL),true)
-  LIBS_SECURE += dl
-  PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE))
-  endif
-  endif
-  else
-  ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true)
-  USE_SYSTEM_OPENSSL = false
-  OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a
-  OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/openssl/libcrypto.a
-  # need to prefix these to ensure overriding system libraries
-  CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS)
-  LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS)
-  ifeq ($(OPENSSL_REQUIRES_DL),true)
-  LIBS_SECURE = dl
-  endif
-  else
-  ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
-  USE_SYSTEM_OPENSSL = true
-  CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
-  LIBS_SECURE = $(OPENSSL_LIBS)
-  ifeq ($(OPENSSL_REQUIRES_DL),true)
-  LIBS_SECURE += dl
-  endif
-  else
-  NO_SECURE = true
-  endif
-  endif
-  endif
+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)
+ifeq ($(SYSTEM),Linux)
+ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),)
+LDFLAGS_OPENSSL_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L openssl | sed s/L/Wl,-rpath,/)
+endif
+endif
+LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS)
+else
+LIBS_SECURE = $(OPENSSL_LIBS)
+ifeq ($(OPENSSL_REQUIRES_DL),true)
+LIBS_SECURE += dl
+PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE))
+endif
+endif
+else
+ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true)
+USE_SYSTEM_OPENSSL = false
+OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a
+OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/openssl/libcrypto.a
+# need to prefix these to ensure overriding system libraries
+CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS)
+LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS)
+ifeq ($(OPENSSL_REQUIRES_DL),true)
+LIBS_SECURE = dl
+endif
+else
+ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true)
+USE_SYSTEM_OPENSSL = true
+CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
+LIBS_SECURE = $(OPENSSL_LIBS)
+ifeq ($(OPENSSL_REQUIRES_DL),true)
+LIBS_SECURE += dl
+endif
+else
+NO_SECURE = true
+endif
+endif
+endif
 
-  ifeq ($(OPENSSL_PKG_CONFIG),true)
-  LDLIBS_SECURE += $(shell $(PKG_CONFIG) --libs-only-l openssl)
-  else
-  LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
-  endif
+ifeq ($(OPENSSL_PKG_CONFIG),true)
+LDLIBS_SECURE += $(shell $(PKG_CONFIG) --libs-only-l openssl)
+else
+LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
+endif
 
-  # grpc .pc file
-  PC_NAME = gRPC
-  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)
+# grpc .pc file
+PC_NAME = gRPC
+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
-  PC_NAME = gRPC unsecure
-  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)
+# gprc_unsecure .pc file
+PC_NAME = gRPC unsecure
+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)
 
-  # gprc_zookeeper .pc file
-  PC_NAME = gRPC zookeeper
-  PC_DESCRIPTION = gRPC's zookeeper plugin
-  PC_CFLAGS =
-  PC_REQUIRES_PRIVATE =
-  PC_LIBS_PRIVATE = -lzookeeper_mt
-  GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE)
+# gprc_zookeeper .pc file
+PC_NAME = gRPC zookeeper
+PC_DESCRIPTION = gRPC's zookeeper plugin
+PC_CFLAGS =
+PC_REQUIRES_PRIVATE =
+PC_LIBS_PRIVATE = -lzookeeper_mt
+GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE)
 
-  PROTOBUF_PKG_CONFIG = false
+PROTOBUF_PKG_CONFIG = false
 
-  PC_REQUIRES_GRPCXX =
-  PC_LIBS_GRPCXX =
+PC_REQUIRES_GRPCXX =
+PC_LIBS_GRPCXX =
 
-  CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS)
+CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS)
 
-  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)
-  ifeq ($(SYSTEM),Linux)
-  ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),)
-  LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L protobuf | sed s/L/Wl,-rpath,/)
-  endif
-  endif
-  else
-  PC_LIBS_GRPCXX = -lprotobuf
-  endif
-  else
-  ifeq ($(HAS_EMBEDDED_PROTOBUF),true)
-  PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a
-  CPPFLAGS := -Ithird_party/protobuf/src $(CPPFLAGS)
-  LDFLAGS := -L$(LIBDIR)/$(CONFIG)/protobuf $(LDFLAGS)
-  PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc
-  else
-  NO_PROTOBUF = true
-  endif
-  endif
+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)
+ifeq ($(SYSTEM),Linux)
+ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),)
+LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L protobuf | sed s/L/Wl,-rpath,/)
+endif
+endif
+else
+PC_LIBS_GRPCXX = -lprotobuf
+endif
+else
+ifeq ($(HAS_EMBEDDED_PROTOBUF),true)
+PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a
+CPPFLAGS := -Ithird_party/protobuf/src $(CPPFLAGS)
+LDFLAGS := -L$(LIBDIR)/$(CONFIG)/protobuf $(LDFLAGS)
+PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc
+else
+NO_PROTOBUF = true
+endif
+endif
 
-  LIBS_PROTOBUF = protobuf
-  LIBS_PROTOC = protoc protobuf
+LIBS_PROTOBUF = protobuf
+LIBS_PROTOC = protoc protobuf
 
-  HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC))
+HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC))
 
-  ifeq ($(PROTOBUF_PKG_CONFIG),true)
-  LDLIBS_PROTOBUF += $(shell $(PKG_CONFIG) --libs-only-l protobuf)
-  else
-  LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF))
-  endif
+ifeq ($(PROTOBUF_PKG_CONFIG),true)
+LDLIBS_PROTOBUF += $(shell $(PKG_CONFIG) --libs-only-l protobuf)
+else
+LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF))
+endif
 
-  # grpc++ .pc file
-  PC_NAME = gRPC++
-  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++ .pc file
+PC_NAME = gRPC++
+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
-  PC_NAME = gRPC++ unsecure
-  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)
+# grpc++_unsecure .pc file
+PC_NAME = gRPC++ unsecure
+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)
-  NO_DEPS = true
-  endif
+ifeq ($(MAKECMDGOALS),clean)
+NO_DEPS = true
+endif
 
-  INSTALL_OK = false
-  ifeq ($(HAS_VALID_PROTOC),true)
-  ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true)
-  INSTALL_OK = true
-  endif
-  endif
+INSTALL_OK = false
+ifeq ($(HAS_VALID_PROTOC),true)
+ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true)
+INSTALL_OK = true
+endif
+endif
 
-  .SECONDARY = %.pb.h %.pb.cc
+.SECONDARY = %.pb.h %.pb.cc
 
-  PROTOC_PLUGINS =\
-  % for tgt in targets:
-  % if tgt.build == 'protoc':
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+PROTOC_PLUGINS =\
+% for tgt in targets:
+% if tgt.build == 'protoc':
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
-  ifeq ($(DEP_MISSING),)
-  all: static shared plugins\
-  % for tgt in targets:
-  % if tgt.build == 'all':
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+ifeq ($(DEP_MISSING),)
+all: static shared plugins\
+% for tgt in targets:
+% if tgt.build == 'all':
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
-  dep_error:
-  	@echo "You shouldn't see this message - all of your dependencies are correct."
-  else
-  all: dep_error git_update stop
+dep_error:
+	@echo "You shouldn't see this message - all of your dependencies are correct."
+else
+all: dep_error git_update stop
 
-  dep_error:
-  	@echo
-  	@echo "DEPENDENCY ERROR"
-  	@echo
-  	@echo "You are missing system dependencies that are essential to build grpc,"
-  	@echo "and the third_party directory doesn't have them:"
-  	@echo
-  	@echo "  $(DEP_MISSING)"
-  	@echo
-  	@echo "Installing the development packages for your system will solve"
-  	@echo "this issue. Please consult INSTALL to get more information."
-  	@echo
-  	@echo "If you need information about why these tests failed, run:"
-  	@echo
-  	@echo "  make run_dep_checks"
-  	@echo
-  endif
+dep_error:
+	@echo
+	@echo "DEPENDENCY ERROR"
+	@echo
+	@echo "You are missing system dependencies that are essential to build grpc,"
+	@echo "and the third_party directory doesn't have them:"
+	@echo
+	@echo "  $(DEP_MISSING)"
+	@echo
+	@echo "Installing the development packages for your system will solve"
+	@echo "this issue. Please consult INSTALL to get more information."
+	@echo
+	@echo "If you need information about why these tests failed, run:"
+	@echo
+	@echo "  make run_dep_checks"
+	@echo
+endif
 
-  git_update:
-  ifeq ($(IS_GIT_FOLDER),true)
-  	@echo "Additionally, since you are in a git clone, you can download the"
-  	@echo "missing dependencies in third_party by running the following command:"
-  	@echo
-  	@echo "  git submodule update --init"
-  	@echo
-  endif
+git_update:
+ifeq ($(IS_GIT_FOLDER),true)
+	@echo "Additionally, since you are in a git clone, you can download the"
+	@echo "missing dependencies in third_party by running the following command:"
+	@echo
+	@echo "  git submodule update --init"
+	@echo
+endif
 
-  openssl_dep_error: openssl_dep_message git_update stop
+openssl_dep_error: openssl_dep_message git_update stop
 
-  protobuf_dep_error: protobuf_dep_message git_update stop
+protobuf_dep_error: protobuf_dep_message git_update stop
 
-  protoc_dep_error: protoc_dep_message git_update stop
+protoc_dep_error: protoc_dep_message git_update stop
 
-  openssl_dep_message:
-  	@echo
-  	@echo "DEPENDENCY ERROR"
-  	@echo
-  	@echo "The target you are trying to run requires OpenSSL."
-  	@echo "Your system doesn't have it, and neither does the third_party directory."
-  	@echo
-  	@echo "Please consult INSTALL to get more information."
-  	@echo
-  	@echo "If you need information about why these tests failed, run:"
-  	@echo
-  	@echo "  make run_dep_checks"
-  	@echo
+openssl_dep_message:
+	@echo
+	@echo "DEPENDENCY ERROR"
+	@echo
+	@echo "The target you are trying to run requires OpenSSL."
+	@echo "Your system doesn't have it, and neither does the third_party directory."
+	@echo
+	@echo "Please consult INSTALL to get more information."
+	@echo
+	@echo "If you need information about why these tests failed, run:"
+	@echo
+	@echo "  make run_dep_checks"
+	@echo
 
-  protobuf_dep_message:
-  	@echo
-  	@echo "DEPENDENCY ERROR"
-  	@echo
-  	@echo "The target you are trying to run requires protobuf 3.0.0+"
-  	@echo "Your system doesn't have it, and neither does the third_party directory."
-  	@echo
-  	@echo "Please consult INSTALL to get more information."
-  	@echo
-  	@echo "If you need information about why these tests failed, run:"
-  	@echo
-  	@echo "  make run_dep_checks"
-  	@echo
+protobuf_dep_message:
+	@echo
+	@echo "DEPENDENCY ERROR"
+	@echo
+	@echo "The target you are trying to run requires protobuf 3.0.0+"
+	@echo "Your system doesn't have it, and neither does the third_party directory."
+	@echo
+	@echo "Please consult INSTALL to get more information."
+	@echo
+	@echo "If you need information about why these tests failed, run:"
+	@echo
+	@echo "  make run_dep_checks"
+	@echo
 
-  protoc_dep_message:
-  	@echo
-  	@echo "DEPENDENCY ERROR"
-  	@echo
-  	@echo "The target you are trying to run requires protobuf-compiler 3.0.0+"
-  	@echo "Your system doesn't have it, and neither does the third_party directory."
-  	@echo
-  	@echo "Please consult INSTALL to get more information."
-  	@echo
-  	@echo "If you need information about why these tests failed, run:"
-  	@echo
-  	@echo "  make run_dep_checks"
-  	@echo
+protoc_dep_message:
+	@echo
+	@echo "DEPENDENCY ERROR"
+	@echo
+	@echo "The target you are trying to run requires protobuf-compiler 3.0.0+"
+	@echo "Your system doesn't have it, and neither does the third_party directory."
+	@echo
+	@echo "Please consult INSTALL to get more information."
+	@echo
+	@echo "If you need information about why these tests failed, run:"
+	@echo
+	@echo "  make run_dep_checks"
+	@echo
 
-  systemtap_dep_error:
-  	@echo
-  	@echo "DEPENDENCY ERROR"
-  	@echo
-  	@echo "Under the '$(CONFIG)' configutation, the target you are trying "
-  	@echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other "
-  	@echo "platforms such as Solaris and *BSD). "
-  	@echo
-  	@echo "Please consult INSTALL to get more information."
-  	@echo
+systemtap_dep_error:
+	@echo
+	@echo "DEPENDENCY ERROR"
+	@echo
+	@echo "Under the '$(CONFIG)' configutation, the target you are trying "
+	@echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other "
+	@echo "platforms such as Solaris and *BSD). "
+	@echo
+	@echo "Please consult INSTALL to get more information."
+	@echo
 
-  stop:
-  	@false
+stop:
+	@false
 
-  % for tgt in targets:
-  ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name}
-  % endfor
+% for tgt in targets:
+${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name}
+% endfor
 
-  run_dep_checks:
-  	$(OPENSSL_ALPN_CHECK_CMD) || true
-  	$(OPENSSL_NPN_CHECK_CMD) || true
-  	$(ZLIB_CHECK_CMD) || true
-  	$(PERFTOOLS_CHECK_CMD) || true
-  	$(PROTOBUF_CHECK_CMD) || true
-  	$(PROTOC_CHECK_VERSION_CMD) || true
-  	$(ZOOKEEPER_CHECK_CMD) || true
+run_dep_checks:
+	$(OPENSSL_ALPN_CHECK_CMD) || true
+	$(OPENSSL_NPN_CHECK_CMD) || true
+	$(ZLIB_CHECK_CMD) || true
+	$(PERFTOOLS_CHECK_CMD) || true
+	$(PROTOBUF_CHECK_CMD) || true
+	$(PROTOC_CHECK_VERSION_CMD) || true
+	$(ZOOKEEPER_CHECK_CMD) || true
 
-  $(LIBDIR)/$(CONFIG)/zlib/libz.a:
-  	$(E) "[MAKE]    Building zlib"
-  	$(Q)(cd third_party/zlib ; CC="$(CC)" CFLAGS="$(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(ZLIB_CFLAGS_EXTRA)" ./configure --static)
-  	$(Q)$(MAKE) -C third_party/zlib clean
-  	$(Q)$(MAKE) -C third_party/zlib
-  	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/zlib
-  	$(Q)cp third_party/zlib/libz.a $(LIBDIR)/$(CONFIG)/zlib
+$(LIBDIR)/$(CONFIG)/zlib/libz.a:
+	$(E) "[MAKE]    Building zlib"
+	$(Q)(cd third_party/zlib ; CC="$(CC)" CFLAGS="$(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(ZLIB_CFLAGS_EXTRA)" ./configure --static)
+	$(Q)$(MAKE) -C third_party/zlib clean
+	$(Q)$(MAKE) -C third_party/zlib
+	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/zlib
+	$(Q)cp third_party/zlib/libz.a $(LIBDIR)/$(CONFIG)/zlib
 
-  $(LIBDIR)/$(CONFIG)/openssl/libssl.a:
-  	$(E) "[MAKE]    Building openssl for $(SYSTEM)"
-  ifeq ($(SYSTEM),Darwin)
-  	$(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./Configure darwin64-x86_64-cc)
-  else
-  ifeq ($(SYSTEM),MINGW32)
-  	@echo "We currently don't have a good way to compile OpenSSL in-place under msys."
-  	@echo "Please provide a OpenSSL in your mingw32 system."
-  	@echo
-  	@echo "Note that you can find a compatible version of the libraries here:"
-  	@echo
-  	@echo "http://slproweb.com/products/Win32OpenSSL.html"
-  	@echo
-  	@echo "If you decide to install that one, take the full version. The light"
-  	@echo "version only contains compiled DLLs, without the development files."
-  	@echo
-  	@echo "When installing, chose to copy the OpenSSL dlls to the OpenSSL binaries"
-  	@echo "directory. This way we'll link to them directly."
-  	@echo
-  	@echo "You can then re-start the build the following way:"
-  	@echo
-  	@echo "  CPPFLAGS=-I/c/OpenSSL-Win64/include LDFLAGS=-L/c/OpenSSL-Win64 make"
-  	@false
-  else
-  	$(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG)))
-  endif
-  endif
-  	$(Q)$(MAKE) -j 1 -C third_party/openssl clean
-  	$(Q)(unset CPPFLAGS; $(MAKE) -j 1 -C third_party/openssl build_crypto build_ssl)
-  	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl
-  	$(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl
+$(LIBDIR)/$(CONFIG)/openssl/libssl.a:
+	$(E) "[MAKE]    Building openssl for $(SYSTEM)"
+ifeq ($(SYSTEM),Darwin)
+	$(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./Configure darwin64-x86_64-cc)
+else
+ifeq ($(SYSTEM),MINGW32)
+	@echo "We currently don't have a good way to compile OpenSSL in-place under msys."
+	@echo "Please provide a OpenSSL in your mingw32 system."
+	@echo
+	@echo "Note that you can find a compatible version of the libraries here:"
+	@echo
+	@echo "http://slproweb.com/products/Win32OpenSSL.html"
+	@echo
+	@echo "If you decide to install that one, take the full version. The light"
+	@echo "version only contains compiled DLLs, without the development files."
+	@echo
+	@echo "When installing, chose to copy the OpenSSL dlls to the OpenSSL binaries"
+	@echo "directory. This way we'll link to them directly."
+	@echo
+	@echo "You can then re-start the build the following way:"
+	@echo
+	@echo "  CPPFLAGS=-I/c/OpenSSL-Win64/include LDFLAGS=-L/c/OpenSSL-Win64 make"
+	@false
+else
+	$(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG)))
+endif
+endif
+	$(Q)$(MAKE) -j 1 -C third_party/openssl clean
+	$(Q)(unset CPPFLAGS; $(MAKE) -j 1 -C third_party/openssl build_crypto build_ssl)
+	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl
+	$(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl
 
-  third_party/protobuf/configure:
-  	$(E) "[AUTOGEN] Preparing protobuf"
-  	$(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete)
+third_party/protobuf/configure:
+	$(E) "[AUTOGEN] Preparing protobuf"
+	$(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete)
 
-  $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure
-  	$(E) "[MAKE]    Building protobuf"
-  	$(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(PROTOBUF_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(PROTOBUF_CPPFLAGS_EXTRA)" ./configure --disable-shared --enable-static)
-  	$(Q)$(MAKE) -C third_party/protobuf clean
-  	$(Q)$(MAKE) -C third_party/protobuf
-  	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf
-  	$(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf
-  	$(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf
-  	$(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf
-  	$(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf
+$(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure
+	$(E) "[MAKE]    Building protobuf"
+	$(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(PROTOBUF_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(PROTOBUF_CPPFLAGS_EXTRA)" ./configure --disable-shared --enable-static)
+	$(Q)$(MAKE) -C third_party/protobuf clean
+	$(Q)$(MAKE) -C third_party/protobuf
+	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf
+	$(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf
+	$(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf
+	$(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf
+	$(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf
 
-  static: static_c static_cxx
+static: static_c static_cxx
 
-  static_c: pc_c pc_c_unsecure cache.mk pc_gpr pc_c_zookeeper\
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
-   static_zookeeper_libs
+static_c: pc_c pc_c_unsecure cache.mk pc_gpr pc_c_zookeeper\
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
+ static_zookeeper_libs
 
 
-  static_cxx: pc_cxx pc_cxx_unsecure pc_gpr cache.mk \
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c++':
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
+static_cxx: pc_cxx pc_cxx_unsecure pc_gpr cache.mk \
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c++':
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
 
 
-  shared: shared_c shared_cxx
+shared: shared_c shared_cxx
 
-  shared_c: pc_c pc_c_unsecure pc_gpr cache.mk pc_c_zookeeper\
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
-  % endif
-  % endfor
-   shared_zookeeper_libs
+shared_c: pc_c pc_c_unsecure pc_gpr cache.mk pc_c_zookeeper\
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
+% endif
+% endfor
+ shared_zookeeper_libs
 
-  shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c++':
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
-  % endif
-  % endfor
+shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c++':
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
+% endif
+% endfor
 
 
-  shared_csharp: shared_c \
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'csharp':
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
-  % endif
-  % endfor
+shared_csharp: shared_c \
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'csharp':
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
+% endif
+% endfor
 
-  ifeq ($(HAS_ZOOKEEPER),true)
-  static_zookeeper_libs:\
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+static_zookeeper_libs:\
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
 
-  shared_zookeeper_libs:\
-  % for lib in libs:
-  % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
-  % endif
-  % endfor
+shared_zookeeper_libs:\
+% for lib in libs:
+% if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
+% endif
+% endfor
 
-  else
+else
 
-  static_zookeeper_libs:
+static_zookeeper_libs:
 
-  shared_zookeeper_libs:
+shared_zookeeper_libs:
 
-  endif
+endif
 
-  grpc_csharp_ext: shared_csharp
+grpc_csharp_ext: shared_csharp
 
-  plugins: $(PROTOC_PLUGINS)
+plugins: $(PROTOC_PLUGINS)
 
-  privatelibs: privatelibs_c privatelibs_cxx
+privatelibs: privatelibs_c privatelibs_cxx
 
-  privatelibs_c: \
-  % for lib in libs:
-  % if lib.build == 'private' and lib.language == 'c' and not lib.get('external_deps', None):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
+privatelibs_c: \
+% for lib in libs:
+% if lib.build == 'private' and lib.language == 'c' and not lib.get('external_deps', None):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
 
-  pc_gpr: $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc
+pc_gpr: $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc
 
-  pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc
+pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc
 
-  pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc
+pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc
 
-  ifeq ($(HAS_ZOOKEEPER),true)
-  pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc
-  else
-  pc_c_zookeeper:
-  endif
+ifeq ($(HAS_ZOOKEEPER),true)
+pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc
+else
+pc_c_zookeeper:
+endif
 
-  pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc
+pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc
 
-  pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
+pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
 
-  privatelibs_cxx: \
-  % for lib in libs:
-  % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
+privatelibs_cxx: \
+% for lib in libs:
+% if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
 
 
-  ifeq ($(HAS_ZOOKEEPER),true)
-  privatelibs_zookeeper: \
-  % for lib in libs:
-  % if lib.build == 'private' and lib.language == 'c++' and zookeeper in lib.get('external_deps', []):
-   $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
-  % endif
-  % endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+privatelibs_zookeeper: \
+% for lib in libs:
+% if lib.build == 'private' and lib.language == 'c++' and zookeeper in lib.get('external_deps', []):
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+% endif
+% endfor
 
-  else
-  privatelibs_zookeeper:
-  endif
+else
+privatelibs_zookeeper:
+endif
 
 
-  buildtests: buildtests_c buildtests_cxx buildtests_zookeeper
+buildtests: buildtests_c buildtests_cxx buildtests_zookeeper
 
-  buildtests_c: privatelibs_c\
-  % for tgt in targets:
-  % if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None):
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+buildtests_c: privatelibs_c\
+% for tgt in targets:
+% if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None):
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
 
-  buildtests_cxx: buildtests_zookeeper privatelibs_cxx\
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None):
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+buildtests_cxx: buildtests_zookeeper privatelibs_cxx\
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None):
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
 
-  ifeq ($(HAS_ZOOKEEPER),true)
-  buildtests_zookeeper: privatelibs_zookeeper\
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []):
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+buildtests_zookeeper: privatelibs_zookeeper\
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []):
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
-  else
-  buildtests_zookeeper:
-  endif
+else
+buildtests_zookeeper:
+endif
 
 
-  test: test_c test_cxx test_zookeeper
+test: test_c test_cxx test_zookeeper
 
-  flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper
+flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper
 
-  test_c: buildtests_c
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+test_c: buildtests_c
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
 
-  flaky_test_c: buildtests_c
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+flaky_test_c: buildtests_c
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
 
-  test_cxx: test_zookeeper buildtests_cxx
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+test_cxx: test_zookeeper buildtests_cxx
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
 
-  flaky_test_cxx: buildtests_cxx
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+flaky_test_cxx: buildtests_cxx
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
 
-  ifeq ($(HAS_ZOOKEEPER),true)
-  test_zookeeper: buildtests_zookeeper
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+test_zookeeper: buildtests_zookeeper
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
 
-  flaky_test_zookeeper: buildtests_zookeeper
-  % for tgt in targets:
-  % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []):
-  	$(E) "[RUN]     Testing ${tgt.name}"
-  	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
-  % endif
-  % endfor
+flaky_test_zookeeper: buildtests_zookeeper
+% for tgt in targets:
+% if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []):
+	$(E) "[RUN]     Testing ${tgt.name}"
+	$(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 )
+% endif
+% endfor
 
-  else
-  test_zookeeper:
-  flaky_test_zookeeper:
-  endif
+else
+test_zookeeper:
+flaky_test_zookeeper:
+endif
 
 
-  test_python: static_c
-  	$(E) "[RUN]     Testing python code"
-  	$(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG)
+test_python: static_c
+	$(E) "[RUN]     Testing python code"
+	$(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG)
 
 
-  tools: tools_c tools_cxx
+tools: tools_c tools_cxx
 
 
-  tools_c: privatelibs_c\
-  % for tgt in targets:
-  % if tgt.build == 'tool' and not tgt.language=='c++':
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+tools_c: privatelibs_c\
+% for tgt in targets:
+% if tgt.build == 'tool' and not tgt.language=='c++':
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
 
-  tools_cxx: privatelibs_cxx\
-  % for tgt in targets:
-  % if tgt.build == 'tool' and tgt.language=='c++':
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+tools_cxx: privatelibs_cxx\
+% for tgt in targets:
+% if tgt.build == 'tool' and tgt.language=='c++':
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
 
-  buildbenchmarks: privatelibs\
-  % for tgt in targets:
-  % if tgt.build == 'benchmark':
-   $(BINDIR)/$(CONFIG)/${tgt.name}\
-  % endif
-  % endfor
+buildbenchmarks: privatelibs\
+% for tgt in targets:
+% if tgt.build == 'benchmark':
+ $(BINDIR)/$(CONFIG)/${tgt.name}\
+% endif
+% endfor
 
 
-  benchmarks: buildbenchmarks
+benchmarks: buildbenchmarks
 
-  strip: strip-static strip-shared
+strip: strip-static strip-shared
 
-  strip-static: strip-static_c strip-static_cxx
+strip-static: strip-static_c strip-static_cxx
 
-  strip-shared: strip-shared_c strip-shared_cxx
+strip-shared: strip-shared_c strip-shared_cxx
 
 
-  # TODO(nnoble): the strip target is stripping in-place, instead
-  # of copying files in a temporary folder.
-  # This prevents proper debugging after running make install.
+# TODO(nnoble): the strip target is stripping in-place, instead
+# of copying files in a temporary folder.
+# This prevents proper debugging after running make install.
 
-  strip-static_c: static_c
-  ifeq ($(CONFIG),opt)
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if not lib.get('external_deps', None):
-  	$(E) "[STRIP]   Stripping lib${lib.name}.a"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
-  % endif
-  % endif
-  % endif
-  % endfor
-  ifeq ($(HAS_ZOOKEEPER),true)
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if 'zookeeper' in lib.get('external_deps', []):
-  	$(E) "[STRIP]   Stripping lib${lib.name}.a"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
-  % endif
-  % endif
-  % endif
-  % endfor
-  endif
-  endif
+strip-static_c: static_c
+ifeq ($(CONFIG),opt)
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if not lib.get('external_deps', None):
+	$(E) "[STRIP]   Stripping lib${lib.name}.a"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
+% endif
+% endif
+% endif
+% endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if 'zookeeper' in lib.get('external_deps', []):
+	$(E) "[STRIP]   Stripping lib${lib.name}.a"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
+% endif
+% endif
+% endif
+% endfor
+endif
+endif
 
-  strip-static_cxx: static_cxx
-  ifeq ($(CONFIG),opt)
-  % for lib in libs:
-  % if lib.language == "c++":
-  % if lib.build == "all":
-  	$(E) "[STRIP]   Stripping lib${lib.name}.a"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
-  % endif
-  % endif
-  % endfor
-  endif
+strip-static_cxx: static_cxx
+ifeq ($(CONFIG),opt)
+% for lib in libs:
+% if lib.language == "c++":
+% if lib.build == "all":
+	$(E) "[STRIP]   Stripping lib${lib.name}.a"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
+% endif
+% endif
+% endfor
+endif
 
-  strip-shared_c: shared_c
-  ifeq ($(CONFIG),opt)
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if not lib.get('external_deps', None):
-  	$(E) "[STRIP]   Stripping lib${lib.name}.so"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
-  % endif
-  % endif
-  % endif
-  % endfor
-  ifeq ($(HAS_ZOOKEEPER),true)
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if 'zookeeper' in lib.get('external_deps', []):
-  	$(E) "[STRIP]   Stripping lib${lib.name}.so"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
-  % endif
-  % endif
-  % endif
-  % endfor
-  endif
-  endif
+strip-shared_c: shared_c
+ifeq ($(CONFIG),opt)
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if not lib.get('external_deps', None):
+	$(E) "[STRIP]   Stripping lib${lib.name}.so"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
+% endif
+% endif
+% endif
+% endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if 'zookeeper' in lib.get('external_deps', []):
+	$(E) "[STRIP]   Stripping lib${lib.name}.so"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
+% endif
+% endif
+% endif
+% endfor
+endif
+endif
 
-  strip-shared_cxx: shared_cxx
-  ifeq ($(CONFIG),opt)
-  % for lib in libs:
-  % if lib.language == "c++":
-  % if lib.build == "all":
-  	$(E) "[STRIP]   Stripping lib${lib.name}.so"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
-  % endif
-  % endif
-  % endfor
-  endif
+strip-shared_cxx: shared_cxx
+ifeq ($(CONFIG),opt)
+% for lib in libs:
+% if lib.language == "c++":
+% if lib.build == "all":
+	$(E) "[STRIP]   Stripping lib${lib.name}.so"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
+% endif
+% endif
+% endfor
+endif
 
-  strip-shared_csharp: shared_csharp
-  ifeq ($(CONFIG),opt)
-  % for lib in libs:
-  % if lib.language == "csharp":
-  % if lib.build == "all":
-  	$(E) "[STRIP]   Stripping lib${lib.name}.so"
-  	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
-  % endif
-  % endif
-  % endfor
-  endif
+strip-shared_csharp: shared_csharp
+ifeq ($(CONFIG),opt)
+% for lib in libs:
+% if lib.language == "csharp":
+% if lib.build == "all":
+	$(E) "[STRIP]   Stripping lib${lib.name}.so"
+	$(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
+% endif
+% endif
+% endfor
+endif
 
-  cache.mk::
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) echo "$(CACHE_MK)" | tr , '\n' >$@
+cache.mk::
+	$(E) "[MAKE]    Generating $@"
+	$(Q) echo "$(CACHE_MK)" | tr , '\n' >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo "$(GPR_PC_FILE)" | tr , '\n' >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo "$(GPR_PC_FILE)" | tr , '\n' >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo "$(GRPC_PC_FILE)" | tr , '\n' >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo "$(GRPC_PC_FILE)" | tr , '\n' >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo "$(GRPCXX_PC_FILE)" | tr , '\n' >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo "$(GRPCXX_PC_FILE)" | tr , '\n' >$@
 
-  $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc:
-  	$(E) "[MAKE]    Generating $@"
-  	$(Q) mkdir -p $(@D)
-  	$(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@
+$(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc:
+	$(E) "[MAKE]    Generating $@"
+	$(Q) mkdir -p $(@D)
+	$(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@
 
-  % for p in protos:
-  ifeq ($(NO_PROTOC),true)
-  $(GENDIR)/${p}.pb.cc: protoc_dep_error
-  $(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error
-  else
-  $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
-  	$(E) "[PROTOC]  Generating protobuf CC file from $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(PROTOC) --cpp_out=$(GENDIR) $<
+% for p in protos:
+ifeq ($(NO_PROTOC),true)
+$(GENDIR)/${p}.pb.cc: protoc_dep_error
+$(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error
+else
+$(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
+	$(E) "[PROTOC]  Generating protobuf CC file from $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(PROTOC) --cpp_out=$(GENDIR) $<
 
-  $(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
-  	$(E) "[GRPC]    Generating gRPC's protobuf service CC file from $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $<
-  endif
+$(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
+	$(E) "[GRPC]    Generating gRPC's protobuf service CC file from $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $<
+endif
 
-  % endfor
+% endfor
 
-  ifeq ($(CONFIG),stapprof)
-  src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h
-  ifeq ($(HAS_SYSTEMTAP),true)
-  $(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d
-  	$(E) "[DTRACE]  Compiling $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(DTRACE) -C -h -s $< -o $@
-  else
-  $(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop
-  endif
-  endif
+ifeq ($(CONFIG),stapprof)
+src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h
+ifeq ($(HAS_SYSTEMTAP),true)
+$(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d
+	$(E) "[DTRACE]  Compiling $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(DTRACE) -C -h -s $< -o $@
+else
+$(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop
+endif
+endif
 
-  $(OBJDIR)/$(CONFIG)/%.o : %.c
-  	$(E) "[C]       Compiling $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
+$(OBJDIR)/$(CONFIG)/%.o : %.c
+	$(E) "[C]       Compiling $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 
-  $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc
-  	$(E) "[CXX]     Compiling $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
+$(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc
+	$(E) "[CXX]     Compiling $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 
-  $(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc
-  	$(E) "[HOSTCXX] Compiling $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
+$(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc
+	$(E) "[HOSTCXX] Compiling $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 
-  $(OBJDIR)/$(CONFIG)/%.o : %.cc
-  	$(E) "[CXX]     Compiling $<"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
+$(OBJDIR)/$(CONFIG)/%.o : %.cc
+	$(E) "[CXX]     Compiling $<"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
 
-  install: install_c install_cxx install-plugins install-certs verify-install
+install: install_c install_cxx install-plugins install-certs verify-install
 
-  install_c: install-headers_c install-static_c install-shared_c
+install_c: install-headers_c install-static_c install-shared_c
 
-  install_cxx: install-headers_cxx install-static_cxx install-shared_cxx
+install_cxx: install-headers_cxx install-static_cxx install-shared_cxx
 
-  install_csharp: install-shared_csharp install_c
+install_csharp: install-shared_csharp install_c
 
-  install_grpc_csharp_ext: install_csharp
+install_grpc_csharp_ext: install_csharp
 
-  install-headers: install-headers_c install-headers_cxx
+install-headers: install-headers_c install-headers_cxx
 
-  install-headers_c:
-  	$(E) "[INSTALL] Installing public C headers"
-  	$(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1
-  	$(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1
+install-headers_c:
+	$(E) "[INSTALL] Installing public C headers"
+	$(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1
+	$(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1
 
-  install-headers_cxx:
-  	$(E) "[INSTALL] Installing public C++ headers"
-  	$(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1
-  	$(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1
+install-headers_cxx:
+	$(E) "[INSTALL] Installing public C++ headers"
+	$(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1
+	$(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1
 
-  install-static: install-static_c install-static_cxx
+install-static: install-static_c install-static_cxx
 
-  install-static_c: static_c strip-static_c install-pkg-config_c
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if not lib.get('external_deps', None):
-  	$(E) "[INSTALL] Installing lib${lib.name}.a"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
-  % endif
-  % endif
-  % endif
-  % endfor
-  ifeq ($(HAS_ZOOKEEPER),true)
-  % for lib in libs:
-  % if lib.language == "c":
-  % if lib.build == "all":
-  % if 'zookeeper' in lib.get('external_deps', []):
-  	$(E) "[INSTALL] Installing lib${lib.name}.a"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
-  % endif
-  % endif
-  % endif
-  % endfor
-  endif
+install-static_c: static_c strip-static_c install-pkg-config_c
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if not lib.get('external_deps', None):
+	$(E) "[INSTALL] Installing lib${lib.name}.a"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
+% endif
+% endif
+% endif
+% endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+% for lib in libs:
+% if lib.language == "c":
+% if lib.build == "all":
+% if 'zookeeper' in lib.get('external_deps', []):
+	$(E) "[INSTALL] Installing lib${lib.name}.a"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
+% endif
+% endif
+% endif
+% endfor
+endif
 
-  install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx
-  % for lib in libs:
-  % if lib.language == "c++":
-  % if lib.build == "all":
-  	$(E) "[INSTALL] Installing lib${lib.name}.a"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
-  % endif
-  % endif
-  % endfor
+install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx
+% for lib in libs:
+% if lib.language == "c++":
+% if lib.build == "all":
+	$(E) "[INSTALL] Installing lib${lib.name}.a"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a
+% endif
+% endif
+% endfor
 
-  <%def name="install_shared(lang_filter)">\
-  % for lib in libs:
-  % if lib.language == lang_filter:
-  % if lib.build == "all":
-  % if not lib.get('external_deps', None):
-  ifeq ($(SYSTEM),MINGW32)
-  	$(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT)
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a
-  else
-  	$(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT)
-  ifneq ($(SYSTEM),Darwin)
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major}
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so
-  endif
-  endif
-  % endif
-  % endif
-  % endif
-  % endfor
-  ifeq ($(HAS_ZOOKEEPER),true)
-  % for lib in libs:
-  % if lib.language == lang_filter:
-  % if lib.build == "all":
-  % if 'zookeeper' in lib.get('external_deps', []):
-  ifeq ($(SYSTEM),MINGW32)
-  	$(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT)
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a
-  else
-  	$(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)"
-  	$(Q) $(INSTALL) -d $(prefix)/lib
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT)
-  ifneq ($(SYSTEM),Darwin)
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major}
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so
-  endif
-  endif
-  % endif
-  % endif
-  % endif
-  % endfor
-  endif
-  ifneq ($(SYSTEM),MINGW32)
-  ifneq ($(SYSTEM),Darwin)
-  	$(Q) ldconfig || true
-  endif
-  endif
-  </%def>
+<%def name="install_shared(lang_filter)">\
+% for lib in libs:
+% if lib.language == lang_filter:
+% if lib.build == "all":
+% if not lib.get('external_deps', None):
+ifeq ($(SYSTEM),MINGW32)
+	$(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT)
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a
+else
+	$(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT)
+ifneq ($(SYSTEM),Darwin)
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major}
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so
+endif
+endif
+% endif
+% endif
+% endif
+% endfor
+ifeq ($(HAS_ZOOKEEPER),true)
+% for lib in libs:
+% if lib.language == lang_filter:
+% if lib.build == "all":
+% if 'zookeeper' in lib.get('external_deps', []):
+ifeq ($(SYSTEM),MINGW32)
+	$(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT)
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a
+else
+	$(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)"
+	$(Q) $(INSTALL) -d $(prefix)/lib
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT)
+ifneq ($(SYSTEM),Darwin)
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major}
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so
+endif
+endif
+% endif
+% endif
+% endif
+% endfor
+endif
+ifneq ($(SYSTEM),MINGW32)
+ifneq ($(SYSTEM),Darwin)
+	$(Q) ldconfig || true
+endif
+endif
+</%def>
 
-  install-shared_c: shared_c strip-shared_c install-pkg-config_c
-  ${install_shared("c")}
+install-shared_c: shared_c strip-shared_c install-pkg-config_c
+${install_shared("c")}
 
-  install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx
-  ${install_shared("c++")}
+install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx
+${install_shared("c++")}
 
-  install-shared_csharp: shared_csharp strip-shared_csharp
-  ${install_shared("csharp")}
+install-shared_csharp: shared_csharp strip-shared_csharp
+${install_shared("csharp")}
 
-  install-plugins: $(PROTOC_PLUGINS)
-  ifeq ($(SYSTEM),MINGW32)
-  	$(Q) false
-  else
-  	$(E) "[INSTALL] Installing grpc protoc plugins"
-  % for tgt in targets:
-  % if tgt.build == 'protoc':
-  	$(Q) $(INSTALL) -d $(prefix)/bin
-  	$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name}
-  % endif
-  % endfor
-  endif
+install-plugins: $(PROTOC_PLUGINS)
+ifeq ($(SYSTEM),MINGW32)
+	$(Q) false
+else
+	$(E) "[INSTALL] Installing grpc protoc plugins"
+% for tgt in targets:
+% if tgt.build == 'protoc':
+	$(Q) $(INSTALL) -d $(prefix)/bin
+	$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name}
+% endif
+% endfor
+endif
 
-  install-pkg-config_c: pc_gpr pc_c pc_c_unsecure pc_c_zookeeper
-  	$(E) "[INSTALL] Installing C pkg-config files"
-  	$(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc
-  ifeq ($(HAS_ZOOKEEPER),true)
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc
-  endif
+install-pkg-config_c: pc_gpr pc_c pc_c_unsecure pc_c_zookeeper
+	$(E) "[INSTALL] Installing C pkg-config files"
+	$(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc
+ifeq ($(HAS_ZOOKEEPER),true)
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc
+endif
 
-  install-pkg-config_cxx: pc_cxx pc_cxx_unsecure
-  	$(E) "[INSTALL] Installing C++ pkg-config files"
-  	$(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc
-  	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc
+install-pkg-config_cxx: pc_cxx pc_cxx_unsecure
+	$(E) "[INSTALL] Installing C++ pkg-config files"
+	$(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc
+	$(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc
 
-  install-certs: etc/roots.pem
-  	$(E) "[INSTALL] Installing root certificates"
-  	$(Q) $(INSTALL) -d $(prefix)/share/grpc
-  	$(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem
+install-certs: etc/roots.pem
+	$(E) "[INSTALL] Installing root certificates"
+	$(Q) $(INSTALL) -d $(prefix)/share/grpc
+	$(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem
 
-  verify-install:
-  ifeq ($(INSTALL_OK),true)
-  	@echo "Your system looks ready to go."
-  	@echo
-  else
-  	@echo "We couldn't find protoc 3.0.0+ installed on your system. While this"
-  	@echo "won't prevent grpc from working, you won't be able to compile"
-  	@echo "and run any meaningful code with it."
-  	@echo
-  	@echo
-  	@echo "Please download and install protobuf 3.0.0+ from:"
-  	@echo
-  	@echo "   https://github.com/google/protobuf/releases"
-  	@echo
-  	@echo "Once you've done so, or if you think this message is in error,"
-  	@echo "you can re-run this check by doing:"
-  	@echo
-  	@echo "   make verify-install"
-  endif
+verify-install:
+ifeq ($(INSTALL_OK),true)
+	@echo "Your system looks ready to go."
+	@echo
+else
+	@echo "We couldn't find protoc 3.0.0+ installed on your system. While this"
+	@echo "won't prevent grpc from working, you won't be able to compile"
+	@echo "and run any meaningful code with it."
+	@echo
+	@echo
+	@echo "Please download and install protobuf 3.0.0+ from:"
+	@echo
+	@echo "   https://github.com/google/protobuf/releases"
+	@echo
+	@echo "Once you've done so, or if you think this message is in error,"
+	@echo "you can re-run this check by doing:"
+	@echo
+	@echo "   make verify-install"
+endif
 
-  clean:
-  	$(E) "[CLEAN]   Cleaning build directories."
-  	$(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk
+clean:
+	$(E) "[CLEAN]   Cleaning build directories."
+	$(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk
 
 
-  # The various libraries
+# The various libraries
 
-  % for lib in libs:
-  ${makelib(lib)}
-  % endfor
+% for lib in libs:
+${makelib(lib)}
+% endfor
 
 
-  # All of the test targets, and protoc plugins
+# All of the test targets, and protoc plugins
 
-  % for tgt in targets:
-  ${maketarget(tgt)}
-  % endfor
+% for tgt in targets:
+${maketarget(tgt)}
+% endfor
 
-  <%def name="makelib(lib)">
-  LIB${lib.name.upper()}_SRC = \\
+<%def name="makelib(lib)">
+LIB${lib.name.upper()}_SRC = \\
 
-  % for src in lib.src:
-      ${proto_to_cc(src)} \\
+% for src in lib.src:
+    ${proto_to_cc(src)} \\
 
-  % endfor
+% endfor
 
-  % if "public_headers" in lib:
-  % if lib.language == "c++":
-  PUBLIC_HEADERS_CXX += \\
+% if "public_headers" in lib:
+% if lib.language == "c++":
+PUBLIC_HEADERS_CXX += \\
 
-  % else:
-  PUBLIC_HEADERS_C += \\
+% else:
+PUBLIC_HEADERS_C += \\
 
-  % endif
-  % for hdr in lib.public_headers:
-      ${hdr} \\
+% endif
+% for hdr in lib.public_headers:
+    ${hdr} \\
 
-  % endfor
-  % endif
+% endfor
+% endif
 
-  LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
+LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
 
-  ## If the library requires OpenSSL, let's add some restrictions.
-  % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check':
-  ifeq ($(NO_SECURE),true)
+## If the library requires OpenSSL, let's add some restrictions.
+% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
+ifeq ($(NO_SECURE),true)
 
-  # You can't build secure libraries if you don't have OpenSSL.
+# You can't build secure libraries if you don't have OpenSSL.
 
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error
 
-  % if lib.build == "all":
-  ifeq ($(SYSTEM),MINGW32)
-  $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error
-  else
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error
-  endif
-  % endif
+% if lib.build == "all":
+ifeq ($(SYSTEM),MINGW32)
+$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error
+else
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error
+endif
+% endif
 
-  else
+else
 
-  % if lib.language == 'c++':
-  ifeq ($(NO_PROTOBUF),true)
+% if lib.language == 'c++':
+ifeq ($(NO_PROTOBUF),true)
 
-  # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
+# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
 
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error
 
-  % if lib.build == "all":
-  ifeq ($(SYSTEM),MINGW32)
-  $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error
-  else
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error
-  endif
-  % endif
+% if lib.build == "all":
+ifeq ($(SYSTEM),MINGW32)
+$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error
+else
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error
+endif
+% endif
 
-  else
-  % endif
+else
+% endif
 
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\
-  ## The else here corresponds to the if secure earlier.
-  % else:
-  % if lib.language == 'c++':
-  ifeq ($(NO_PROTOBUF),true)
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\
+## The else here corresponds to the if secure earlier.
+% else:
+% if lib.language == 'c++':
+ifeq ($(NO_PROTOBUF),true)
 
-  # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
+# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay.
 
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error
 
-  % if lib.build == "all":
-  ifeq ($(SYSTEM),MINGW32)
-  $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error
-  else
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error
-  endif
-  % endif
+% if lib.build == "all":
+ifeq ($(SYSTEM),MINGW32)
+$(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error
+else
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error
+endif
+% endif
 
-  else
+else
 
-  % endif
-  $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\
-  % endif
-  % if lib.language == 'c++':
-   $(PROTOBUF_DEP)\
-  % endif
-   $(LIB${lib.name.upper()}_OBJS)
-  	$(E) "[AR]      Creating $@"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
-  	$(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS)
-  % if lib.get('baselib', False):
-  % if lib.get('secure', 'check') == True:
-  	$(Q) rm -rf tmp-merge-${lib.name}
-  	$(Q) mkdir tmp-merge-${lib.name}
-  	$(Q) ( cd tmp-merge-${lib.name} ; $(AR) x ../$(LIBDIR)/$(CONFIG)/lib${lib.name}.a )
-  	$(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge-${lib.name} ; <%text>ar x ../$${l}</%text> ) ; done
-  	$(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/__.SYMDEF*
-  	$(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/*
-  	$(Q) rm -rf tmp-merge-${lib.name}
-  % endif
-  % endif
-  ifeq ($(SYSTEM),Darwin)
-  	$(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
-  endif
+% endif
+$(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\
+% endif
+% if lib.language == 'c++':
+ $(PROTOBUF_DEP)\
+% endif
+ $(LIB${lib.name.upper()}_OBJS)
+	$(E) "[AR]      Creating $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
+	$(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS)
+% if lib.get('baselib', False):
+% if lib.get('secure', 'check') == 'yes':
+	$(Q) rm -rf tmp-merge-${lib.name}
+	$(Q) mkdir tmp-merge-${lib.name}
+	$(Q) ( cd tmp-merge-${lib.name} ; $(AR) x ../$(LIBDIR)/$(CONFIG)/lib${lib.name}.a )
+	$(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge-${lib.name} ; <%text>ar x ../$${l}</%text> ) ; done
+	$(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/__.SYMDEF*
+	$(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/*
+	$(Q) rm -rf tmp-merge-${lib.name}
+% endif
+% endif
+ifeq ($(SYSTEM),Darwin)
+	$(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
+endif
 
-  <%
+<%
 
-    if lib.language == 'c++':
-      ld = '$(LDXX)'
-    else:
-      ld = '$(LD)'
+  if lib.language == 'c++':
+    ld = '$(LDXX)'
+  else:
+    ld = '$(LD)'
 
-    out_base = '$(LIBDIR)/$(CONFIG)/' + lib.name
-    out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name
+  out_base = '$(LIBDIR)/$(CONFIG)/' + lib.name
+  out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name
 
-    common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)'
+  common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)'
 
-    libs = ''
-    lib_deps = ' $(ZLIB_DEP)'
-    mingw_libs = ''
-    mingw_lib_deps = ' $(ZLIB_DEP)'
-    if lib.language == 'c++':
-      lib_deps += ' $(PROTOBUF_DEP)'
-      mingw_lib_deps += ' $(PROTOBUF_DEP)'
-    for dep in lib.get('deps', []):
-      libs = libs + ' -l' + dep
-      lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)'
-      mingw_libs = mingw_libs + ' -l' + dep + '-imp'
-      mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT)'
+  libs = ''
+  lib_deps = ' $(ZLIB_DEP)'
+  mingw_libs = ''
+  mingw_lib_deps = ' $(ZLIB_DEP)'
+  if lib.language == 'c++':
+    lib_deps += ' $(PROTOBUF_DEP)'
+    mingw_lib_deps += ' $(PROTOBUF_DEP)'
+  for dep in lib.get('deps', []):
+    libs = libs + ' -l' + dep
+    lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)'
+    mingw_libs = mingw_libs + ' -l' + dep + '-imp'
+    mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT)'
 
-    security = lib.get('secure', 'check')
-    if security == True:
-      common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)'
+  security = lib.get('secure', 'check')
+  if security == 'yes':
+    common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)'
 
-    if security in [True, 'check']:
-      for src in lib.src:
-        if not proto_re.match(src):
-          sources_that_need_openssl.add(src)
-    else:
-      for src in lib.src:
-        sources_that_don_t_need_openssl.add(src)
+  if security in ['yes', 'check']:
+    for src in lib.src:
+      if not proto_re.match(src):
+        sources_that_need_openssl.add(src)
+  else:
+    for src in lib.src:
+      sources_that_don_t_need_openssl.add(src)
 
-    if 'zookeeper' in lib.get('external_deps', []):
-      libs = libs + ' -lzookeeper_mt'
+  if 'zookeeper' in lib.get('external_deps', []):
+    libs = libs + ' -lzookeeper_mt'
 
-    if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check':
-      lib_deps = lib_deps + ' $(OPENSSL_DEP)'
-      mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
+  if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
+    lib_deps = lib_deps + ' $(OPENSSL_DEP)'
+    mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
 
-    if lib.language == 'c++':
-      common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)'
-  %>
+  if lib.language == 'c++':
+    common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)'
+%>
 
-  % if lib.build == "all":
-  ifeq ($(SYSTEM),MINGW32)
-  ${out_base}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps}
-  	$(E) "[LD]      Linking $@"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_base}.def -Wl,--out-implib=${out_libbase}-imp.a -o ${out_base}.$(SHARED_EXT) ${common}${mingw_libs}
-  else
-  ${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps}
-  	$(E) "[LD]      Linking $@"
-  	$(Q) mkdir -p `dirname $@`
-  ifeq ($(SYSTEM),Darwin)
-  	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name lib${lib.name}.$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs}
-  else
-  	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs}
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so.${settings.version.major}
-  	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so
-  endif
-  endif
-  % endif
-  % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check':
-  ## If the lib was secure, we have to close the Makefile's if that tested
-  ## the presence of OpenSSL.
+% if lib.build == "all":
+ifeq ($(SYSTEM),MINGW32)
+${out_base}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps}
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_base}.def -Wl,--out-implib=${out_libbase}-imp.a -o ${out_base}.$(SHARED_EXT) ${common}${mingw_libs}
+else
+${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps}
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+ifeq ($(SYSTEM),Darwin)
+	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name lib${lib.name}.$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs}
+else
+	$(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs}
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so.${settings.version.major}
+	$(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so
+endif
+endif
+% endif
+% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
+## If the lib was secure, we have to close the Makefile's if that tested
+## the presence of OpenSSL.
 
-  endif
-  % endif
-  % if lib.language == 'c++':
-  ## If the lib was C++, we have to close the Makefile's if that tested
-  ## the presence of protobuf 3.0.0+
+endif
+% endif
+% if lib.language == 'c++':
+## If the lib was C++, we have to close the Makefile's if that tested
+## the presence of protobuf 3.0.0+
 
-  endif
-  % endif
+endif
+% endif
 
-  % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check':
-  ifneq ($(NO_SECURE),true)
-  % endif
-  ifneq ($(NO_DEPS),true)
-  -include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
-  endif
-  % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check':
-  endif
-  % endif
-  % for src in lib.src:
-  % if not proto_re.match(src) and any(proto_re.match(src2) for src2 in lib.src):
-  $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in lib.src if proto_re.match(src2))}
-  % endif
-  % endfor
-  </%def>
+% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
+ifneq ($(NO_SECURE),true)
+% endif
+ifneq ($(NO_DEPS),true)
+-include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
+endif
+% if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check':
+endif
+% endif
+% for src in lib.src:
+% if not proto_re.match(src) and any(proto_re.match(src2) for src2 in lib.src):
+$(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in lib.src if proto_re.match(src2))}
+% endif
+% endfor
+</%def>
 
-  <%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %>
-  % if not has_no_sources:
-  ${tgt.name.upper()}_SRC = \\
+<%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %>
+% if not has_no_sources:
+${tgt.name.upper()}_SRC = \\
 
-  % for src in tgt.src:
-      ${proto_to_cc(src)} \\
+% for src in tgt.src:
+    ${proto_to_cc(src)} \\
 
-  % endfor
+% endfor
 
-  ${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC))))
-  % endif
-  % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check':
-  ifeq ($(NO_SECURE),true)
+${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC))))
+% endif
+% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
+ifeq ($(NO_SECURE),true)
 
-  # You can't build secure targets if you don't have OpenSSL.
+# You can't build secure targets if you don't have OpenSSL.
 
-  $(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error
+$(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error
 
-  else
+else
 
-  % endif
-  ##
-  ## We're not trying to add a dependency on building zlib and openssl here,
-  ## as it's already done in the libraries. We're assuming that the build
-  ## trickles down, and that a secure target requires a secure version of
-  ## a library.
-  ##
-  ## That simplifies the codegen a bit, but prevents a fully defined Makefile.
-  ## I can live with that.
-  ##
-  % if tgt.build == 'protoc' or tgt.language == 'c++':
+% endif
+##
+## We're not trying to add a dependency on building zlib and openssl here,
+## as it's already done in the libraries. We're assuming that the build
+## trickles down, and that a secure target requires a secure version of
+## a library.
+##
+## That simplifies the codegen a bit, but prevents a fully defined Makefile.
+## I can live with that.
+##
+% if tgt.build == 'protoc' or tgt.language == 'c++':
 
-  ifeq ($(NO_PROTOBUF),true)
+ifeq ($(NO_PROTOBUF),true)
 
-  # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
+# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
 
-  $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error
+$(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error
 
-  else
+else
 
-  $(BINDIR)/$(CONFIG)/${tgt.name}: \
-  % if not has_no_sources:
-  $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\
-  % endif
-  % else:
-  $(BINDIR)/$(CONFIG)/${tgt.name}: \
-  % if not has_no_sources:
-  $(${tgt.name.upper()}_OBJS)\
-  % endif
-  % endif
-  % for dep in tgt.deps:
-   $(LIBDIR)/$(CONFIG)/lib${dep}.a\
-  % endfor
+$(BINDIR)/$(CONFIG)/${tgt.name}: \
+% if not has_no_sources:
+$(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\
+% endif
+% else:
+$(BINDIR)/$(CONFIG)/${tgt.name}: \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
+% endif
+% for dep in tgt.deps:
+ $(LIBDIR)/$(CONFIG)/lib${dep}.a\
+% endfor
 
-  % if tgt.language == "c++":
-  ## C++ targets specificies.
-  % if tgt.build == 'protoc':
-  	$(E) "[HOSTLD]  Linking $@"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \
-  % if not has_no_sources:
-  $(${tgt.name.upper()}_OBJS)\
-  % endif
-  % else:
-  	$(E) "[LD]      Linking $@"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(LDXX) $(LDFLAGS) \
-  % if not has_no_sources:
-  $(${tgt.name.upper()}_OBJS)\
-  % endif
-  % endif
-  % else:
-  ## C-only targets specificities.
-  	$(E) "[LD]      Linking $@"
-  	$(Q) mkdir -p `dirname $@`
-  	$(Q) $(LD) $(LDFLAGS) \
-  % if not has_no_sources:
-  $(${tgt.name.upper()}_OBJS)\
-  % endif
-  % endif
-  % for dep in tgt.deps:
-   $(LIBDIR)/$(CONFIG)/lib${dep}.a\
-  % endfor
-  % if 'zookeeper' in tgt.get('external_deps', []):
-   -lzookeeper_mt\
-  % endif
-  % if tgt.language == "c++":
-  % if tgt.build == 'protoc':
-   $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\
-  % else:
-   $(LDLIBSXX) $(LDLIBS_PROTOBUF)\
-  % endif
-  % endif
-  % if tgt.build == 'protoc':
-   $(HOST_LDLIBS)\
-  % else:
-   $(LDLIBS)\
-  % endif
-  % if tgt.build == 'protoc':
-   $(HOST_LDLIBS_PROTOC)\
-  % elif tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check':
-   $(LDLIBS_SECURE)\
-  % endif
-  % if tgt.language == 'c++' and tgt.build == 'test':
-   $(GTEST_LIB)\
-  % elif tgt.language == 'c++' and tgt.build == 'benchmark':
-   $(GTEST_LIB)\
-  % endif
-   -o $(BINDIR)/$(CONFIG)/${tgt.name}
-  % if tgt.build == 'protoc' or tgt.language == 'c++':
+% if tgt.language == "c++":
+## C++ targets specificies.
+% if tgt.build == 'protoc':
+	$(E) "[HOSTLD]  Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
+% else:
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(LDXX) $(LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
+% endif
+% else:
+## C-only targets specificities.
+	$(E) "[LD]      Linking $@"
+	$(Q) mkdir -p `dirname $@`
+	$(Q) $(LD) $(LDFLAGS) \
+% if not has_no_sources:
+$(${tgt.name.upper()}_OBJS)\
+% endif
+% endif
+% for dep in tgt.deps:
+ $(LIBDIR)/$(CONFIG)/lib${dep}.a\
+% endfor
+% if 'zookeeper' in tgt.get('external_deps', []):
+ -lzookeeper_mt\
+% endif
+% if tgt.language == "c++":
+% if tgt.build == 'protoc':
+ $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\
+% else:
+ $(LDLIBSXX) $(LDLIBS_PROTOBUF)\
+% endif
+% endif
+% if tgt.build == 'protoc':
+ $(HOST_LDLIBS)\
+% else:
+ $(LDLIBS)\
+% endif
+% if tgt.build == 'protoc':
+ $(HOST_LDLIBS_PROTOC)\
+% elif tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
+ $(LDLIBS_SECURE)\
+% endif
+% if tgt.language == 'c++' and tgt.build == 'test':
+ $(GTEST_LIB)\
+% elif tgt.language == 'c++' and tgt.build == 'benchmark':
+ $(GTEST_LIB)\
+% endif
+ -o $(BINDIR)/$(CONFIG)/${tgt.name}
+% if tgt.build == 'protoc' or tgt.language == 'c++':
 
-  endif
-  % endif
-  % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check':
+endif
+% endif
+% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
 
-  endif
-  % endif
+endif
+% endif
 
-  % for src in tgt.src:
-  $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
-  % for dep in tgt.deps:
-   $(LIBDIR)/$(CONFIG)/lib${dep}.a\
-  % endfor
+% for src in tgt.src:
+$(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
+% for dep in tgt.deps:
+ $(LIBDIR)/$(CONFIG)/lib${dep}.a\
+% endfor
 
-  % endfor
-  % if not has_no_sources:
-  deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep)
-  % endif
+% endfor
+% if not has_no_sources:
+deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep)
+% endif
 
-  % if not has_no_sources:
-  % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check':
-  ifneq ($(NO_SECURE),true)
-  % endif
-  ifneq ($(NO_DEPS),true)
-  -include $(${tgt.name.upper()}_OBJS:.o=.dep)
-  endif
-  % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check':
-  endif
-  % endif
-  % endif
-  </%def>
+% if not has_no_sources:
+% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
+ifneq ($(NO_SECURE),true)
+% endif
+ifneq ($(NO_DEPS),true)
+-include $(${tgt.name.upper()}_OBJS:.o=.dep)
+endif
+% if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check':
+endif
+% endif
+% endif
+</%def>
 
-  ifneq ($(OPENSSL_DEP),)
-  # This is to ensure the embedded OpenSSL is built beforehand, properly
-  # installing headers to their final destination on the drive. We need this
-  # otherwise parallel compilation will fail if a source is compiled first.
-  % for src in sorted(sources_that_need_openssl):
-  % if src not in sources_that_don_t_need_openssl:
-  ${src}: $(OPENSSL_DEP)
-  % endif
-  % endfor
-  endif
+ifneq ($(OPENSSL_DEP),)
+# This is to ensure the embedded OpenSSL is built beforehand, properly
+# installing headers to their final destination on the drive. We need this
+# otherwise parallel compilation will fail if a source is compiled first.
+% for src in sorted(sources_that_need_openssl):
+% if src not in sources_that_don_t_need_openssl:
+${src}: $(OPENSSL_DEP)
+% endif
+% endfor
+endif
 
-  .PHONY: all strip tools \
-  dep_error openssl_dep_error openssl_dep_message git_update stop \
-  buildtests buildtests_c buildtests_cxx \
-  test test_c test_cxx \
-  install install_c install_cxx \
-  install-headers install-headers_c install-headers_cxx \
-  install-shared install-shared_c install-shared_cxx \
-  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 \
-  dep_c dep_cxx bins_dep_c bins_dep_cxx \
-  clean
+.PHONY: all strip tools \
+dep_error openssl_dep_error openssl_dep_message git_update stop \
+buildtests buildtests_c buildtests_cxx \
+test test_c test_cxx \
+install install_c install_cxx \
+install-headers install-headers_c install-headers_cxx \
+install-shared install-shared_c install-shared_cxx \
+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 \
+dep_c dep_cxx bins_dep_c bins_dep_cxx \
+clean
diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c
index 8f28fa1..93e2df1 100644
--- a/test/core/end2end/tests/bad_hostname.c
+++ b/test/core/end2end/tests/bad_hostname.c
@@ -146,7 +146,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c
index 2345f94..21e0bbc 100644
--- a/test/core/end2end/tests/binary_metadata.c
+++ b/test/core/end2end/tests/binary_metadata.c
@@ -191,7 +191,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -213,7 +213,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -237,7 +237,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c
index 75c5bba..4e905aa 100644
--- a/test/core/end2end/tests/call_creds.c
+++ b/test/core/end2end/tests/call_creds.c
@@ -247,7 +247,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -280,7 +280,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -304,7 +304,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
@@ -464,7 +464,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(error == GRPC_CALL_OK);
 
   cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index 313e0b0..10e6227 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -165,7 +165,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error = grpc_server_request_call(f.server, &s, &call_details,
@@ -195,7 +195,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c
index 2430a6d..4fed5be 100644
--- a/test/core/end2end/tests/cancel_after_client_done.c
+++ b/test/core/end2end/tests/cancel_after_client_done.c
@@ -169,7 +169,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error = grpc_server_request_call(f.server, &s, &call_details,
@@ -199,7 +199,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL));
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index 9991ee0..40595e4 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -101,7 +101,7 @@
 
 /* Cancel after invoke, no payload */
 static void test_cancel_after_invoke(grpc_end2end_test_config config,
-                                     cancellation_mode mode, int test_ops) {
+                                     cancellation_mode mode, size_t test_ops) {
   grpc_op ops[6];
   grpc_op *op;
   grpc_call *c;
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index 8b582e0..c049e0c 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -99,7 +99,7 @@
 
 /* Cancel before invoke */
 static void test_cancel_before_invoke(grpc_end2end_test_config config,
-                                      int test_ops) {
+                                      size_t test_ops) {
   grpc_op ops[6];
   grpc_op *op;
   grpc_call *c;
@@ -189,7 +189,7 @@
 }
 
 void grpc_end2end_tests(grpc_end2end_test_config config) {
-  int i;
+  size_t i;
   for (i = 1; i <= 6; i++) {
     test_cancel_before_invoke(config, i);
   }
diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c
index 36b9e92..adf855c 100644
--- a/test/core/end2end/tests/census_simple_request.c
+++ b/test/core/end2end/tests/census_simple_request.c
@@ -145,7 +145,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -173,7 +173,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c
index 299943c..c50eaba 100644
--- a/test/core/end2end/tests/compressed_payload.c
+++ b/test/core/end2end/tests/compressed_payload.c
@@ -186,7 +186,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -215,7 +215,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -234,7 +234,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c
index 57f65b8..7b62505 100644
--- a/test/core/end2end/tests/default_host.c
+++ b/test/core/end2end/tests/default_host.c
@@ -154,7 +154,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(error == GRPC_CALL_OK);
 
   error =
@@ -191,7 +191,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(error == GRPC_CALL_OK);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c
index 0976270..de3ea16 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.c
@@ -131,7 +131,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -163,7 +163,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c
index d4e7a1a..df420a9 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.c
+++ b/test/core/end2end/tests/graceful_server_shutdown.c
@@ -146,7 +146,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -178,7 +178,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c
index 0067bb4..44d6a60 100644
--- a/test/core/end2end/tests/high_initial_seqno.c
+++ b/test/core/end2end/tests/high_initial_seqno.c
@@ -149,7 +149,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -177,7 +177,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index 7677084..f79d146 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -171,7 +171,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -192,7 +192,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -216,7 +216,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c
index 98e47aa..8752963 100644
--- a/test/core/end2end/tests/large_metadata.c
+++ b/test/core/end2end/tests/large_metadata.c
@@ -121,7 +121,7 @@
   char *details = NULL;
   size_t details_capacity = 0;
   int was_cancelled = 2;
-  const int large_size = 64 * 1024;
+  const size_t large_size = 64 * 1024;
 
   c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
                                "/foo", "foo.test.google.fr", deadline, NULL);
@@ -167,7 +167,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -188,7 +188,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -207,7 +207,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 0ba620b..87eb4dd 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -147,7 +147,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -175,7 +175,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -280,7 +280,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c1, ops, op - ops, tag(301), NULL);
+  error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   op = ops;
@@ -297,7 +297,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c1, ops, op - ops, tag(302), NULL);
+  error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   op = ops;
@@ -310,7 +310,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c2, ops, op - ops, tag(401), NULL);
+  error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   op = ops;
@@ -327,7 +327,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c2, ops, op - ops, tag(402), NULL);
+  error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   got_client_start = 0;
@@ -372,7 +372,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s1, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -406,7 +406,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s2, ops, op - ops, tag(202), NULL);
+  error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(live_call + 2), 1);
diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c
index 2b95607..782b9d0 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.c
@@ -167,7 +167,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -183,7 +183,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/metadata.c b/test/core/end2end/tests/metadata.c
index a4cc278..d0604cc 100644
--- a/test/core/end2end/tests/metadata.c
+++ b/test/core/end2end/tests/metadata.c
@@ -175,7 +175,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -197,7 +197,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -221,7 +221,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c
index ff00ae6..0b30326 100644
--- a/test/core/end2end/tests/payload.c
+++ b/test/core/end2end/tests/payload.c
@@ -164,7 +164,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -185,7 +185,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -209,7 +209,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index 43abda4..39682d8 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -154,7 +154,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -175,7 +175,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(101), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   for (i = 0; i < messages; i++) {
@@ -193,7 +193,7 @@
     op->flags = 0;
     op->reserved = NULL;
     op++;
-    error = grpc_call_start_batch(c, ops, op - ops, tag(2), NULL);
+    error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL);
     GPR_ASSERT(GRPC_CALL_OK == error);
 
     op = ops;
@@ -202,7 +202,7 @@
     op->flags = 0;
     op->reserved = NULL;
     op++;
-    error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+    error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
     GPR_ASSERT(GRPC_CALL_OK == error);
     cq_expect_completion(cqv, tag(102), 1);
     cq_verify(cqv);
@@ -213,7 +213,7 @@
     op->flags = 0;
     op->reserved = NULL;
     op++;
-    error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+    error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
     GPR_ASSERT(GRPC_CALL_OK == error);
     cq_expect_completion(cqv, tag(103), 1);
     cq_expect_completion(cqv, tag(2), 1);
@@ -233,7 +233,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(3), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   op = ops;
@@ -244,7 +244,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(104), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(1), 1);
diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c
index eddce6d..b3156e0 100644
--- a/test/core/end2end/tests/registered_call.c
+++ b/test/core/end2end/tests/registered_call.c
@@ -148,7 +148,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -176,7 +176,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c
index eb2e5dc..b9cdf51 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.c
@@ -160,7 +160,7 @@
   op->reserved = NULL;
   op++;
   expectation = call_start_batch_expected_result;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(expectation == error);
 
   if (expectation == GRPC_CALL_OK) {
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 149dbae..a323b43 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -158,7 +158,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
@@ -178,7 +178,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -197,7 +197,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c
index 8bacc6c..bdc18a5 100644
--- a/test/core/end2end/tests/server_finishes_request.c
+++ b/test/core/end2end/tests/server_finishes_request.c
@@ -145,7 +145,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -173,7 +173,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c
index 233bc9b..ad7def0 100644
--- a/test/core/end2end/tests/shutdown_finishes_calls.c
+++ b/test/core/end2end/tests/shutdown_finishes_calls.c
@@ -139,7 +139,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -155,7 +155,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   /* shutdown and destroy the server */
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index 9133aac..14e0ac8 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -140,7 +140,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   config.init_server(f, server_args);
@@ -170,7 +170,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c
index 0f62d95..a874640 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.c
@@ -155,7 +155,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -192,7 +192,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c
index 8b76475..c040b9f 100644
--- a/test/core/end2end/tests/trailing_metadata.c
+++ b/test/core/end2end/tests/trailing_metadata.c
@@ -178,7 +178,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL);
+  error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   error =
@@ -200,7 +200,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(102), 1);
@@ -225,7 +225,7 @@
   op->flags = 0;
   op->reserved = NULL;
   op++;
-  error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL);
+  error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
   GPR_ASSERT(GRPC_CALL_OK == error);
 
   cq_expect_completion(cqv, tag(103), 1);
diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.c
index bf5bc84..0bac8fe 100644
--- a/test/core/util/parse_hexstring.c
+++ b/test/core/util/parse_hexstring.c
@@ -35,7 +35,7 @@
 #include <grpc/support/log.h>
 
 gpr_slice parse_hexstring(const char *hexstring) {
-  int nibbles = 0;
+  size_t nibbles = 0;
   const char *p = 0;
   gpr_uint8 *out;
   gpr_uint8 temp;
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c
index 61535cc..aa7f77e 100644
--- a/test/core/util/reconnect_server.c
+++ b/test/core/util/reconnect_server.c
@@ -81,7 +81,8 @@
     } else {
       if (last_colon == NULL) {
         gpr_log(GPR_ERROR, "peer does not contain a ':'");
-      } else if (strncmp(server->peer, peer, last_colon - peer) != 0) {
+      } else if (strncmp(server->peer, peer, (size_t)(last_colon - peer)) !=
+                 0) {
         gpr_log(GPR_ERROR, "mismatched peer! %s vs %s", server->peer, peer);
       }
       gpr_free(peer);
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 685bdff..f5d5cdb 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -42,12 +42,12 @@
 
 #if GPR_GETPID_IN_UNISTD_H
 #include <unistd.h>
-static int seed(void) { return getpid(); }
+static unsigned seed(void) { return (unsigned)getpid(); }
 #endif
 
 #if GPR_GETPID_IN_PROCESS_H
 #include <process.h>
-static int seed(void) { return _getpid(); }
+static unsigned seed(void) { return _getpid(); }
 #endif
 
 #if GPR_WINDOWS_CRASH_HANDLER