5
5
# use the regexp for of specifying symbols.
7
7
# Make sure that when we re-make ./configure, we get the macros we need
8
ACLOCAL_AMFLAGS = -I `pwd`/../autoconf
8
ACLOCAL_AMFLAGS = -I m4
10
10
# This is so we can #include <google/foo>
11
11
AM_CPPFLAGS = -I$(top_srcdir)/src
13
# This is mostly based on configure options
16
# These are good warnings to turn on by default,
18
AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
21
# These are x86-specific, having to do with frame-pointers
23
if ENABLE_FRAME_POINTERS
24
AM_CXXFLAGS += -fno-omit-frame-pointer
26
# TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS),
27
# before setting this.
28
AM_CXXFLAGS += -DNO_FRAME_POINTER
13
32
googleincludedir = $(includedir)/google
14
33
# The .h files you want to install (that is, .h files that people
15
34
# who install this package can include in their own applications.)
16
35
# We'll add to this later, on a library-by-library basis
17
36
googleinclude_HEADERS =
19
perftoolsincludedir = $(googleincludedir)/perftools
20
# The 'private' header files go into /usr/local/include/google/perftools.
21
# We'll add to this later, on a library-by-library basis
22
perftoolsinclude_HEADERS =
24
38
docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
25
39
# This is for HTML and other documentation you want to install.
26
40
# Add your documentation files (in doc/) in addition to these
27
41
# top-level boilerplate files. Also add a TODO file if you have one.
28
42
# We'll add to this later, on a library-by-library basis
29
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
43
dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README README.windows \
31
46
# The libraries (.so's) you want to install
32
47
# We'll add to this later, on a library-by-library basis
49
# This is for 'convenience libraries' -- basically just a container for sources
51
## The location of the windows project file for each binary we make
52
WINDOWS_PROJECTS = google-perftools.sln
35
54
# unittests you want to run when people type 'make check'.
36
# TESTS is for binary unittests, check_SCRIPTS for script-based unittests.
37
# TESTS_ENVIRONMENT sets environment variables for when you run unittest,
38
# but it only seems to take effect for *binary* unittests (argh!)
39
# We'll add to this later, on a library-by-library basis
55
# Note: tests cannot take any arguments!
56
# In theory, unittests that are scripts should be added to check_SCRIPTS
57
# instead. But check_SCRIPTS is definitely a second-class testing mechanims:
58
# it don't get TESTS_ENVIRONMENT, and it doesn't get success/failure counting
59
# (in fact, a script failure aborts all the rest of the tests, even with -k).
60
# So, for scripts, we add the script to tests, and also put in an empty
61
# rule so automake doesn't try to build the script as a C binary.
63
# TESTS_ENVIRONMENT sets environment variables for when you run unittest.
64
# We always get "srcdir" set for free.
65
# We'll add to this later, on a library-by-library basis.
42
66
TESTS_ENVIRONMENT =
43
# Every time you add a unittest to check_SCRIPTS, add it here too
67
# All script tests should be added here
69
# If your test calls another program that, like the test itself, shouldn't
70
# be installed, add it here. (Stuff in TESTS is automatically added later).
47
74
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
49
dist_doc_DATA += doc/index.html
76
dist_doc_DATA += doc/index.html doc/designstyle.css
79
### ------- library routines, in src/base
81
# This is a 'convenience library' -- it's not actually installed or anything
82
LOGGING_INCLUDES = src/base/logging.h \
83
src/base/commandlineflags.h \
84
src/base/basictypes.h \
85
src/base/dynamic_annotations.h
86
noinst_LTLIBRARIES += liblogging.la
87
liblogging_la_SOURCES = src/base/logging.cc \
88
src/base/dynamic_annotations.cc \
91
SYSINFO_INCLUDES = src/base/sysinfo.h \
93
src/base/commandlineflags.h \
94
src/base/cycleclock.h \
96
noinst_LTLIBRARIES += libsysinfo.la
97
libsysinfo_la_SOURCES = src/base/sysinfo.cc \
100
# For MinGW, we use libwindows and not libspinlock. For every other
101
# unix system, we use libspinlock and don't need libwindows. Luckily,
102
# we need the windows.a library in exactly the same place we need
103
# spinlock.a (pretty much everywhere), so we can use the same variable
104
# name for each. In addition, there is a bunch of functionality in
105
# libwindows that obsoletes the need for other files like
108
WINDOWS_INCLUDES = src/windows/port.h \
109
src/windows/mingw.h \
110
src/windows/mini_disassembler.h \
111
src/windows/mini_disassembler_types.h \
112
src/windows/preamble_patcher.h
113
noinst_LTLIBRARIES += libwindows.la
114
libwindows_la_SOURCES = $(WINDOWS_INCLUDES) \
115
src/windows/port.cc \
116
src/windows/ia32_modrm_map.cc \
117
src/windows/ia32_opcode_map.cc \
118
src/windows/mini_disassembler.cc \
119
src/windows/patch_functions.cc \
120
src/windows/preamble_patcher.cc \
121
src/windows/preamble_patcher_with_stub.cc
122
LIBSPINLOCK = libwindows.la libsysinfo.la liblogging.la
127
# spinlock is the only code that uses atomicops.
128
SPINLOCK_INCLUDES = src/base/spinlock.h \
129
src/base/atomicops.h \
130
src/base/atomicops-internals-macosx.h \
131
src/base/atomicops-internals-linuxppc.h \
132
src/base/atomicops-internals-x86-msvc.h \
133
src/base/atomicops-internals-x86.h
135
noinst_LTLIBRARIES += libspinlock.la
136
libspinlock_la_SOURCES = src/base/spinlock.cc \
137
src/base/atomicops-internals-x86.cc \
139
# spinlock also needs NumCPUs, from libsysinfo, which in turn needs liblogging
140
LIBSPINLOCK = libspinlock.la libsysinfo.la liblogging.la
142
MAYBE_THREADS_CC = src/maybe_threads.cc
143
SYSTEM_ALLOC_CC = src/system-alloc.cc
147
TESTS += low_level_alloc_unittest
148
WINDOWS_PROJECTS += vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj
149
LOW_LEVEL_ALLOC_UNITTEST_INCLUDES = src/base/low_level_alloc.h \
150
src/base/basictypes.h \
151
src/google/malloc_hook.h \
152
src/malloc_hook-inl.h \
153
$(SPINLOCK_INCLUDES) \
155
low_level_alloc_unittest_SOURCES = src/base/low_level_alloc.cc \
157
src/tests/low_level_alloc_unittest.cc \
158
$(LOW_LEVEL_ALLOC_UNITTEST_INCLUDES)
159
low_level_alloc_unittest_LDADD = libstacktrace.la
162
TESTS += atomicops_unittest
163
ATOMICOPS_UNITTEST_INCLUDES = src/base/atomicops.h \
164
src/base/atomicops-internals-macosx.h \
165
src/base/atomicops-internals-x86-msvc.h \
166
src/base/atomicops-internals-x86.h \
168
atomicops_unittest_SOURCES = src/tests/atomicops_unittest.cc \
169
$(ATOMICOPS_UNITTEST_INCLUDES)
170
atomicops_unittest_LDADD = $(LIBSPINLOCK)
51
174
### ------- stack trace
53
176
### The header files we use. We divide into categories based on directory
54
S_STACKTRACE_INCLUDES =
177
S_STACKTRACE_INCLUDES = src/stacktrace_generic-inl.h \
178
src/stacktrace_libunwind-inl.h \
179
src/stacktrace_powerpc-inl.h \
180
src/stacktrace_x86_64-inl.h \
181
src/stacktrace_x86-inl.h
55
182
SG_STACKTRACE_INCLUDES = src/google/stacktrace.h
56
SGP_STACKTRACE_INCLUDES = src/config.h \
57
src/stacktrace_generic-inl.h \
58
src/stacktrace_libunwind-inl.h \
59
src/stacktrace_x86_64-inl.h \
60
src/stacktrace_x86-inl.h
61
STACKTRACE_INCLUDES = $(S_STACKTRACE_INCLUDES) $(SG_STACKTRACE_INCLUDES) $(SGP_STACKTRACE_INCLUDES)
183
STACKTRACE_INCLUDES = $(S_STACKTRACE_INCLUDES) $(SG_STACKTRACE_INCLUDES)
62
184
googleinclude_HEADERS += $(SG_STACKTRACE_INCLUDES)
63
perftoolsinclude_HEADERS += $(SGP_STACKTRACE_INCLUDES)
65
186
### Making the library
66
lib_LTLIBRARIES += libstacktrace.la
187
noinst_LTLIBRARIES += libstacktrace.la
67
188
libstacktrace_la_SOURCES = src/stacktrace.cc \
68
189
$(STACKTRACE_INCLUDES)
190
libstacktrace_la_LIBADD = $(UNWIND_LIBS) $(LIBSPINLOCK)
69
191
STACKTRACE_SYMBOLS = '(GetStackTrace)'
70
192
libstacktrace_la_LDFLAGS = -export-symbols-regex $(STACKTRACE_SYMBOLS)
73
196
TESTS += stacktrace_unittest
74
STACKTRACE_UNITTEST_INLCUDES = $(STACKTRACE_INCLUDES) \
197
STACKTRACE_UNITTEST_INLCUDES = src/config_for_unittests.h \
75
198
src/base/commandlineflags.h \
199
$(STACKTRACE_INCLUDES) \
77
201
stacktrace_unittest_SOURCES = src/tests/stacktrace_unittest.cc \
78
202
$(STACKTRACE_UNITTEST_INLCUDES)
79
stacktrace_unittest_LDADD = libstacktrace.la
203
stacktrace_unittest_LDADD = libstacktrace.la liblogging.la
212
bin_SCRIPTS = src/pprof
217
check_SCRIPTS = pprof_unittest
218
pprof_unittest: $(top_srcdir)/src/pprof
219
$(top_srcdir)/src/pprof -test
221
# Let unittests find pprof if they need to run it
222
TESTS_ENVIRONMENT += PPROF_PATH=$(top_srcdir)/src/pprof
226
dist_man_MANS = doc/pprof.1
227
dist_doc_DATA += doc/pprof_remote_servers.html
84
230
### ------- tcmalloc_minimal (thread-caching malloc)
86
232
### The header files we use. We divide into categories based on directory
87
S_TCMALLOC_MINIMAL_INCLUDES = src/config.h \
88
src/internal_logging.h \
233
S_TCMALLOC_MINIMAL_INCLUDES = src/internal_logging.h \
89
234
src/system-alloc.h \
90
src/internal_spinlock.h \
235
src/packed-cache-inl.h \
236
$(SPINLOCK_INCLUDES) \
91
237
src/base/commandlineflags.h \
92
238
src/base/basictypes.h \
240
src/malloc_hook-inl.h \
94
241
src/maybe_threads.h
95
242
SG_TCMALLOC_MINIMAL_INCLUDES = src/google/malloc_hook.h \
96
243
src/google/malloc_extension.h \
97
244
src/google/stacktrace.h
98
SGP_TCMALLOC_MINIMAL_INCLUDES = src/google/perftools/hash_set.h
99
TCMALLOC_MINIMAL_INCLUDES = $(S_TCMALLOC_MINIMAL_INCLUDES) $(SG_TCMALLOC_MINIMAL_INCLUDES) $(SGP_TCMALLOC_MINIMAL_INCLUDES)
245
TCMALLOC_MINIMAL_INCLUDES = $(S_TCMALLOC_MINIMAL_INCLUDES) $(SG_TCMALLOC_MINIMAL_INCLUDES)
100
246
googleinclude_HEADERS += $(SG_TCMALLOC_MINIMAL_INCLUDES)
101
perftoolsinclude_HEADERS += $(SGP_TCMALLOC_MINIMAL_INCLUDES)
103
248
### Making the library
104
249
lib_LTLIBRARIES += libtcmalloc_minimal.la
250
WINDOWS_PROJECTS += vsprojects/libtcmalloc_minimal/libtcmalloc_minimal.vcproj
105
251
libtcmalloc_minimal_la_SOURCES = src/internal_logging.cc \
106
src/system-alloc.cc \
253
src/memfs_malloc.cc \
107
254
src/tcmalloc.cc \
108
255
src/malloc_hook.cc \
109
256
src/malloc_extension.cc \
110
src/maybe_threads.cc \
257
$(MAYBE_THREADS_CC) \
111
258
$(TCMALLOC_MINIMAL_INCLUDES)
112
libtcmalloc_minimal_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
113
TCMALLOC_MINIMAL_SYMBOLS = '(malloc|free|realloc|calloc|cfree|memalign|valloc|pvalloc|posix_memalign|malloc_stats|MallocExtension|MallocHook)'
114
libtcmalloc_minimal_la_LDFLAGS = $(PTHREAD_CFLAGS) -export-symbols-regex $(TCMALLOC_MINIMAL_SYMBOLS)
115
libtcmalloc_minimal_la_LIBADD = $(PTHREAD_LIBS) libstacktrace.la
259
# We #define NO_TCMALLOC_SAMPLES, since sampling is turned off for _minimal.
260
libtcmalloc_minimal_la_CXXFLAGS = -DNO_TCMALLOC_SAMPLES \
261
$(PTHREAD_CFLAGS) -DNDEBUG $(AM_CXXFLAGS)
262
libtcmalloc_minimal_la_LDFLAGS = $(PTHREAD_CFLAGS)
263
libtcmalloc_minimal_la_LIBADD = $(PTHREAD_LIBS) $(LIBSPINLOCK)
265
LIBTCMALLOC_MINIMAL = libtcmalloc_minimal.la
119
269
# Commented out for the moment because malloc(very_big_num) is broken in
120
270
# standard libc! At least, in some situations, some of the time.
121
271
## TESTS += malloc_unittest
122
## MALLOC_UNITEST_INCLUDES = src/config.h \
123
## src/google/malloc_extension.h \
272
## MALLOC_UNITEST_INCLUDES = src/google/malloc_extension.h \
124
273
## src/google/malloc_hook.h \
274
## src/malloc_hook-inl.h \
125
275
## src/base/basictypes.h \
126
## src/google/perftools/hash_set.h \
127
276
## src/maybe_threads.h
128
277
## malloc_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
129
278
## src/malloc_hook.cc \
130
279
## src/malloc_extension.cc \
131
## src/maybe_threads.cc \
280
## $(MAYBE_THREADS_CC) \
132
281
## $(MALLOC_UNITTEST_INCLUDES)
133
## malloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
282
## malloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
134
283
## malloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
135
284
## malloc_unittest_LDADD = $(PTHREAD_LIBS)
137
TESTS += tcmalloc_unittest
138
TCMALLOC_UNITTEST_INCLUDES = src/google/malloc_extension.h
139
tcmalloc_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
140
$(TCMALLOC_UNITTEST_INCLUDES)
141
tcmalloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
142
tcmalloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
143
tcmalloc_unittest_LDADD = libtcmalloc.la $(PTHREAD_LIBS)
145
TESTS += tcmalloc_large_unittest
146
tcmalloc_large_unittest_SOURCES = src/tests/tcmalloc_large_unittest.cc
147
tcmalloc_large_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
148
tcmalloc_large_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
149
tcmalloc_large_unittest_LDADD = libtcmalloc.la $(PTHREAD_LIBS)
286
TESTS += tcmalloc_minimal_unittest
287
WINDOWS_PROJECTS += vsprojects/tcmalloc_minimal_unittest/tcmalloc_minimal_unittest.vcproj
288
WINDOWS_PROJECTS += vsprojects/tcmalloc_minimal_unittest-static/tcmalloc_minimal_unittest-static.vcproj
289
tcmalloc_minimal_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
290
src/tests/testutil.h src/tests/testutil.cc \
291
$(TCMALLOC_UNITTEST_INCLUDES)
292
tcmalloc_minimal_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
293
tcmalloc_minimal_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
294
tcmalloc_minimal_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) \
295
liblogging.la $(PTHREAD_LIBS)
297
TESTS += tcmalloc_minimal_large_unittest
298
WINDOWS_PROJECTS += vsprojects/tcmalloc_minimal_large/tcmalloc_minimal_large_unittest.vcproj
299
tcmalloc_minimal_large_unittest_SOURCES = src/tests/tcmalloc_large_unittest.cc
300
tcmalloc_minimal_large_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
301
tcmalloc_minimal_large_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
302
tcmalloc_minimal_large_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
304
# This tests it works to LD_PRELOAD libtcmalloc (tests maybe_threads.cc)
305
TESTS += maybe_threads_unittest.sh
306
maybe_threads_unittest_sh_SOURCES = src/tests/maybe_threads_unittest.sh
307
noinst_SCRIPTS += $(maybe_threads_unittest_sh_SOURCES)
308
# This script preloads libtcmalloc, and calls two other binaries as well
309
maybe_threads_unittest.sh$(EXEEXT): $(top_srcdir)/$(maybe_threads_unittest_sh_SOURCES) \
310
$(LIBTCMALLOC_MINIMAL) \
311
low_level_alloc_unittest
313
cp -p $(top_srcdir)/$(maybe_threads_unittest_sh_SOURCES) $@
315
# These all tests components of tcmalloc_minimal
317
TESTS += addressmap_unittest
318
WINDOWS_PROJECTS += vsprojects/addressmap_unittest/addressmap_unittest.vcproj
319
ADDRESSMAP_UNITTEST_INCLUDES = src/addressmap-inl.h \
320
src/base/commandlineflags.h \
322
addressmap_unittest_SOURCES = src/tests/addressmap_unittest.cc \
323
$(ADDRESSMAP_UNITTEST_INCLUDES)
324
addressmap_unittest_CXXFLAGS = -g $(AM_CXXFLAGS)
325
addressmap_unittest_LDADD = liblogging.la
328
TESTS += system_alloc_unittest
329
system_alloc_unittest_SOURCES = src/config_for_unittests.h \
330
src/tests/system-alloc_unittest.cc
331
system_alloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
332
system_alloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
333
system_alloc_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
336
TESTS += packed_cache_test
337
WINDOWS_PROJECTS += vsprojects/packed-cache_test/packed-cache_test.vcproj
338
packed_cache_test_SOURCES = src/tests/packed-cache_test.cc \
339
src/packed-cache-inl.h \
342
TESTS += frag_unittest
343
WINDOWS_PROJECTS += vsprojects/frag_unittest/frag_unittest.vcproj
344
frag_unittest_SOURCES = src/tests/frag_unittest.cc src/config_for_unittests.h
345
frag_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
346
frag_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
347
frag_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
349
TESTS += markidle_unittest
350
WINDOWS_PROJECTS += vsprojects/markidle_unittest/markidle_unittest.vcproj
351
markidle_unittest_SOURCES = src/tests/markidle_unittest.cc \
352
src/config_for_unittests.h \
353
src/tests/testutil.h src/tests/testutil.cc
354
markidle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
355
markidle_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
356
markidle_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
358
TESTS += memalign_unittest
359
WINDOWS_PROJECTS += vsprojects/memalign_unittest/memalign_unittest.vcproj
360
memalign_unittest_SOURCES = src/tests/memalign_unittest.cc \
361
src/config_for_unittests.h \
363
src/tests/testutil.h src/tests/testutil.cc
364
memalign_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
365
memalign_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
366
memalign_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
368
TESTS += thread_dealloc_unittest
369
WINDOWS_PROJECTS += vsprojects/thread_dealloc_unittest/thread_dealloc_unittest.vcproj
370
thread_dealloc_unittest_SOURCES = src/tests/thread_dealloc_unittest.cc \
371
src/config_for_unittests.h \
372
src/tests/testutil.h src/tests/testutil.cc
373
thread_dealloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
374
thread_dealloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
375
thread_dealloc_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS)
151
377
# performance/unittests originally from ptmalloc2
152
TESTS += ptmalloc_unittest1 ptmalloc_unittest2
378
# Commented out for now because they don't compile on all systems.
379
# However, you can still make/run by hand like so:
380
# make ptmalloc_unittest1 ptmalloc_unittest2
381
# ./ptmalloc_unittest1; ./ptmalloc_unittest2
382
##TESTS += ptmalloc_unittest1 ptmalloc_unittest2
383
EXTRA_PROGRAMS = ptmalloc_unittest1 ptmalloc_unittest2
153
384
PTMALLOC_UNITTEST_INCLUDES = src/tests/ptmalloc/t-test.h \
154
385
src/tests/ptmalloc/thread-m.h \
155
386
src/tests/ptmalloc/lran2.h \
207
438
### ------- tcmalloc (thread-caching malloc + heap profiler + heap checker)
440
# The full tcmalloc does not work on windows yet
209
443
### The header files we use. We divide into categories based on directory
210
S_TCMALLOC_INCLUDES = src/config.h \
211
src/internal_logging.h \
444
S_TCMALLOC_INCLUDES = src/internal_logging.h \
212
445
src/system-alloc.h \
213
src/internal_spinlock.h \
215
src/heap-profiler-inl.h \
216
447
src/addressmap-inl.h \
448
src/malloc_hook-inl.h \
449
src/packed-cache-inl.h \
450
src/heap-profile-table.h \
217
451
src/base/basictypes.h \
218
452
src/base/commandlineflags.h \
220
453
src/base/googleinit.h \
221
454
src/base/elfcore.h \
222
455
src/base/linux_syscall_support.h \
223
456
src/base/linuxthreads.h \
224
457
src/base/thread_lister.h \
459
src/base/stl_allocator.h \
460
src/maybe_threads.h \
461
$(SPINLOCK_INCLUDES) \
226
463
SG_TCMALLOC_INCLUDES = src/google/malloc_hook.h \
227
464
src/google/malloc_extension.h \
228
465
src/google/heap-profiler.h \
229
466
src/google/heap-checker.h \
230
467
src/google/stacktrace.h
231
SGP_TCMALLOC_INCLUDES = src/google/perftools/hash_set.h
232
TCMALLOC_INCLUDES = $(S_TCMALLOC_INCLUDES) $(SG_TCMALLOC_INCLUDES) $(SGP_TCMALLOC_INCLUDES)
468
TCMALLOC_INCLUDES = $(S_TCMALLOC_INCLUDES) $(SG_TCMALLOC_INCLUDES)
233
469
googleinclude_HEADERS += $(SG_TCMALLOC_INCLUDES)
234
perftoolsinclude_HEADERS += $(SGP_TCMALLOC_INCLUDES)
236
471
### Making the library
237
472
lib_LTLIBRARIES += libtcmalloc.la
473
# Note: heap-checker-bcad is last, in hopes its global ctor will run first
238
474
libtcmalloc_la_SOURCES = src/internal_logging.cc \
239
src/system-alloc.cc \
476
src/memfs_malloc.cc \
240
477
src/tcmalloc.cc \
241
478
src/malloc_hook.cc \
242
479
src/malloc_extension.cc \
243
src/maybe_threads.cc \
480
$(MAYBE_THREADS_CC) \
481
src/memory_region_map.cc \
244
482
src/heap-profiler.cc \
483
src/heap-profile-table.cc \
245
484
src/heap-checker.cc \
246
src/heap-checker-bcad.cc \
247
485
src/base/linuxthreads.c \
248
486
src/base/thread_lister.c \
250
libtcmalloc_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
251
TCMALLOC_SYMBOLS = '(malloc|free|realloc|calloc|cfree|memalign|valloc|pvalloc|posix_memalign|malloc_stats|MallocExtension|MallocHook|HeapProfilerStart|HeapProfilerStop|HeapProfilerDump|GetHeapProfile|HeapCleaner|HeapLeakChecker)'
252
libtcmalloc_la_LDFLAGS = $(PTHREAD_CFLAGS) -export-symbols-regex $(TCMALLOC_SYMBOLS)
253
libtcmalloc_la_LIBADD = $(PTHREAD_LIBS) libstacktrace.la
487
src/base/low_level_alloc.cc \
488
$(TCMALLOC_INCLUDES) \
489
src/heap-checker-bcad.cc
490
libtcmalloc_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG $(AM_CXXFLAGS)
491
libtcmalloc_la_LDFLAGS = $(PTHREAD_CFLAGS)
492
libtcmalloc_la_LIBADD = $(PTHREAD_LIBS) \
495
LIBTCMALLOC = libtcmalloc.la
256
TESTS += addressmap_unittest
257
ADDRESSMAP_UNITTEST_INCLUDES = src/addressmap-inl.h \
259
src/base/commandlineflags.h
260
addressmap_unittest_SOURCES = src/tests/addressmap_unittest.cc \
261
$(ADDRESSMAP_UNITTEST_INCLUDES)
262
addressmap_unittest_CXXFLAGS = -g
264
check_SCRIPTS += heap-profiler_unittest_sh
265
noinst_SCRIPTS += src/tests/heap-profiler_unittest.sh
500
TESTS += tcmalloc_unittest
501
TCMALLOC_UNITTEST_INCLUDES = src/config_for_unittests.h \
502
src/google/malloc_extension.h
503
tcmalloc_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
505
src/tests/testutil.h src/tests/testutil.cc \
506
$(TCMALLOC_UNITTEST_INCLUDES)
507
tcmalloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
508
tcmalloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
509
tcmalloc_unittest_LDADD = $(LIBTCMALLOC) liblogging.la $(PTHREAD_LIBS)
511
# This makes sure it's safe to link in both tcmalloc and
512
# tcmalloc_minimal. (One would never do this on purpose, but perhaps
513
# by accident...) When we can compile libprofiler, we also link it in
514
# to make sure that works too.
516
TESTS += tcmalloc_both_unittest
517
tcmalloc_both_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \
518
src/tests/testutil.h src/tests/testutil.cc \
519
$(TCMALLOC_UNITTEST_INCLUDES)
520
tcmalloc_both_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
521
tcmalloc_both_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
523
tcmalloc_both_unittest_LDADD = $(LIBTCMALLOC) $(LIBTCMALLOC_MINIMAL) \
524
libprofiler.la liblogging.la $(PTHREAD_LIBS)
526
tcmalloc_both_unittest_LDADD = $(LIBTCMALLOC) $(LIBTCMALLOC_MINIMAL) \
527
liblogging.la $(PTHREAD_LIBS)
530
TESTS += tcmalloc_large_unittest
531
tcmalloc_large_unittest_SOURCES = src/tests/tcmalloc_large_unittest.cc
532
tcmalloc_large_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
533
tcmalloc_large_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
534
tcmalloc_large_unittest_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS)
536
# These unittests often need to run binaries. They're in the current dir
537
TESTS_ENVIRONMENT += BINDIR=.
538
TESTS_ENVIRONMENT += TMPDIR=/tmp/perftools
540
TESTS += heap-profiler_unittest.sh
541
heap_profiler_unittest_sh_SOURCES = src/tests/heap-profiler_unittest.sh
542
noinst_SCRIPTS += $(heap_profiler_unittest_sh_SOURCES)
543
heap-profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) \
544
heap-profiler_unittest
546
cp -p $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) $@
267
548
# These are sub-programs used by heap-profiler_unittest.sh
268
HEAP_PROFILER_UNITTESTS = heap-profiler_unittest
269
heap-profiler_unittest_sh: $(HEAP_PROFILER_UNITTESTS)
270
$(top_srcdir)/src/tests/heap-profiler_unittest.sh . $(top_srcdir)/src
272
HEAP_PROFILER_UNITTEST_INCLUDES = src/google/heap-profiler.h
549
noinst_PROGRAMS += heap-profiler_unittest
550
HEAP_PROFILER_UNITTEST_INCLUDES = src/config_for_unittests.h \
551
src/google/heap-profiler.h
273
552
heap_profiler_unittest_SOURCES = src/tests/heap-profiler_unittest.cc \
274
553
$(HEAP_PROFILER_UNITTEST_INCLUDES)
275
heap_profiler_unittest_CXXFLAGS = -g
554
heap_profiler_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
276
555
heap_profiler_unittest_LDFLAGS = -g $(PTHREAD_CFLAGS)
277
heap_profiler_unittest_LDADD = libtcmalloc.la $(PTHREAD_LIBS)
279
check_SCRIPTS += heap_checker_unittest_sh
280
noinst_SCRIPTS += src/tests/heap-checker_unittest.sh
556
heap_profiler_unittest_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS)
558
TESTS += heap-checker_unittest.sh
559
heap_checker_unittest_sh_SOURCES = src/tests/heap-checker_unittest.sh
560
noinst_SCRIPTS += $(heap_checker_unittest_sh_SOURCES)
561
heap-checker_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) \
562
heap-checker_unittest
564
cp -p $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) $@
566
TESTS += heap-checker-death_unittest.sh
567
heap_checker_death_unittest_sh_SOURCES = src/tests/heap-checker-death_unittest.sh
568
noinst_SCRIPTS += $(top_srcdir)/$(heap_checker_death_unittest_sh_SOURCES)
569
heap-checker-death_unittest.sh$(EXEEXT): $(heap_checker_death_unittest_sh_SOURCES) \
570
heap-checker_unittest
572
cp -p $(top_srcdir)/$(heap_checker_death_unittest_sh_SOURCES) $@
282
574
# These are sub-programs used by heap-checker_unittest.sh
283
HEAP_CHECKER_UNITTESTS = heap-checker_unittest
284
heap_checker_unittest_sh: $(HEAP_CHECKER_UNITTESTS)
285
$(top_srcdir)/src/tests/heap-checker_unittest.sh . $(top_srcdir)/src
287
HEAP_CHECKER_UNITTEST_INCLUDES = src/config.h \
575
noinst_PROGRAMS += heap-checker_unittest
576
HEAP_CHECKER_UNITTEST_INCLUDES = src/config_for_unittests.h \
577
src/memory_region_map.h \
578
src/base/commandlineflags.h \
289
579
src/base/googleinit.h \
290
src/google/heap-profiler.h \
291
src/google/heap-checker.h
580
src/google/heap-checker.h \
292
582
heap_checker_unittest_SOURCES = src/tests/heap-checker_unittest.cc \
293
583
$(HEAP_CHECKER_UNITTEST_INCLUDES)
294
heap_checker_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS)
584
heap_checker_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
295
585
heap_checker_unittest_LDFLAGS = -g $(PTHREAD_CFLAGS)
296
586
# tcmalloc has to be specified last!
297
heap_checker_unittest_LDADD = $(PTHREAD_LIBS) -ltcmalloc
299
check_SCRIPTS += heap-checker-death_unittest
300
noinst_SCRIPTS += src/tests/heap-checker-death_unittest.sh
302
heap-checker-death_unittest:
303
PPROF_PATH=$(top_srcdir)/src/pprof sh $(top_srcdir)/src/tests/heap-checker-death_unittest.sh
587
heap_checker_unittest_LDADD = $(PTHREAD_LIBS) liblogging.la $(LIBTCMALLOC)
305
589
### Documentation (above and beyond tcmalloc_minimal documentation)
306
dist_doc_DATA += doc/heap_profiler.html \
590
dist_doc_DATA += doc/heapprofile.html \
307
591
doc/heap-example1.png \
308
592
doc/heap_checker.html
311
596
### ------- CPU profiler
598
# The CPU profiler doesn't work on windows yet. It also doesn't work
599
# if there's no way to get the PC.
313
603
### The header files we use. We divide into categories based on directory
314
S_CPU_PROFILER_INCLUDES = src/config.h \
604
S_CPU_PROFILER_INCLUDES = src/profiledata.h \
606
src/base/basictypes.h \
315
607
src/base/commandlineflags.h \
316
608
src/base/googleinit.h \
610
src/base/simple_mutex.h \
612
$(SPINLOCK_INCLUDES) \
318
614
SG_CPU_PROFILER_INCLUDES = src/google/profiler.h \
319
615
src/google/stacktrace.h
320
SGP_CPU_PROFILER_INCLUDES =
321
CPU_PROFILER_INCLUDES = $(S_CPU_PROFILER_INCLUDES) $(SG_CPU_PROFILER_INCLUDES) $(SGP_CPU_PROFILER_INCLUDES)
616
CPU_PROFILER_INCLUDES = $(S_CPU_PROFILER_INCLUDES) $(SG_CPU_PROFILER_INCLUDES)
322
617
googleinclude_HEADERS += $(SG_CPU_PROFILER_INCLUDES)
323
perftoolsinclude_HEADERS += $(SGP_CPU_PROFILER_INCLUDES)
325
619
### Making the library
326
620
lib_LTLIBRARIES += libprofiler.la
327
621
libprofiler_la_SOURCES = src/profiler.cc \
329
623
$(CPU_PROFILER_INCLUDES)
330
CPU_PROFILER_SYMBOLS = '(ProfilerStart|ProfilerStop|ProfilerEnable|ProfilerDisable|ProfilerFlush|ProfilerRegisterThread|ProfilerThreadState)'
624
libprofiler_la_LIBADD = libstacktrace.la
625
# We have to include ProfileData for profiledata_unittest
626
CPU_PROFILER_SYMBOLS = '(ProfilerStart|ProfilerStop|ProfilerEnable|ProfilerDisable|ProfilerFlush|ProfilerRegisterThread|ProfileData)'
331
627
libprofiler_la_LDFLAGS = -export-symbols-regex $(CPU_PROFILER_SYMBOLS)
629
# See discussion above (under LIBTCMALLOC_MINIMAL) for why we do this.
630
# Basically it's to work around systems where --rpath doesn't work right.
631
LIBPROFILER = libstacktrace.la libprofiler.la
334
check_SCRIPTS += profiler_unittest_sh pprof_unittest
335
noinst_SCRIPTS += src/tests/profiler_unittest.sh
635
#WINDOWS_PROJECTS += vsprojects/getpc_test/getpc_test.vcproj
636
getpc_test_SOURCES = src/tests/getpc_test.cc src/getpc.h
638
TESTS += profiledata_unittest
639
#WINDOWS_PROJECTS += vsprojects/profiledata_unittest/profiledata_unittest.vcproj
640
profiledata_unittest_SOURCES = src/tests/profiledata_unittest.cc \
642
src/base/commandlineflags.h \
644
src/base/basictypes.h
645
profiledata_unittest_LDADD = $(LIBPROFILER)
647
TESTS += profiler_unittest.sh
648
profiler_unittest_sh_SOURCES = src/tests/profiler_unittest.sh
649
noinst_SCRIPTS += $(profiler_unittest_sh_SOURCES)
650
profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(profiler_unittest_sh_SOURCES) \
651
profiler1_unittest profiler2_unittest \
652
profiler3_unittest profiler4_unittest
654
cp -p $(top_srcdir)/$(profiler_unittest_sh_SOURCES) $@
337
656
# These are sub-programs used by profiler_unittest.sh
338
PROFILER_UNITTESTS = profiler1_unittest profiler2_unittest profiler3_unittest \
340
profiler_unittest_sh: $(PROFILER_UNITTESTS)
341
$(top_srcdir)/src/tests/profiler_unittest.sh . $(top_srcdir)/src
343
PROFILER_UNITTEST_INCLUDES = src/config.h \
344
src/google/profiler.h
657
noinst_PROGRAMS += profiler1_unittest profiler2_unittest profiler3_unittest \
659
PROFILER_UNITTEST_INCLUDES = src/config_for_unittests.h \
660
src/google/profiler.h
345
661
PROFILER_UNITTEST_SRCS = src/tests/profiler_unittest.cc \
346
$(PROFILER_UNITTEST_INCLUDES)
662
src/tests/testutil.h src/tests/testutil.cc \
663
$(PROFILER_UNITTEST_INCLUDES)
347
664
profiler1_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS)
348
profiler1_unittest_CXXFLAGS = -g
349
profiler1_unittest_LDADD = libprofiler.la
665
profiler1_unittest_CXXFLAGS = -g -DNO_THREADS $(AM_CXXFLAGS)
666
profiler1_unittest_LDADD = $(LIBPROFILER)
350
667
profiler2_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS)
351
profiler2_unittest_CXXFLAGS = -g
352
profiler2_unittest_LDADD = -lprofiler
668
profiler2_unittest_CXXFLAGS = -g -DNO_THREADS $(AM_CXXFLAGS)
669
profiler2_unittest_LDADD = -lstacktrace -lprofiler
670
# We depend on -lprofiler but haven't yet said how to build it. Do so now.
671
profiler2_unittest_DEPENDENCIES = $(LIBPROFILER)
353
672
profiler3_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS)
354
profiler3_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) -DWITH_THREADS
673
profiler3_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
355
674
profiler3_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
356
profiler3_unittest_LDADD = libprofiler.la $(PTHREAD_LIBS)
675
profiler3_unittest_LDADD = $(LIBPROFILER) $(PTHREAD_LIBS)
357
676
profiler4_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS)
358
profiler4_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) -DWITH_THREADS
677
profiler4_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
359
678
profiler4_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
360
profiler4_unittest_LDADD = -lprofiler $(PTHREAD_LIBS)
679
profiler4_unittest_LDADD = -lstacktrace -lprofiler $(PTHREAD_LIBS)
680
# We depend on -lprofiler but haven't yet said how to build it. Do so now.
681
profiler4_unittest_DEPENDENCIES = $(LIBPROFILER)
362
pprof_unittest: $(top_srcdir)/src/pprof
365
684
### Documentation
366
dist_man_MANS = doc/pprof.1
367
dist_doc_DATA += doc/cpu_profiler.html \
685
dist_doc_DATA += doc/cpuprofile.html \
686
doc/cpuprofile-fileformat.html \
368
687
doc/pprof-test-big.gif \
369
688
doc/pprof-test.gif \
370
689
doc/pprof-vsnprintf-big.gif \
371
690
doc/pprof-vsnprintf.gif
373
695
## ^^^^ END OF RULES TO MAKE YOUR LIBRARIES, BINARIES, AND UNITTESTS
376
698
# This should always include $(TESTS), but may also include other
377
699
# binaries that you compile but don't want automatically installed.
378
700
# We'll add to this later, on a library-by-library basis
379
noinst_PROGRAMS = $(TESTS) $(PROFILER_UNITTESTS) $(HEAP_PROFILER_UNITTESTS) \
380
$(HEAP_CHECKER_UNITTESTS)
381
bin_SCRIPTS = src/pprof
701
noinst_PROGRAMS += $(TESTS)
383
703
rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
384
704
@cd packages && ./rpm.sh ${PACKAGE} ${VERSION}