• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5{
6  'variables': {
7    'tcmalloc_dir': '../../third_party/tcmalloc/chromium',
8    'use_vtable_verify%': 0,
9  },
10  'targets': [
11    # Only executables and not libraries should depend on the
12    # allocator target; only the application (the final executable)
13    # knows what allocator makes sense.
14    {
15      'target_name': 'allocator',
16      'type': 'static_library',
17      # Make sure the allocation library is optimized to
18      # the hilt in official builds.
19      'variables': {
20        'optimize': 'max',
21      },
22      'include_dirs': [
23        '.',
24        '<(tcmalloc_dir)/src/base',
25        '<(tcmalloc_dir)/src',
26        '../..',
27      ],
28      'direct_dependent_settings': {
29        'configurations': {
30          'Common_Base': {
31            'msvs_settings': {
32              'VCLinkerTool': {
33                'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'],
34                'AdditionalDependencies': [
35                  '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib'
36                ],
37              },
38            },
39          },
40        },
41        'conditions': [
42          ['OS=="win"', {
43            'defines': [
44              'PERFTOOLS_DLL_DECL=',
45            ],
46          }],
47        ],
48      },
49      'sources': [
50        # Generated for our configuration from tcmalloc's build
51        # and checked in.
52        '<(tcmalloc_dir)/src/config.h',
53        '<(tcmalloc_dir)/src/config_android.h',
54        '<(tcmalloc_dir)/src/config_linux.h',
55        '<(tcmalloc_dir)/src/config_win.h',
56
57        # all tcmalloc native and forked files
58        '<(tcmalloc_dir)/src/addressmap-inl.h',
59        '<(tcmalloc_dir)/src/base/abort.cc',
60        '<(tcmalloc_dir)/src/base/abort.h',
61        '<(tcmalloc_dir)/src/base/arm_instruction_set_select.h',
62        '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
63        '<(tcmalloc_dir)/src/base/atomicops-internals-arm-generic.h',
64        '<(tcmalloc_dir)/src/base/atomicops-internals-arm-v6plus.h',
65        '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
66        '<(tcmalloc_dir)/src/base/atomicops-internals-windows.h',
67        '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc',
68        '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
69        '<(tcmalloc_dir)/src/base/atomicops.h',
70        '<(tcmalloc_dir)/src/base/basictypes.h',
71        '<(tcmalloc_dir)/src/base/commandlineflags.h',
72        '<(tcmalloc_dir)/src/base/cycleclock.h',
73        # We don't list dynamic_annotations.c since its copy is already
74        # present in the dynamic_annotations target.
75        '<(tcmalloc_dir)/src/base/dynamic_annotations.h',
76        '<(tcmalloc_dir)/src/base/elf_mem_image.cc',
77        '<(tcmalloc_dir)/src/base/elf_mem_image.h',
78        '<(tcmalloc_dir)/src/base/elfcore.h',
79        '<(tcmalloc_dir)/src/base/googleinit.h',
80        '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
81        '<(tcmalloc_dir)/src/base/linuxthreads.cc',
82        '<(tcmalloc_dir)/src/base/linuxthreads.h',
83        '<(tcmalloc_dir)/src/base/logging.cc',
84        '<(tcmalloc_dir)/src/base/logging.h',
85        '<(tcmalloc_dir)/src/base/low_level_alloc.cc',
86        '<(tcmalloc_dir)/src/base/low_level_alloc.h',
87        '<(tcmalloc_dir)/src/base/simple_mutex.h',
88        '<(tcmalloc_dir)/src/base/spinlock.cc',
89        '<(tcmalloc_dir)/src/base/spinlock.h',
90        '<(tcmalloc_dir)/src/base/spinlock_internal.cc',
91        '<(tcmalloc_dir)/src/base/spinlock_internal.h',
92        '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
93        '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
94        '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
95        '<(tcmalloc_dir)/src/base/stl_allocator.h',
96        '<(tcmalloc_dir)/src/base/synchronization_profiling.h',
97        '<(tcmalloc_dir)/src/base/sysinfo.cc',
98        '<(tcmalloc_dir)/src/base/sysinfo.h',
99        '<(tcmalloc_dir)/src/base/thread_annotations.h',
100        '<(tcmalloc_dir)/src/base/thread_lister.c',
101        '<(tcmalloc_dir)/src/base/thread_lister.h',
102        '<(tcmalloc_dir)/src/base/vdso_support.cc',
103        '<(tcmalloc_dir)/src/base/vdso_support.h',
104        '<(tcmalloc_dir)/src/central_freelist.cc',
105        '<(tcmalloc_dir)/src/central_freelist.h',
106        '<(tcmalloc_dir)/src/common.cc',
107        '<(tcmalloc_dir)/src/common.h',
108        '<(tcmalloc_dir)/src/debugallocation.cc',
109        '<(tcmalloc_dir)/src/deep-heap-profile.cc',
110        '<(tcmalloc_dir)/src/deep-heap-profile.h',
111        '<(tcmalloc_dir)/src/free_list.cc',
112        '<(tcmalloc_dir)/src/free_list.h',
113        '<(tcmalloc_dir)/src/getpc.h',
114        '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
115        '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
116        '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
117        '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
118        '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
119        '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
120        '<(tcmalloc_dir)/src/gperftools/profiler.h',
121        '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
122        '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
123        '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
124        '<(tcmalloc_dir)/src/heap-checker.cc',
125        '<(tcmalloc_dir)/src/heap-profile-table.cc',
126        '<(tcmalloc_dir)/src/heap-profile-table.h',
127        '<(tcmalloc_dir)/src/heap-profiler.cc',
128        '<(tcmalloc_dir)/src/internal_logging.cc',
129        '<(tcmalloc_dir)/src/internal_logging.h',
130        '<(tcmalloc_dir)/src/libc_override.h',
131        '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
132        '<(tcmalloc_dir)/src/libc_override_glibc.h',
133        '<(tcmalloc_dir)/src/libc_override_osx.h',
134        '<(tcmalloc_dir)/src/libc_override_redefine.h',
135        '<(tcmalloc_dir)/src/linked_list.h',
136        '<(tcmalloc_dir)/src/malloc_extension.cc',
137        '<(tcmalloc_dir)/src/malloc_hook-inl.h',
138        '<(tcmalloc_dir)/src/malloc_hook.cc',
139        '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
140        '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
141        '<(tcmalloc_dir)/src/maybe_threads.cc',
142        '<(tcmalloc_dir)/src/maybe_threads.h',
143        '<(tcmalloc_dir)/src/memfs_malloc.cc',
144        '<(tcmalloc_dir)/src/memory_region_map.cc',
145        '<(tcmalloc_dir)/src/memory_region_map.h',
146        '<(tcmalloc_dir)/src/packed-cache-inl.h',
147        '<(tcmalloc_dir)/src/page_heap.cc',
148        '<(tcmalloc_dir)/src/page_heap.h',
149        '<(tcmalloc_dir)/src/page_heap_allocator.h',
150        '<(tcmalloc_dir)/src/pagemap.h',
151        '<(tcmalloc_dir)/src/profile-handler.cc',
152        '<(tcmalloc_dir)/src/profile-handler.h',
153        '<(tcmalloc_dir)/src/profiledata.cc',
154        '<(tcmalloc_dir)/src/profiledata.h',
155        '<(tcmalloc_dir)/src/profiler.cc',
156        '<(tcmalloc_dir)/src/raw_printer.cc',
157        '<(tcmalloc_dir)/src/raw_printer.h',
158        '<(tcmalloc_dir)/src/sampler.cc',
159        '<(tcmalloc_dir)/src/sampler.h',
160        '<(tcmalloc_dir)/src/span.cc',
161        '<(tcmalloc_dir)/src/span.h',
162        '<(tcmalloc_dir)/src/stack_trace_table.cc',
163        '<(tcmalloc_dir)/src/stack_trace_table.h',
164        '<(tcmalloc_dir)/src/stacktrace.cc',
165        '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
166        '<(tcmalloc_dir)/src/stacktrace_config.h',
167        '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
168        '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
169        '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
170        '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
171        '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
172        '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
173        '<(tcmalloc_dir)/src/static_vars.cc',
174        '<(tcmalloc_dir)/src/static_vars.h',
175        '<(tcmalloc_dir)/src/symbolize.cc',
176        '<(tcmalloc_dir)/src/symbolize.h',
177        '<(tcmalloc_dir)/src/system-alloc.cc',
178        '<(tcmalloc_dir)/src/system-alloc.h',
179        '<(tcmalloc_dir)/src/tcmalloc.cc',
180        '<(tcmalloc_dir)/src/tcmalloc_guard.h',
181        '<(tcmalloc_dir)/src/thread_cache.cc',
182        '<(tcmalloc_dir)/src/thread_cache.h',
183        '<(tcmalloc_dir)/src/windows/config.h',
184        '<(tcmalloc_dir)/src/windows/get_mangled_names.cc',
185        '<(tcmalloc_dir)/src/windows/gperftools/tcmalloc.h',
186        '<(tcmalloc_dir)/src/windows/ia32_modrm_map.cc',
187        '<(tcmalloc_dir)/src/windows/ia32_opcode_map.cc',
188        '<(tcmalloc_dir)/src/windows/mingw.h',
189        '<(tcmalloc_dir)/src/windows/mini_disassembler.cc',
190        '<(tcmalloc_dir)/src/windows/mini_disassembler.h',
191        '<(tcmalloc_dir)/src/windows/mini_disassembler_types.h',
192        '<(tcmalloc_dir)/src/windows/override_functions.cc',
193        '<(tcmalloc_dir)/src/windows/patch_functions.cc',
194        '<(tcmalloc_dir)/src/windows/port.cc',
195        '<(tcmalloc_dir)/src/windows/port.h',
196        '<(tcmalloc_dir)/src/windows/preamble_patcher.cc',
197        '<(tcmalloc_dir)/src/windows/preamble_patcher.h',
198        '<(tcmalloc_dir)/src/windows/preamble_patcher_with_stub.cc',
199
200        'allocator_shim.cc',
201        'allocator_shim.h',
202        'debugallocation_shim.cc',
203        'generic_allocators.cc',
204        'win_allocator.cc',
205      ],
206      # sources! means that these are not compiled directly.
207      'sources!': [
208        # Included by allocator_shim.cc for maximal inlining.
209        'generic_allocators.cc',
210        'win_allocator.cc',
211
212        # Included by debugallocation_shim.cc.
213        '<(tcmalloc_dir)/src/debugallocation.cc',
214        '<(tcmalloc_dir)/src/tcmalloc.cc',
215
216        # We simply don't use these, but list them above so that IDE
217        # users can view the full available source for reference, etc.
218        '<(tcmalloc_dir)/src/addressmap-inl.h',
219        '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
220        '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
221        '<(tcmalloc_dir)/src/base/atomicops-internals-x86-msvc.h',
222        '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc',
223        '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
224        '<(tcmalloc_dir)/src/base/atomicops.h',
225        '<(tcmalloc_dir)/src/base/basictypes.h',
226        '<(tcmalloc_dir)/src/base/commandlineflags.h',
227        '<(tcmalloc_dir)/src/base/cycleclock.h',
228        '<(tcmalloc_dir)/src/base/elf_mem_image.h',
229        '<(tcmalloc_dir)/src/base/elfcore.h',
230        '<(tcmalloc_dir)/src/base/googleinit.h',
231        '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
232        '<(tcmalloc_dir)/src/base/simple_mutex.h',
233        '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
234        '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
235        '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
236        '<(tcmalloc_dir)/src/base/stl_allocator.h',
237        '<(tcmalloc_dir)/src/base/thread_annotations.h',
238        '<(tcmalloc_dir)/src/getpc.h',
239        '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
240        '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
241        '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
242        '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
243        '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
244        '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
245        '<(tcmalloc_dir)/src/gperftools/profiler.h',
246        '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
247        '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
248        '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
249        '<(tcmalloc_dir)/src/heap-checker.cc',
250        '<(tcmalloc_dir)/src/libc_override.h',
251        '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
252        '<(tcmalloc_dir)/src/libc_override_glibc.h',
253        '<(tcmalloc_dir)/src/libc_override_osx.h',
254        '<(tcmalloc_dir)/src/libc_override_redefine.h',
255        '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
256        '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
257        '<(tcmalloc_dir)/src/memfs_malloc.cc',
258        '<(tcmalloc_dir)/src/packed-cache-inl.h',
259        '<(tcmalloc_dir)/src/page_heap_allocator.h',
260        '<(tcmalloc_dir)/src/pagemap.h',
261        '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
262        '<(tcmalloc_dir)/src/stacktrace_config.h',
263        '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
264        '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
265        '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
266        '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
267        '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
268        '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
269        '<(tcmalloc_dir)/src/tcmalloc_guard.h',
270        '<(tcmalloc_dir)/src/windows/config.h',
271        '<(tcmalloc_dir)/src/windows/gperftools/tcmalloc.h',
272        '<(tcmalloc_dir)/src/windows/get_mangled_names.cc',
273        '<(tcmalloc_dir)/src/windows/ia32_modrm_map.cc',
274        '<(tcmalloc_dir)/src/windows/ia32_opcode_map.cc',
275        '<(tcmalloc_dir)/src/windows/mingw.h',
276        '<(tcmalloc_dir)/src/windows/mini_disassembler.cc',
277        '<(tcmalloc_dir)/src/windows/mini_disassembler.h',
278        '<(tcmalloc_dir)/src/windows/mini_disassembler_types.h',
279        '<(tcmalloc_dir)/src/windows/override_functions.cc',
280        '<(tcmalloc_dir)/src/windows/patch_functions.cc',
281        '<(tcmalloc_dir)/src/windows/preamble_patcher.cc',
282        '<(tcmalloc_dir)/src/windows/preamble_patcher.h',
283        '<(tcmalloc_dir)/src/windows/preamble_patcher_with_stub.cc',
284      ],
285      'dependencies': [
286        '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
287      ],
288      'msvs_settings': {
289        # TODO(sgk):  merge this with build/common.gypi settings
290        'VCLibrarianTool': {
291          'AdditionalOptions': ['/ignore:4006,4221'],
292        },
293        'VCLinkerTool': {
294          'AdditionalOptions': ['/ignore:4006'],
295        },
296      },
297      'configurations': {
298        'Debug_Base': {
299          'msvs_settings': {
300            'VCCLCompilerTool': {
301              'RuntimeLibrary': '0',
302            },
303          },
304          'variables': {
305            # Provide a way to force disable debugallocation in Debug builds,
306            # e.g. for profiling (it's more rare to profile Debug builds,
307            # but people sometimes need to do that).
308            'disable_debugallocation%': 0,
309          },
310          'conditions': [
311            # TODO(phajdan.jr): Also enable on Windows.
312            ['disable_debugallocation==0 and OS!="win"', {
313              'defines': [
314                # Use debugallocation for Debug builds to catch problems early
315                # and cleanly, http://crbug.com/30715 .
316                'TCMALLOC_FOR_DEBUGALLOCATION',
317              ],
318            }],
319          ],
320        },
321      },
322      # Disable the heap checker in tcmalloc.
323      'defines': [
324        'NO_HEAP_CHECK',
325      ],
326      'conditions': [
327        ['OS=="linux" and clang_type_profiler==1', {
328          'dependencies': [
329            'type_profiler_tcmalloc',
330          ],
331          # It is undoing dependencies and cflags_cc for type_profiler which
332          # build/common.gypi injects into all targets.
333          'dependencies!': [
334            'type_profiler',
335          ],
336          'cflags_cc!': [
337            '-fintercept-allocation-functions',
338          ],
339        }],
340        ['OS=="win"', {
341          'defines': [
342            'PERFTOOLS_DLL_DECL=',
343          ],
344          'defines!': [
345            # tcmalloc source files unconditionally define this, remove it from
346            # the list of defines that common.gypi defines globally.
347            'NOMINMAX',
348          ],
349          'dependencies': [
350            'libcmt',
351          ],
352          'include_dirs': [
353            '<(tcmalloc_dir)/src/windows',
354          ],
355          'sources!': [
356            '<(tcmalloc_dir)/src/base/elf_mem_image.cc',
357            '<(tcmalloc_dir)/src/base/elf_mem_image.h',
358            '<(tcmalloc_dir)/src/base/linuxthreads.cc',
359            '<(tcmalloc_dir)/src/base/linuxthreads.h',
360            '<(tcmalloc_dir)/src/base/vdso_support.cc',
361            '<(tcmalloc_dir)/src/base/vdso_support.h',
362            '<(tcmalloc_dir)/src/maybe_threads.cc',
363            '<(tcmalloc_dir)/src/maybe_threads.h',
364            '<(tcmalloc_dir)/src/symbolize.h',
365            '<(tcmalloc_dir)/src/system-alloc.cc',
366            '<(tcmalloc_dir)/src/system-alloc.h',
367
368            # included by allocator_shim.cc
369            'debugallocation_shim.cc',
370          ],
371        }],
372        ['OS=="win" or profiling!=1', {
373          'sources!': [
374            # cpuprofiler
375            '<(tcmalloc_dir)/src/base/thread_lister.c',
376            '<(tcmalloc_dir)/src/base/thread_lister.h',
377            '<(tcmalloc_dir)/src/profiledata.cc',
378            '<(tcmalloc_dir)/src/profiledata.h',
379            '<(tcmalloc_dir)/src/profile-handler.cc',
380            '<(tcmalloc_dir)/src/profile-handler.h',
381            '<(tcmalloc_dir)/src/profiler.cc',
382          ],
383        }],
384        ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', {
385          'sources!': [
386            '<(tcmalloc_dir)/src/system-alloc.h',
387            '<(tcmalloc_dir)/src/windows/port.cc',
388            '<(tcmalloc_dir)/src/windows/port.h',
389
390            # TODO(willchan): Support allocator shim later on.
391            'allocator_shim.cc',
392          ],
393          # We enable all warnings by default, but upstream disables a few.
394          # Keep "-Wno-*" flags in sync with upstream by comparing against:
395          # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
396          'cflags': [
397            '-Wno-sign-compare',
398            '-Wno-unused-result',
399          ],
400          'cflags!': [
401            '-fvisibility=hidden',
402          ],
403          'link_settings': {
404            'ldflags': [
405              # Don't let linker rip this symbol out, otherwise the heap&cpu
406              # profilers will not initialize properly on startup.
407              '-Wl,-uIsHeapProfilerRunning,-uProfilerStart',
408              # Do the same for heap leak checker.
409              '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi',
410              '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl',
411              '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv',
412          ]},
413        }],
414        [ 'use_vtable_verify==1', {
415          'cflags': [
416            '-fvtable-verify=preinit',
417          ],
418        }],
419        ['order_profiling != 0', {
420          'target_conditions' : [
421            ['_toolset=="target"', {
422              'cflags!': [ '-finstrument-functions' ],
423            }],
424          ],
425        }],
426      ],
427    },
428    {
429      # This library is linked in to src/base.gypi:base and allocator_unittests
430      # It can't depend on either and nothing else should depend on it - all
431      # other code should use the interfaced provided by base.
432      'target_name': 'allocator_extension_thunks',
433      'type': 'static_library',
434      'sources': [
435        'allocator_extension_thunks.cc',
436        'allocator_extension_thunks.h',
437      ],
438      'toolsets': ['host', 'target'],
439      'include_dirs': [
440        '../../'
441      ],
442      'conditions': [
443        ['OS=="linux" and clang_type_profiler==1', {
444          # It is undoing dependencies and cflags_cc for type_profiler which
445          # build/common.gypi injects into all targets.
446          'dependencies!': [
447            'type_profiler',
448          ],
449          'cflags_cc!': [
450            '-fintercept-allocation-functions',
451          ],
452        }],
453      ],
454    },
455   ],
456  'conditions': [
457    ['OS=="win"', {
458      'targets': [
459        {
460          'target_name': 'libcmt',
461          'type': 'none',
462          'actions': [
463            {
464              'action_name': 'libcmt',
465              'inputs': [
466                'prep_libc.py',
467              ],
468              'outputs': [
469                '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib',
470              ],
471              'action': [
472                'python',
473                'prep_libc.py',
474                '$(VCInstallDir)lib',
475                '<(SHARED_INTERMEDIATE_DIR)/allocator',
476                '<(target_arch)',
477              ],
478            },
479          ],
480        },
481        {
482          'target_name': 'allocator_unittests',
483          'type': 'executable',
484          'dependencies': [
485            'allocator',
486            'allocator_extension_thunks',
487            '../../testing/gtest.gyp:gtest',
488          ],
489          'include_dirs': [
490            '.',
491            '<(tcmalloc_dir)/src/base',
492            '<(tcmalloc_dir)/src',
493            '../..',
494          ],
495          'sources': [
496            'allocator_unittest.cc',
497            '../profiler/alternate_timer.cc',
498            '../profiler/alternate_timer.h',
499          ],
500        },
501        {
502          'target_name': 'tcmalloc_unittest',
503          'type': 'executable',
504          'sources': [
505            'tcmalloc_unittest.cc',
506          ],
507          'include_dirs': [
508            '../..',
509            # For constants of TCMalloc.
510            '<(tcmalloc_dir)/src',
511          ],
512          'dependencies': [
513            '../../testing/gtest.gyp:gtest',
514            '../base.gyp:base',
515            'allocator',
516          ],
517        },
518      ],
519    }],
520    ['OS=="win" and target_arch=="ia32"', {
521      'targets': [
522        {
523          'target_name': 'allocator_extension_thunks_win64',
524          'type': 'static_library',
525          'sources': [
526            'allocator_extension_thunks.cc',
527            'allocator_extension_thunks.h',
528          ],
529          'toolsets': ['host', 'target'],
530          'include_dirs': [
531            '../../'
532          ],
533          'configurations': {
534            'Common_Base': {
535              'msvs_target_platform': 'x64',
536            },
537          },
538        },
539      ],
540    }],
541    ['OS=="linux" and clang_type_profiler==1', {
542      # Some targets in this section undo dependencies and cflags_cc for
543      # type_profiler which build/common.gypi injects into all targets.
544      'targets': [
545        {
546          'target_name': 'type_profiler',
547          'type': 'static_library',
548          'dependencies!': [
549            'type_profiler',
550          ],
551          'cflags_cc!': [
552            '-fintercept-allocation-functions',
553          ],
554          'include_dirs': [
555            '../..',
556          ],
557          'sources': [
558            'type_profiler.cc',
559            'type_profiler.h',
560            'type_profiler_control.h',
561          ],
562          'toolsets': ['host', 'target'],
563        },
564        {
565          'target_name': 'type_profiler_tcmalloc',
566          'type': 'static_library',
567          'dependencies!': [
568            'type_profiler',
569          ],
570          'cflags_cc!': [
571            '-fintercept-allocation-functions',
572          ],
573          'include_dirs': [
574            '<(tcmalloc_dir)/src',
575            '../..',
576          ],
577          'sources': [
578            'type_profiler_tcmalloc.cc',
579            'type_profiler_tcmalloc.h',
580            '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
581            '<(tcmalloc_dir)/src/type_profiler_map.cc',
582          ],
583        },
584        {
585          'target_name': 'type_profiler_unittests',
586          'type': 'executable',
587          'dependencies': [
588            '../../testing/gtest.gyp:gtest',
589            '../base.gyp:base',
590            'allocator',
591            'type_profiler_tcmalloc',
592          ],
593          'include_dirs': [
594            '../..',
595          ],
596          'sources': [
597            'type_profiler_control.cc',
598            'type_profiler_control.h',
599            'type_profiler_unittest.cc',
600          ],
601        },
602        {
603          'target_name': 'type_profiler_map_unittests',
604          'type': 'executable',
605          'dependencies': [
606            '../../testing/gtest.gyp:gtest',
607            '../base.gyp:base',
608            'allocator',
609          ],
610          'dependencies!': [
611            'type_profiler',
612          ],
613          'cflags_cc!': [
614            '-fintercept-allocation-functions',
615          ],
616          'include_dirs': [
617            '<(tcmalloc_dir)/src',
618            '../..',
619          ],
620          'sources': [
621            'type_profiler_map_unittest.cc',
622            '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
623            '<(tcmalloc_dir)/src/type_profiler_map.cc',
624          ],
625        },
626      ],
627    }],
628  ],
629}
630