Austin Schuh | 745610d | 2015-09-06 18:19:50 -0700 | [diff] [blame] | 1 | ## Process this file with automake to produce Makefile.in |
| 2 | |
| 3 | # Note: for every library we create, we're explicit about what symbols |
| 4 | # we export. In order to avoid complications with C++ mangling, we always |
| 5 | # use the regexp for of specifying symbols. |
| 6 | |
| 7 | # Make sure that when we re-make ./configure, we get the macros we need |
| 8 | ACLOCAL_AMFLAGS = -I m4 |
| 9 | AUTOMAKE_OPTIONS = subdir-objects |
| 10 | |
| 11 | # This is so we can #include <gperftools/foo> |
| 12 | AM_CPPFLAGS = -I$(top_srcdir)/src |
| 13 | |
| 14 | if !WITH_STACK_TRACE |
| 15 | AM_CPPFLAGS += -DNO_TCMALLOC_SAMPLES |
| 16 | endif !WITH_STACK_TRACE |
| 17 | |
| 18 | # This is mostly based on configure options |
| 19 | AM_CXXFLAGS = |
| 20 | |
| 21 | NO_BUILTIN_CXXFLAGS = |
| 22 | |
| 23 | # These are good warnings to turn on by default. We also tell gcc |
| 24 | # that malloc, free, realloc, mmap, etc. are not builtins (these flags |
| 25 | # are supported since gcc 3.1.1). gcc doesn't think most of them are |
| 26 | # builtins now in any case, but it's best to be explicit in case that |
| 27 | # changes one day. gcc ignores functions it doesn't understand. |
| 28 | if GCC |
| 29 | AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual \ |
| 30 | -Wno-sign-compare \ |
| 31 | -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc \ |
| 32 | -fno-builtin-calloc -fno-builtin-cfree \ |
| 33 | -fno-builtin-memalign -fno-builtin-posix_memalign \ |
| 34 | -fno-builtin-valloc -fno-builtin-pvalloc |
| 35 | |
| 36 | NO_BUILTIN_CXXFLAGS += -fno-builtin |
| 37 | |
| 38 | # On i386, -mmmx is needed for the mmx-based instructions in |
| 39 | # atomicops-internal-x86.h. Also as of gcc 4.6, -fomit-frame-pointer |
| 40 | # is the default. Since we must always have frame pointers for I386 |
| 41 | # in order to generate backtraces we now specify -fno-omit-frame-pointer |
| 42 | # by default. |
| 43 | if I386 |
| 44 | AM_CXXFLAGS += -mmmx |
| 45 | AM_CXXFLAGS += -fno-omit-frame-pointer |
| 46 | endif I386 |
| 47 | endif GCC |
| 48 | if HAVE_W_NO_UNUSED_RESULT |
| 49 | AM_CXXFLAGS += -Wno-unused-result |
| 50 | endif HAVE_W_NO_UNUSED_RESULT |
| 51 | |
| 52 | # The -no-undefined flag allows libtool to generate shared libraries for |
| 53 | # Cygwin and MinGW. LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug. |
| 54 | AM_LDFLAGS = -no-undefined $(LIBSTDCXX_LA_LINKER_FLAG) |
| 55 | |
| 56 | # We know our low-level code cannot trigger an exception. On some |
| 57 | # systems, such as cygwin, it would be disastrous if they did, because |
| 58 | # the exception handler might call malloc! If our low-level routines |
| 59 | # raised an exception within the malloc, they'd deadlock. Luckily, |
| 60 | # we control all this code, and do not need exceptions for it. |
| 61 | if GCC |
| 62 | NO_EXCEPTIONS = -fno-exceptions |
| 63 | else !GCC |
| 64 | NO_EXCEPTIONS = |
| 65 | endif !GCC |
| 66 | |
| 67 | # These are x86-specific, having to do with frame-pointers. In |
| 68 | # particular, some x86_64 systems do not insert frame pointers by |
| 69 | # default (all i386 systems that I know of, do. I don't know about |
| 70 | # non-x86 chips). We need to tell perftools what to do about that. |
| 71 | if X86_64_AND_NO_FP_BY_DEFAULT |
| 72 | if ENABLE_FRAME_POINTERS |
| 73 | AM_CXXFLAGS += -fno-omit-frame-pointer |
| 74 | else |
| 75 | # TODO(csilvers): check if -fomit-frame-pointer might be in $(CXXFLAGS), |
| 76 | # before setting this. |
| 77 | AM_CXXFLAGS += -DNO_FRAME_POINTER |
| 78 | endif !ENABLE_FRAME_POINTERS |
| 79 | endif X86_64_AND_NO_FP_BY_DEFAULT |
| 80 | |
| 81 | # For windows systems (at least, mingw), we need to tell all our |
| 82 | # tests to link in libtcmalloc using -u. This is because libtcmalloc |
| 83 | # accomplishes its tasks via patching, leaving no work for the linker |
| 84 | # to identify, so the linker will ignore libtcmalloc by default unless |
| 85 | # we explicitly create a dependency via -u. |
| 86 | TCMALLOC_FLAGS = |
| 87 | if MINGW |
| 88 | TCMALLOC_FLAGS += -Wl,-u__tcmalloc |
| 89 | endif MINGW |
| 90 | |
| 91 | # If we have objcopy, make malloc/free/etc weak symbols. That way folks |
| 92 | # can override our malloc if they want to (they can still use tc_malloc). |
| 93 | # Note: the weird-looking symbols are the c++ memory functions: |
| 94 | # (in order) new, new(nothrow), new[], new[](nothrow), delete, delete[] |
| 95 | # In theory this will break if mangling changes, but that seems pretty |
| 96 | # unlikely at this point. Just in case, I throw in versions with an |
| 97 | # extra underscore as well, which may help on OS X. |
| 98 | if HAVE_OBJCOPY_WEAKEN |
| 99 | WEAKEN = $(OBJCOPY) -W malloc -W free -W realloc -W calloc -W cfree \ |
| 100 | -W memalign -W posix_memalign -W valloc -W pvalloc \ |
| 101 | -W malloc_stats -W mallopt -W mallinfo \ |
| 102 | -W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t \ |
| 103 | -W _ZdlPv -W _ZdaPv \ |
| 104 | -W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t \ |
| 105 | -W __ZdlPv -W __ZdaPv |
| 106 | else |
| 107 | WEAKEN = : |
| 108 | endif !HAVE_OBJCOPY_WEAKEN |
| 109 | |
| 110 | LIBS_TO_WEAKEN = |
| 111 | |
| 112 | perftoolsincludedir = $(includedir)/gperftools |
| 113 | # The .h files you want to install (that is, .h files that people |
| 114 | # who install this package can include in their own applications.) |
| 115 | # We'll add to this later, on a library-by-library basis |
| 116 | perftoolsinclude_HEADERS = |
| 117 | # tcmalloc.h is a special case, because it's a .h.in file |
| 118 | nodist_perftoolsinclude_HEADERS = src/gperftools/tcmalloc.h |
| 119 | noinst_HEADERS = src/gperftools/tcmalloc.h.in |
| 120 | |
| 121 | # This is provided for backwards compatibility. It is populated by |
| 122 | # files that just forward to the canonical location in |
| 123 | # perftoolsincludedir. |
| 124 | googleincludedir = $(includedir)/google |
| 125 | googleinclude_HEADERS = \ |
| 126 | src/google/heap-checker.h \ |
| 127 | src/google/heap-profiler.h \ |
| 128 | src/google/malloc_extension.h \ |
| 129 | src/google/malloc_extension_c.h \ |
| 130 | src/google/malloc_hook.h \ |
| 131 | src/google/malloc_hook_c.h \ |
| 132 | src/google/profiler.h \ |
| 133 | src/google/stacktrace.h \ |
| 134 | src/google/tcmalloc.h |
| 135 | |
| 136 | docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) |
| 137 | # This is for HTML and other documentation you want to install. |
| 138 | # Add your documentation files (in doc/) in addition to these |
| 139 | # top-level boilerplate files. Also add a TODO file if you have one. |
| 140 | # We'll add to this later, on a library-by-library basis |
| 141 | dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README README_windows.txt \ |
| 142 | TODO |
| 143 | |
| 144 | # The libraries (.so's) you want to install |
| 145 | # We'll add to this later, on a library-by-library basis |
| 146 | lib_LTLIBRARIES = |
| 147 | # This is for 'convenience libraries' -- basically just a container for sources |
| 148 | noinst_LTLIBRARIES = |
| 149 | ## The location of the windows project file for each binary we make |
| 150 | WINDOWS_PROJECTS = gperftools.sln |
| 151 | |
| 152 | # unittests you want to run when people type 'make check'. |
| 153 | # Note: tests cannot take any arguments! |
| 154 | # In theory, unittests that are scripts should be added to check_SCRIPTS |
| 155 | # instead. But check_SCRIPTS is definitely a second-class testing mechanims: |
| 156 | # it don't get TESTS_ENVIRONMENT, and it doesn't get success/failure counting |
| 157 | # (in fact, a script failure aborts all the rest of the tests, even with -k). |
| 158 | # So, for scripts, we add the script to tests, and also put in an empty |
| 159 | # rule so automake doesn't try to build the script as a C binary. |
| 160 | TESTS = |
| 161 | # TESTS_ENVIRONMENT sets environment variables for when you run unittest. |
| 162 | # We always get "srcdir" set for free. |
| 163 | # We'll add to this later, on a library-by-library basis. |
| 164 | TESTS_ENVIRONMENT = |
| 165 | # All script tests should be added here |
| 166 | noinst_SCRIPTS = |
| 167 | # If your test calls another program that, like the test itself, shouldn't |
| 168 | # be installed, add it here. (Stuff in TESTS is automatically added later). |
| 169 | noinst_PROGRAMS = |
| 170 | |
| 171 | # Binaries we might build that should be installed |
| 172 | bin_PROGRAMS = |
| 173 | |
| 174 | # This is my own var, used for extra libraries I make that I need installed |
| 175 | EXTRA_INSTALL = |
| 176 | |
| 177 | ## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS |
| 178 | |
| 179 | dist_doc_DATA += doc/index.html doc/designstyle.css |
| 180 | |
| 181 | |
| 182 | ### ------- library routines, in src/base |
| 183 | |
| 184 | # This is a 'convenience library' -- it's not actually installed or anything |
| 185 | LOGGING_INCLUDES = src/base/logging.h \ |
| 186 | src/base/commandlineflags.h \ |
| 187 | src/base/basictypes.h \ |
| 188 | src/base/dynamic_annotations.h \ |
| 189 | src/third_party/valgrind.h |
| 190 | noinst_LTLIBRARIES += liblogging.la |
| 191 | liblogging_la_SOURCES = src/base/logging.cc \ |
| 192 | src/base/dynamic_annotations.c \ |
| 193 | $(LOGGING_INCLUDES) |
| 194 | |
| 195 | SYSINFO_INCLUDES = src/base/sysinfo.h \ |
| 196 | src/getenv_safe.h \ |
| 197 | src/base/logging.h \ |
| 198 | src/base/commandlineflags.h \ |
| 199 | src/base/cycleclock.h \ |
| 200 | src/base/arm_instruction_set_select.h \ |
| 201 | src/base/basictypes.h |
| 202 | noinst_LTLIBRARIES += libsysinfo.la |
| 203 | libsysinfo_la_SOURCES = src/base/sysinfo.cc \ |
| 204 | $(SYSINFO_INCLUDES) |
| 205 | libsysinfo_la_LIBADD = $(NANOSLEEP_LIBS) |
| 206 | |
| 207 | noinst_LTLIBRARIES += libmaybe_threads.la |
| 208 | # .cc is conditionally added below |
| 209 | libmaybe_threads_la_SOURCES = src/maybe_threads.h |
| 210 | |
| 211 | # For MinGW, we use also have to use libwindows Luckily, we need the |
| 212 | # windows.a library in exactly the same place we need spinlock.a |
| 213 | # (pretty much everywhere), so we can use the same variable name for |
| 214 | # each. We can also optimize the MinGW rule a bit by leaving out |
| 215 | # files we know aren't used on windows, such as |
| 216 | # atomicops-internals-x86.cc. libwindows also obsoletes the need for |
| 217 | # other files like system_alloc.cc. |
| 218 | if MINGW |
| 219 | WINDOWS_INCLUDES = src/windows/port.h \ |
| 220 | src/windows/mingw.h \ |
| 221 | src/windows/mini_disassembler.h \ |
| 222 | src/windows/mini_disassembler_types.h \ |
| 223 | src/windows/preamble_patcher.h |
| 224 | noinst_LTLIBRARIES += libwindows.la |
| 225 | libwindows_la_SOURCES = $(WINDOWS_INCLUDES) \ |
| 226 | src/windows/port.cc \ |
| 227 | src/windows/system-alloc.cc \ |
| 228 | src/windows/ia32_modrm_map.cc \ |
| 229 | src/windows/ia32_opcode_map.cc \ |
| 230 | src/windows/mini_disassembler.cc \ |
| 231 | src/windows/patch_functions.cc \ |
| 232 | src/windows/preamble_patcher.cc \ |
| 233 | src/windows/preamble_patcher_with_stub.cc |
| 234 | # patch_functions.cc uses Psapi.lib. MSVC has a #pragma for that, but not us. |
| 235 | libwindows_la_LIBADD = -lpsapi |
| 236 | |
| 237 | SPINLOCK_INCLUDES = src/base/spinlock.h \ |
| 238 | src/base/spinlock_internal.h \ |
| 239 | src/base/spinlock_win32-inl.h \ |
| 240 | src/base/spinlock_linux-inl.h \ |
| 241 | src/base/spinlock_posix-inl.h \ |
| 242 | src/base/synchronization_profiling.h \ |
| 243 | src/base/atomicops-internals-macosx.h \ |
| 244 | src/base/atomicops-internals-linuxppc.h \ |
| 245 | src/base/atomicops-internals-arm-generic.h \ |
| 246 | src/base/atomicops-internals-arm-v6plus.h \ |
| 247 | src/base/atomicops-internals-mips.h \ |
| 248 | src/base/atomicops-internals-windows.h \ |
| 249 | src/base/atomicops-internals-gcc.h \ |
| 250 | src/base/atomicops-internals-x86.h |
| 251 | noinst_LTLIBRARIES += libspinlock.la |
| 252 | libspinlock_la_SOURCES = src/base/spinlock.cc \ |
| 253 | src/base/spinlock_internal.cc \ |
| 254 | src/base/atomicops-internals-x86.cc \ |
| 255 | $(SPINLOCK_INCLUDES) |
| 256 | |
| 257 | LIBSPINLOCK = libwindows.la libspinlock.la libsysinfo.la liblogging.la |
| 258 | |
| 259 | # We also need to tell mingw that sysinfo.cc needs shlwapi.lib. |
| 260 | # (We do this via a #pragma for msvc, but need to do it here for mingw). |
| 261 | libsysinfo_la_LIBADD += -lshlwapi |
| 262 | |
| 263 | # There's a windows-specific unittest we can run. Right now it's |
| 264 | # win64-specific, and relies on masm, so we comment it out. |
| 265 | ## TESTS += preamble_patcher_test |
| 266 | ## preamble_patcher_test_SOURCES = src/windows/preamble_patcher_test.cc \ |
| 267 | ## src/windows/shortproc.asm \ |
| 268 | ## src/windows/auto_testing_hook.h \ |
| 269 | ## src/windows/preamble_patcher.h \ |
| 270 | ## src/base/basictypes.h \ |
| 271 | ## src/base/logging.h |
| 272 | ## preamble_patcher_test_LDFLAGS = $(TCMALLOC_FLAGS) |
| 273 | ## preamble_patcher_test_LDADD = $(LIBTCMALLOC_MINIMAL) |
| 274 | |
| 275 | # patch_functions.cc #includes tcmalloc.cc, so no need to link it in. |
| 276 | TCMALLOC_CC = |
| 277 | # windows has its own system for threads and system memory allocation. |
| 278 | if HAVE_PTHREAD_DESPITE_ASKING_FOR |
| 279 | libmaybe_threads_la_SOURCES += src/maybe_threads.cc |
| 280 | endif |
| 281 | SYSTEM_ALLOC_CC = |
| 282 | else !MINGW |
| 283 | # spinlock is the only code that uses atomicops. |
| 284 | SPINLOCK_INCLUDES = src/base/spinlock.h \ |
| 285 | src/base/spinlock_internal.h \ |
| 286 | src/base/atomicops.h \ |
| 287 | src/base/atomicops-internals-macosx.h \ |
| 288 | src/base/atomicops-internals-linuxppc.h \ |
| 289 | src/base/atomicops-internals-windows.h \ |
| 290 | src/base/atomicops-internals-x86.h |
| 291 | |
| 292 | noinst_LTLIBRARIES += libspinlock.la |
| 293 | libspinlock_la_SOURCES = src/base/spinlock.cc \ |
| 294 | src/base/spinlock_internal.cc \ |
| 295 | src/base/atomicops-internals-x86.cc \ |
| 296 | $(SPINLOCK_INCLUDES) |
| 297 | libspinlock_la_LIBADD = $(NANOSLEEP_LIBS) |
| 298 | # spinlock also needs NumCPUs, from libsysinfo, which in turn needs liblogging |
| 299 | LIBSPINLOCK = libspinlock.la libsysinfo.la liblogging.la |
| 300 | |
| 301 | TCMALLOC_CC = src/tcmalloc.cc |
| 302 | libmaybe_threads_la_SOURCES += src/maybe_threads.cc |
| 303 | SYSTEM_ALLOC_CC = src/system-alloc.cc |
| 304 | endif !MINGW |
| 305 | |
| 306 | # Add this whether or not we're under MinGW, to keep the tarball complete. |
| 307 | WINDOWS_PROJECTS += vsprojects/preamble_patcher_test/preamble_patcher_test.vcproj |
| 308 | # Because we've commented out the test, above, we have to explicitly add |
| 309 | # the test files to the tarball or automake will leave them out. |
| 310 | WINDOWS_PROJECTS += src/windows/preamble_patcher_test.cc \ |
| 311 | src/windows/shortproc.asm \ |
| 312 | src/windows/auto_testing_hook.h |
| 313 | |
| 314 | ### Unittests |
| 315 | TESTS += low_level_alloc_unittest |
| 316 | WINDOWS_PROJECTS += vsprojects/low_level_alloc_unittest/low_level_alloc_unittest.vcproj |
| 317 | LOW_LEVEL_ALLOC_UNITTEST_INCLUDES = src/base/low_level_alloc.h \ |
| 318 | src/base/basictypes.h \ |
| 319 | src/gperftools/malloc_hook.h \ |
| 320 | src/gperftools/malloc_hook_c.h \ |
| 321 | src/malloc_hook-inl.h \ |
| 322 | src/malloc_hook_mmap_linux.h \ |
| 323 | src/malloc_hook_mmap_freebsd.h \ |
| 324 | $(SPINLOCK_INCLUDES) \ |
| 325 | $(LOGGING_INCLUDES) |
| 326 | low_level_alloc_unittest_SOURCES = src/base/low_level_alloc.cc \ |
| 327 | src/malloc_hook.cc \ |
| 328 | src/tests/low_level_alloc_unittest.cc \ |
| 329 | $(LOW_LEVEL_ALLOC_UNITTEST_INCLUDES) |
| 330 | # By default, MallocHook takes stack traces for use by the heap-checker. |
| 331 | # We don't need that functionality here, so we turn it off to reduce deps. |
| 332 | low_level_alloc_unittest_CXXFLAGS = -DNO_TCMALLOC_SAMPLES |
| 333 | low_level_alloc_unittest_LDADD = $(LIBSPINLOCK) libmaybe_threads.la |
| 334 | |
| 335 | TESTS += atomicops_unittest |
| 336 | ATOMICOPS_UNITTEST_INCLUDES = src/base/atomicops.h \ |
| 337 | src/base/atomicops-internals-macosx.h \ |
| 338 | src/base/atomicops-internals-windows.h \ |
| 339 | src/base/atomicops-internals-x86.h \ |
| 340 | $(LOGGING_INCLUDES) |
| 341 | atomicops_unittest_SOURCES = src/tests/atomicops_unittest.cc \ |
| 342 | $(ATOMICOPS_UNITTEST_INCLUDES) |
| 343 | atomicops_unittest_LDADD = $(LIBSPINLOCK) |
| 344 | |
| 345 | |
| 346 | ### ------- stack trace |
| 347 | |
| 348 | if WITH_STACK_TRACE |
| 349 | |
| 350 | ### The header files we use. We divide into categories based on directory |
| 351 | S_STACKTRACE_INCLUDES = src/stacktrace_impl_setup-inl.h \ |
| 352 | src/stacktrace_generic-inl.h \ |
| 353 | src/stacktrace_libunwind-inl.h \ |
| 354 | src/stacktrace_arm-inl.h \ |
| 355 | src/stacktrace_powerpc-inl.h \ |
| 356 | src/stacktrace_powerpc-darwin-inl.h \ |
| 357 | src/stacktrace_powerpc-linux-inl.h \ |
| 358 | src/stacktrace_x86-inl.h \ |
| 359 | src/stacktrace_win32-inl.h \ |
| 360 | src/stacktrace_instrument-inl.h \ |
| 361 | src/base/elf_mem_image.h \ |
| 362 | src/base/vdso_support.h |
| 363 | |
| 364 | SG_STACKTRACE_INCLUDES = src/gperftools/stacktrace.h |
| 365 | STACKTRACE_INCLUDES = $(S_STACKTRACE_INCLUDES) $(SG_STACKTRACE_INCLUDES) |
| 366 | perftoolsinclude_HEADERS += $(SG_STACKTRACE_INCLUDES) |
| 367 | |
| 368 | ### Making the library |
| 369 | noinst_LTLIBRARIES += libstacktrace.la |
| 370 | libstacktrace_la_SOURCES = src/stacktrace.cc \ |
| 371 | src/base/elf_mem_image.cc \ |
| 372 | src/base/vdso_support.cc \ |
| 373 | $(STACKTRACE_INCLUDES) |
| 374 | libstacktrace_la_LIBADD = $(UNWIND_LIBS) $(LIBSPINLOCK) |
| 375 | STACKTRACE_SYMBOLS = '(GetStackTrace|GetStackFrames|GetStackTraceWithContext|GetStackFramesWithContext)' |
| 376 | libstacktrace_la_LDFLAGS = -export-symbols-regex $(STACKTRACE_SYMBOLS) $(AM_LDFLAGS) |
| 377 | |
| 378 | ### Unittests |
| 379 | TESTS += stacktrace_unittest |
| 380 | STACKTRACE_UNITTEST_INCLUDES = src/config_for_unittests.h \ |
| 381 | src/base/commandlineflags.h \ |
| 382 | $(STACKTRACE_INCLUDES) \ |
| 383 | $(LOGGING_INCLUDES) |
| 384 | stacktrace_unittest_SOURCES = src/tests/stacktrace_unittest.cc \ |
| 385 | $(STACKTRACE_UNITTEST_INCLUDES) |
| 386 | stacktrace_unittest_LDADD = libstacktrace.la liblogging.la |
| 387 | |
| 388 | ### Documentation |
| 389 | dist_doc_DATA += |
| 390 | |
| 391 | endif WITH_STACK_TRACE |
| 392 | |
| 393 | ### ------- pprof |
| 394 | |
| 395 | # If we are not compiling with stacktrace support, pprof is worthless |
| 396 | if WITH_STACK_TRACE |
| 397 | |
| 398 | bin_SCRIPTS = src/pprof |
| 399 | |
| 400 | ### Unittests |
| 401 | |
| 402 | check_SCRIPTS = pprof_unittest |
| 403 | pprof_unittest: $(top_srcdir)/src/pprof |
| 404 | $(top_srcdir)/src/pprof -test |
| 405 | |
| 406 | # Let unittests find pprof if they need to run it |
| 407 | TESTS_ENVIRONMENT += PPROF_PATH=$(top_srcdir)/src/pprof |
| 408 | |
| 409 | ### Documentation |
| 410 | dist_man_MANS = doc/pprof.1 |
| 411 | dist_doc_DATA += doc/pprof_remote_servers.html |
| 412 | |
| 413 | # On MSVC, we need our own versions of addr2line and nm to work with pprof. |
| 414 | WINDOWS_PROJECTS += vsprojects/nm-pdb/nm-pdb.vcproj |
| 415 | WINDOWS_PROJECTS += vsprojects/addr2line-pdb/addr2line-pdb.vcproj |
| 416 | # This is a slight abuse of WINDOWS_PROJECTS, but not much |
| 417 | WINDOWS_PROJECTS += src/windows/nm-pdb.c \ |
| 418 | src/windows/addr2line-pdb.c |
| 419 | |
| 420 | endif WITH_STACK_TRACE |
| 421 | |
| 422 | ### ------- tcmalloc_minimal (thread-caching malloc) |
| 423 | |
| 424 | ### The header files we use. We divide into categories based on directory |
| 425 | S_TCMALLOC_MINIMAL_INCLUDES = src/common.h \ |
| 426 | src/internal_logging.h \ |
| 427 | src/system-alloc.h \ |
| 428 | src/packed-cache-inl.h \ |
| 429 | $(SPINLOCK_INCLUDES) \ |
| 430 | src/tcmalloc_guard.h \ |
| 431 | src/base/commandlineflags.h \ |
| 432 | src/base/basictypes.h \ |
| 433 | src/pagemap.h \ |
| 434 | src/sampler.h \ |
| 435 | src/central_freelist.h \ |
| 436 | src/linked_list.h \ |
| 437 | src/libc_override.h \ |
| 438 | src/libc_override_gcc_and_weak.h \ |
| 439 | src/libc_override_glibc.h \ |
| 440 | src/libc_override_osx.h \ |
| 441 | src/libc_override_redefine.h \ |
| 442 | src/page_heap.h \ |
| 443 | src/page_heap_allocator.h \ |
| 444 | src/span.h \ |
| 445 | src/static_vars.h \ |
| 446 | src/symbolize.h \ |
| 447 | src/thread_cache.h \ |
| 448 | src/stack_trace_table.h \ |
| 449 | src/base/thread_annotations.h \ |
| 450 | src/malloc_hook-inl.h \ |
| 451 | src/malloc_hook_mmap_linux.h \ |
| 452 | src/malloc_hook_mmap_freebsd.h |
| 453 | SG_TCMALLOC_MINIMAL_INCLUDES = src/gperftools/malloc_hook.h \ |
| 454 | src/gperftools/malloc_hook_c.h \ |
| 455 | src/gperftools/malloc_extension.h \ |
| 456 | src/gperftools/malloc_extension_c.h |
| 457 | TCMALLOC_MINIMAL_INCLUDES = $(S_TCMALLOC_MINIMAL_INCLUDES) $(SG_TCMALLOC_MINIMAL_INCLUDES) $(SG_STACKTRACE_INCLUDES) |
| 458 | perftoolsinclude_HEADERS += $(SG_TCMALLOC_MINIMAL_INCLUDES) |
| 459 | |
| 460 | ### Making the library |
| 461 | |
| 462 | # As we describe at the top of this file, we want to turn off exceptions |
| 463 | # for all files in this library -- except tcmalloc.cc which needs them |
| 464 | # to fulfill its API. Automake doesn't allow per-file CXXFLAGS, so we need |
| 465 | # to separate into two libraries. |
| 466 | noinst_LTLIBRARIES += libtcmalloc_minimal_internal.la |
| 467 | libtcmalloc_minimal_internal_la_SOURCES = src/common.cc \ |
| 468 | src/internal_logging.cc \ |
| 469 | $(SYSTEM_ALLOC_CC) \ |
| 470 | src/memfs_malloc.cc \ |
| 471 | src/central_freelist.cc \ |
| 472 | src/page_heap.cc \ |
| 473 | src/sampler.cc \ |
| 474 | src/span.cc \ |
| 475 | src/stack_trace_table.cc \ |
| 476 | src/static_vars.cc \ |
| 477 | src/symbolize.cc \ |
| 478 | src/thread_cache.cc \ |
| 479 | src/malloc_hook.cc \ |
| 480 | src/malloc_extension.cc \ |
| 481 | $(TCMALLOC_MINIMAL_INCLUDES) |
| 482 | # We #define NO_TCMALLOC_SAMPLES, since sampling is turned off for _minimal. |
| 483 | libtcmalloc_minimal_internal_la_CXXFLAGS = -DNO_TCMALLOC_SAMPLES \ |
| 484 | -DNO_HEAP_CHECK \ |
| 485 | $(PTHREAD_CFLAGS) -DNDEBUG \ |
| 486 | $(AM_CXXFLAGS) $(NO_EXCEPTIONS) |
| 487 | libtcmalloc_minimal_internal_la_LDFLAGS = $(PTHREAD_CFLAGS) $(AM_LDFLAGS) |
| 488 | libtcmalloc_minimal_internal_la_LIBADD = $(PTHREAD_LIBS) $(LIBSPINLOCK) libmaybe_threads.la |
| 489 | |
| 490 | lib_LTLIBRARIES += libtcmalloc_minimal.la |
| 491 | WINDOWS_PROJECTS += vsprojects/libtcmalloc_minimal/libtcmalloc_minimal.vcproj |
| 492 | libtcmalloc_minimal_la_SOURCES = $(TCMALLOC_CC) $(TCMALLOC_MINIMAL_INCLUDES) |
| 493 | libtcmalloc_minimal_la_CXXFLAGS = -DNO_TCMALLOC_SAMPLES \ |
| 494 | $(PTHREAD_CFLAGS) -DNDEBUG $(AM_CXXFLAGS) |
| 495 | # -version-info gets passed to libtool |
| 496 | libtcmalloc_minimal_la_LDFLAGS = $(PTHREAD_CFLAGS) -version-info @TCMALLOC_SO_VERSION@ $(AM_LDFLAGS) |
| 497 | libtcmalloc_minimal_la_LIBADD = libtcmalloc_minimal_internal.la $(PTHREAD_LIBS) |
| 498 | |
| 499 | # For windows, we're playing around with trying to do some stacktrace |
| 500 | # support even with libtcmalloc_minimal. For everyone else, though, |
| 501 | # we turn off all stack-trace activity for libtcmalloc_minimal. |
| 502 | # TODO(csilvers): when we're done experimenting, do something principled here |
| 503 | if MINGW |
| 504 | LIBTCMALLOC_MINIMAL = libtcmalloc_minimal.la libstacktrace.la |
| 505 | else !MINGW |
| 506 | LIBTCMALLOC_MINIMAL = libtcmalloc_minimal.la |
| 507 | endif !MINGW |
| 508 | |
| 509 | LIBS_TO_WEAKEN += libtcmalloc_minimal.la |
| 510 | |
| 511 | ### Unittests |
| 512 | |
| 513 | # Commented out for the moment because malloc(very_big_num) is broken in |
| 514 | # standard libc! At least, in some situations, some of the time. |
| 515 | ## TESTS += malloc_unittest |
| 516 | ## MALLOC_UNITEST_INCLUDES = src/gperftools/malloc_extension.h \ |
| 517 | ## src/gperftools/malloc_hook.h \ |
| 518 | ## src/gperftools/malloc_hook_c.h \ |
| 519 | ## src/malloc_hook-inl.h \ |
| 520 | ## src/malloc_hook_mmap_linux.h \ |
| 521 | ## src/malloc_hook_mmap_freebsd.h \ |
| 522 | ## src/base/basictypes.h \ |
| 523 | ## src/maybe_threads.h |
| 524 | ## malloc_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \ |
| 525 | ## src/malloc_hook.cc \ |
| 526 | ## src/malloc_extension.cc \ |
| 527 | ## $(MAYBE_THREADS_CC) \ |
| 528 | ## $(MALLOC_UNITTEST_INCLUDES) |
| 529 | ## malloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 530 | ## malloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS) |
| 531 | ## malloc_unittest_LDADD = $(PTHREAD_LIBS) |
| 532 | |
| 533 | TESTS += tcmalloc_minimal_unittest |
| 534 | WINDOWS_PROJECTS += vsprojects/tcmalloc_minimal_unittest/tcmalloc_minimal_unittest.vcproj |
| 535 | WINDOWS_PROJECTS += vsprojects/tmu-static/tmu-static.vcproj |
| 536 | tcmalloc_minimal_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \ |
| 537 | src/tests/testutil.h src/tests/testutil.cc \ |
| 538 | $(TCMALLOC_UNITTEST_INCLUDES) |
| 539 | tcmalloc_minimal_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 540 | tcmalloc_minimal_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 541 | # We want libtcmalloc last on the link line, but due to a bug in |
| 542 | # libtool involving convenience libs, they need to come last on the |
| 543 | # link line in order to get dependency ordering right. This is ok: |
| 544 | # convenience libraries are .a's, so tcmalloc is still the last .so. |
| 545 | # We also put pthreads after tcmalloc, because some pthread |
| 546 | # implementations define their own malloc, and we need to go on the |
| 547 | # first linkline to make sure our malloc 'wins'. |
| 548 | tcmalloc_minimal_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) \ |
| 549 | liblogging.la $(PTHREAD_LIBS) |
| 550 | |
| 551 | TESTS += tcmalloc_minimal_large_unittest |
| 552 | WINDOWS_PROJECTS += vsprojects/tcmalloc_minimal_large/tcmalloc_minimal_large_unittest.vcproj |
| 553 | tcmalloc_minimal_large_unittest_SOURCES = src/tests/tcmalloc_large_unittest.cc |
| 554 | tcmalloc_minimal_large_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 555 | tcmalloc_minimal_large_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 556 | tcmalloc_minimal_large_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 557 | |
| 558 | TESTS += tcmalloc_minimal_large_heap_fragmentation_unittest |
| 559 | tcmalloc_minimal_large_heap_fragmentation_unittest_SOURCES = src/tests/large_heap_fragmentation_unittest.cc |
| 560 | tcmalloc_minimal_large_heap_fragmentation_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 561 | tcmalloc_minimal_large_heap_fragmentation_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 562 | tcmalloc_minimal_large_heap_fragmentation_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 563 | |
| 564 | # This tests it works to LD_PRELOAD libtcmalloc (tests maybe_threads.cc) |
| 565 | # In theory this should work under mingw, but mingw has trouble running |
| 566 | # shell scripts that end in .exe. And it doesn't seem to build shared |
| 567 | # libraries anyway (so can't be LD_PRELOADed) -- in fact, anybody who |
| 568 | # chooses not to build shared libraries won't be able to run this test. |
| 569 | # TODO(csilvers): figure out how to nix ".exe" or otherwise work under mingw |
| 570 | if !MINGW |
| 571 | if !ENABLE_STATIC |
| 572 | TESTS += maybe_threads_unittest.sh$(EXEEXT) |
| 573 | maybe_threads_unittest_sh_SOURCES = src/tests/maybe_threads_unittest.sh |
| 574 | noinst_SCRIPTS += $(maybe_threads_unittest_sh_SOURCES) |
| 575 | # This script preloads libtcmalloc, and calls two other binaries as well |
| 576 | # TODO(csilvers): replace by 'if ! cmp $^ $@ >/dev/null 2>&; then ...; fi' |
| 577 | maybe_threads_unittest.sh$(EXEEXT): $(top_srcdir)/$(maybe_threads_unittest_sh_SOURCES) \ |
| 578 | $(LIBTCMALLOC_MINIMAL) \ |
| 579 | low_level_alloc_unittest |
| 580 | rm -f $@ |
| 581 | cp -p $(top_srcdir)/$(maybe_threads_unittest_sh_SOURCES) $@ |
| 582 | endif !ENABLE_STATIC |
| 583 | endif !MINGW |
| 584 | |
| 585 | # These all tests components of tcmalloc_minimal |
| 586 | |
| 587 | TESTS += addressmap_unittest |
| 588 | WINDOWS_PROJECTS += vsprojects/addressmap_unittest/addressmap_unittest.vcproj |
| 589 | ADDRESSMAP_UNITTEST_INCLUDES = src/addressmap-inl.h \ |
| 590 | src/base/commandlineflags.h \ |
| 591 | $(LOGGING_INCLUDES) |
| 592 | addressmap_unittest_SOURCES = src/tests/addressmap_unittest.cc \ |
| 593 | $(ADDRESSMAP_UNITTEST_INCLUDES) |
| 594 | if MINGW |
| 595 | addressmap_unittest_SOURCES += src/windows/port.h src/windows/port.cc |
| 596 | endif MINGW |
| 597 | addressmap_unittest_CXXFLAGS = -g $(AM_CXXFLAGS) |
| 598 | addressmap_unittest_LDADD = liblogging.la |
| 599 | |
| 600 | WINDOWS_PROJECTS += vsprojects/system-alloc_unittest/system-alloc_unittest.vcproj |
| 601 | if !MINGW |
| 602 | TESTS += system_alloc_unittest |
| 603 | system_alloc_unittest_SOURCES = src/config_for_unittests.h \ |
| 604 | src/tests/system-alloc_unittest.cc |
| 605 | system_alloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 606 | system_alloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 607 | system_alloc_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 608 | endif !MINGW |
| 609 | |
| 610 | TESTS += packed_cache_test |
| 611 | WINDOWS_PROJECTS += vsprojects/packed-cache_test/packed-cache_test.vcproj |
| 612 | packed_cache_test_SOURCES = src/tests/packed-cache_test.cc |
| 613 | packed_cache_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 614 | packed_cache_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 615 | packed_cache_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 616 | |
| 617 | TESTS += frag_unittest |
| 618 | WINDOWS_PROJECTS += vsprojects/frag_unittest/frag_unittest.vcproj |
| 619 | frag_unittest_SOURCES = src/tests/frag_unittest.cc src/config_for_unittests.h |
| 620 | frag_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 621 | frag_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 622 | frag_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 623 | |
| 624 | TESTS += markidle_unittest |
| 625 | WINDOWS_PROJECTS += vsprojects/markidle_unittest/markidle_unittest.vcproj |
| 626 | markidle_unittest_SOURCES = src/tests/markidle_unittest.cc \ |
| 627 | src/config_for_unittests.h \ |
| 628 | src/tests/testutil.h src/tests/testutil.cc |
| 629 | markidle_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 630 | markidle_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 631 | markidle_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 632 | |
| 633 | TESTS += current_allocated_bytes_test |
| 634 | WINDOWS_PROJECTS += vsprojects/current_allocated_bytes_test/current_allocated_bytes_test.vcproj |
| 635 | current_allocated_bytes_test_SOURCES = src/tests/current_allocated_bytes_test.cc \ |
| 636 | src/config_for_unittests.h |
| 637 | current_allocated_bytes_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 638 | current_allocated_bytes_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 639 | current_allocated_bytes_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 640 | |
| 641 | TESTS += malloc_hook_test |
| 642 | WINDOWS_PROJECTS += vsprojects/malloc_hook_test/malloc_hook_test.vcproj |
| 643 | malloc_hook_test_SOURCES = src/tests/malloc_hook_test.cc \ |
| 644 | src/config_for_unittests.h \ |
| 645 | src/base/logging.h \ |
| 646 | src/gperftools/malloc_hook.h \ |
| 647 | src/tests/testutil.h src/tests/testutil.cc |
| 648 | malloc_hook_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 649 | malloc_hook_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 650 | malloc_hook_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 651 | |
| 652 | TESTS += malloc_extension_test |
| 653 | WINDOWS_PROJECTS += vsprojects/malloc_extension_test/malloc_extension_test.vcproj |
| 654 | malloc_extension_test_SOURCES = src/tests/malloc_extension_test.cc \ |
| 655 | src/config_for_unittests.h \ |
| 656 | src/base/logging.h \ |
| 657 | src/gperftools/malloc_extension.h \ |
| 658 | src/gperftools/malloc_extension_c.h |
| 659 | malloc_extension_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 660 | malloc_extension_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 661 | malloc_extension_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 662 | |
| 663 | # This doesn't work with mingw, which links foo.a even though it |
| 664 | # doesn't set ENABLE_STATIC. TODO(csilvers): set enable_static=true |
| 665 | # in configure.ac:36? |
| 666 | if !MINGW |
| 667 | TESTS += malloc_extension_c_test |
| 668 | malloc_extension_c_test_SOURCES = src/tests/malloc_extension_c_test.c \ |
| 669 | src/gperftools/malloc_extension.h \ |
| 670 | src/gperftools/malloc_extension_c.h |
| 671 | malloc_extension_c_test_CFLAGS = $(PTHREAD_CFLAGS) $(AM_CFLAGS) |
| 672 | # -ansi here is just to help ensure the code is bog-standard C. |
| 673 | if GCC |
| 674 | malloc_extension_c_test_CFLAGS += -ansi |
| 675 | endif GCC |
| 676 | malloc_extension_c_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 677 | malloc_extension_c_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) -lstdc++ -lm |
| 678 | endif !MINGW |
| 679 | |
| 680 | if !MINGW |
| 681 | if !OSX |
| 682 | TESTS += memalign_unittest |
| 683 | memalign_unittest_SOURCES = src/tests/memalign_unittest.cc \ |
| 684 | src/tcmalloc.h \ |
| 685 | src/config_for_unittests.h \ |
| 686 | src/tests/testutil.h src/tests/testutil.cc |
| 687 | memalign_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 688 | memalign_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 689 | memalign_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 690 | endif !OSX |
| 691 | endif !MINGW |
| 692 | |
| 693 | TESTS += page_heap_test |
| 694 | WINDOWS_PROJECTS += vsprojects/page_heap_test/page_heap_test.vcproj |
| 695 | page_heap_test_SOURCES = src/tests/page_heap_test.cc \ |
| 696 | src/config_for_unittests.h \ |
| 697 | src/base/logging.h \ |
| 698 | src/common.h \ |
| 699 | src/page_heap.h |
| 700 | page_heap_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 701 | page_heap_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 702 | page_heap_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 703 | |
| 704 | TESTS += pagemap_unittest |
| 705 | WINDOWS_PROJECTS += vsprojects/pagemap_unittest/pagemap_unittest.vcproj |
| 706 | pagemap_unittest_SOURCES = src/tests/pagemap_unittest.cc \ |
| 707 | src/config_for_unittests.h \ |
| 708 | src/base/logging.h \ |
| 709 | src/pagemap.h |
| 710 | pagemap_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 711 | pagemap_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 712 | pagemap_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 713 | |
| 714 | TESTS += realloc_unittest |
| 715 | WINDOWS_PROJECTS += vsprojects/realloc_unittest/realloc_unittest.vcproj |
| 716 | realloc_unittest_SOURCES = src/tests/realloc_unittest.cc \ |
| 717 | src/config_for_unittests.h \ |
| 718 | src/base/logging.h |
| 719 | realloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 720 | realloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 721 | realloc_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 722 | |
| 723 | TESTS += stack_trace_table_test |
| 724 | WINDOWS_PROJECTS += vsprojects/stack_trace_table_test/stack_trace_table_test.vcproj |
| 725 | stack_trace_table_test_SOURCES = src/tests/stack_trace_table_test.cc \ |
| 726 | src/config_for_unittests.h |
| 727 | stack_trace_table_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 728 | stack_trace_table_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 729 | stack_trace_table_test_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 730 | |
| 731 | TESTS += thread_dealloc_unittest |
| 732 | WINDOWS_PROJECTS += vsprojects/thread_dealloc_unittest/thread_dealloc_unittest.vcproj |
| 733 | thread_dealloc_unittest_SOURCES = src/tests/thread_dealloc_unittest.cc \ |
| 734 | src/config_for_unittests.h \ |
| 735 | src/tests/testutil.h src/tests/testutil.cc |
| 736 | thread_dealloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 737 | thread_dealloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 738 | thread_dealloc_unittest_LDADD = $(LIBTCMALLOC_MINIMAL) $(PTHREAD_LIBS) |
| 739 | |
| 740 | ### Documentation |
| 741 | dist_doc_DATA += doc/tcmalloc.html \ |
| 742 | doc/overview.gif \ |
| 743 | doc/pageheap.gif \ |
| 744 | doc/spanmap.gif \ |
| 745 | doc/threadheap.gif \ |
| 746 | doc/t-test1.times.txt \ |
| 747 | doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png \ |
| 748 | doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png \ |
| 749 | doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png \ |
| 750 | doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png \ |
| 751 | doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png \ |
| 752 | doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png \ |
| 753 | doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png \ |
| 754 | doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png \ |
| 755 | doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png \ |
| 756 | doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png \ |
| 757 | doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png \ |
| 758 | doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png \ |
| 759 | doc/tcmalloc-opspersec.vs.size.1.threads.png \ |
| 760 | doc/tcmalloc-opspersec.vs.size.12.threads.png \ |
| 761 | doc/tcmalloc-opspersec.vs.size.16.threads.png \ |
| 762 | doc/tcmalloc-opspersec.vs.size.2.threads.png \ |
| 763 | doc/tcmalloc-opspersec.vs.size.20.threads.png \ |
| 764 | doc/tcmalloc-opspersec.vs.size.3.threads.png \ |
| 765 | doc/tcmalloc-opspersec.vs.size.4.threads.png \ |
| 766 | doc/tcmalloc-opspersec.vs.size.5.threads.png \ |
| 767 | doc/tcmalloc-opspersec.vs.size.8.threads.png |
| 768 | |
| 769 | # I don't know how to say "distribute the .dot files but don't install them"; |
| 770 | # noinst doesn't seem to work with data. I separate them out anyway, in case |
| 771 | # one day we figure it out. Regardless, installing the dot files isn't the |
| 772 | # end of the world. |
| 773 | dist_doc_DATA += doc/overview.dot \ |
| 774 | doc/pageheap.dot \ |
| 775 | doc/spanmap.dot \ |
| 776 | doc/threadheap.dot |
| 777 | |
| 778 | |
| 779 | ### ------- tcmalloc_minimal_debug (thread-caching malloc with debugallocation) |
| 780 | |
| 781 | # Like tcmalloc.cc, debugallocation.cc needs exceptions to fulfill its |
| 782 | # API. Luckily, we can reuse everything else from tcmalloc_minimal. |
| 783 | |
| 784 | if WITH_DEBUGALLOC |
| 785 | |
| 786 | lib_LTLIBRARIES += libtcmalloc_minimal_debug.la |
| 787 | libtcmalloc_minimal_debug_la_SOURCES = src/debugallocation.cc \ |
| 788 | $(TCMALLOC_MINIMAL_INCLUDES) |
| 789 | libtcmalloc_minimal_debug_la_CXXFLAGS = $(libtcmalloc_minimal_la_CXXFLAGS) \ |
| 790 | -DTCMALLOC_FOR_DEBUGALLOCATION |
| 791 | # version_info gets passed to libtool |
| 792 | libtcmalloc_minimal_debug_la_LDFLAGS = $(libtcmalloc_minimal_la_LDFLAGS) \ |
| 793 | -version-info @TCMALLOC_SO_VERSION@ |
| 794 | libtcmalloc_minimal_debug_la_LIBADD = $(libtcmalloc_minimal_la_LIBADD) |
| 795 | |
| 796 | LIBS_TO_WEAKEN += libtcmalloc_minimal_debug.la |
| 797 | |
| 798 | ### Unittests |
| 799 | |
| 800 | TESTS += tcmalloc_minimal_debug_unittest |
| 801 | tcmalloc_minimal_debug_unittest_SOURCES = $(tcmalloc_minimal_unittest_SOURCES) |
| 802 | tcmalloc_minimal_debug_unittest_CXXFLAGS = $(tcmalloc_minimal_unittest_CXXFLAGS) \ |
| 803 | -DDEBUGALLOCATION |
| 804 | tcmalloc_minimal_debug_unittest_LDFLAGS = $(tcmalloc_minimal_unittest_LDFLAGS) |
| 805 | tcmalloc_minimal_debug_unittest_LDADD = libtcmalloc_minimal_debug.la $(PTHREAD_LIBS) |
| 806 | |
| 807 | TESTS += malloc_extension_debug_test |
| 808 | malloc_extension_debug_test_SOURCES = $(malloc_extension_test_SOURCES) |
| 809 | malloc_extension_debug_test_CXXFLAGS = $(malloc_extension_test_CXXFLAGS) |
| 810 | malloc_extension_debug_test_LDFLAGS = $(malloc_extension_test_LDFLAGS) |
| 811 | malloc_extension_debug_test_LDADD = libtcmalloc_minimal_debug.la $(PTHREAD_LIBS) |
| 812 | |
| 813 | if !MINGW |
| 814 | if !OSX |
| 815 | TESTS += memalign_debug_unittest |
| 816 | memalign_debug_unittest_SOURCES = $(memalign_unittest_SOURCES) |
| 817 | memalign_debug_unittest_CXXFLAGS = $(memalign_unittest_CXXFLAGS) |
| 818 | memalign_debug_unittest_LDFLAGS = $(memalign_unittest_LDFLAGS) |
| 819 | memalign_debug_unittest_LDADD = libtcmalloc_minimal_debug.la $(PTHREAD_LIBS) |
| 820 | endif !OSX |
| 821 | endif !MINGW |
| 822 | |
| 823 | TESTS += realloc_debug_unittest |
| 824 | realloc_debug_unittest_SOURCES = $(realloc_unittest_SOURCES) |
| 825 | realloc_debug_unittest_CXXFLAGS = $(realloc_unittest_CXXFLAGS) |
| 826 | realloc_debug_unittest_LDFLAGS = $(realloc_unittest_LDFLAGS) |
| 827 | realloc_debug_unittest_LDADD = libtcmalloc_minimal_debug.la $(PTHREAD_LIBS) |
| 828 | |
| 829 | # debugallocation_test checks that we print a proper stacktrace when |
| 830 | # debug-allocs fail, so we can't run it if we don't have stacktrace info. |
| 831 | if WITH_STACK_TRACE |
| 832 | TESTS += debugallocation_test.sh$(EXEEXT) |
| 833 | debugallocation_test_sh_SOURCES = src/tests/debugallocation_test.sh |
| 834 | noinst_SCRIPTS += $(debugallocation_test_sh_SOURCES) |
| 835 | debugallocation_test.sh$(EXEEXT): $(top_srcdir)/$(debugallocation_test_sh_SOURCES) \ |
| 836 | debugallocation_test |
| 837 | rm -f $@ |
| 838 | cp -p $(top_srcdir)/$(debugallocation_test_sh_SOURCES) $@ |
| 839 | |
| 840 | # This is the sub-program used by debugallocation_test.sh |
| 841 | noinst_PROGRAMS += debugallocation_test |
| 842 | debugallocation_test_SOURCES = src/tests/debugallocation_test.cc |
| 843 | debugallocation_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 844 | debugallocation_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 845 | debugallocation_test_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS) |
| 846 | endif WITH_STACK_TRACE |
| 847 | |
| 848 | endif WITH_DEBUGALLOC |
| 849 | |
| 850 | noinst_PROGRAMS += malloc_bench malloc_bench_shared |
| 851 | |
| 852 | malloc_bench_SOURCES = benchmark/malloc_bench.cc |
| 853 | malloc_bench_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 854 | malloc_bench_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) -static |
| 855 | malloc_bench_LDADD = libtcmalloc_minimal.la $(PTHREAD_LIBS) |
| 856 | |
| 857 | malloc_bench_shared_SOURCES = benchmark/malloc_bench.cc |
| 858 | malloc_bench_shared_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 859 | malloc_bench_shared_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 860 | malloc_bench_shared_LDADD = libtcmalloc_minimal.la $(PTHREAD_LIBS) |
| 861 | |
| 862 | |
| 863 | ### ------- tcmalloc (thread-caching malloc + heap profiler + heap checker) |
| 864 | |
| 865 | if WITH_HEAP_PROFILER_OR_CHECKER |
| 866 | |
| 867 | ### The header files we use. We divide into categories based on directory |
| 868 | S_TCMALLOC_INCLUDES = $(S_TCMALLOC_MINIMAL_INCLUDES) \ |
| 869 | $(LOGGING_INCLUDES) \ |
| 870 | src/addressmap-inl.h \ |
| 871 | src/raw_printer.h \ |
| 872 | src/base/elfcore.h \ |
| 873 | src/base/googleinit.h \ |
| 874 | src/base/linux_syscall_support.h \ |
| 875 | src/base/linuxthreads.h \ |
| 876 | src/base/stl_allocator.h \ |
| 877 | src/base/sysinfo.h \ |
| 878 | src/base/thread_lister.h \ |
| 879 | src/heap-profile-table.h \ |
| 880 | src/heap-profile-stats.h |
| 881 | SG_TCMALLOC_INCLUDES = src/gperftools/heap-profiler.h \ |
| 882 | src/gperftools/heap-checker.h |
| 883 | TCMALLOC_INCLUDES = $(S_TCMALLOC_INCLUDES) $(SG_TCMALLOC_MINIMAL_INCLUDES) \ |
| 884 | $(SG_TCMALLOC_INCLUDES) $(SG_STACKTRACE_INCLUDES) |
| 885 | perftoolsinclude_HEADERS += $(SG_TCMALLOC_INCLUDES) |
| 886 | |
| 887 | ### Making the library |
| 888 | |
| 889 | # As we describe at the top of this file, we want to turn off exceptions |
| 890 | # for all files in this library -- except tcmalloc.cc which needs them |
| 891 | # to fulfill its API. Automake doesn't allow per-file CXXFLAGS, so we need |
| 892 | # to separate into two libraries. |
| 893 | noinst_LTLIBRARIES += libtcmalloc_internal.la |
| 894 | libtcmalloc_internal_la_SOURCES = $(libtcmalloc_minimal_internal_la_SOURCES) \ |
| 895 | $(TCMALLOC_INCLUDES) \ |
| 896 | src/base/low_level_alloc.cc \ |
| 897 | src/heap-profile-table.cc \ |
| 898 | src/heap-profiler.cc \ |
| 899 | src/raw_printer.cc \ |
| 900 | src/memory_region_map.cc |
| 901 | libtcmalloc_internal_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG \ |
| 902 | $(AM_CXXFLAGS) $(NO_EXCEPTIONS) |
| 903 | libtcmalloc_internal_la_LDFLAGS = $(PTHREAD_CFLAGS) |
| 904 | libtcmalloc_internal_la_LIBADD = libstacktrace.la $(PTHREAD_LIBS) |
| 905 | |
| 906 | lib_LTLIBRARIES += libtcmalloc.la |
| 907 | libtcmalloc_la_SOURCES = $(TCMALLOC_CC) $(TCMALLOC_INCLUDES) |
| 908 | libtcmalloc_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG $(AM_CXXFLAGS) |
| 909 | libtcmalloc_la_LDFLAGS = $(PTHREAD_CFLAGS) -version-info @TCMALLOC_SO_VERSION@ |
| 910 | libtcmalloc_la_LIBADD = libtcmalloc_internal.la libmaybe_threads.la $(PTHREAD_LIBS) |
| 911 | |
| 912 | if WITH_HEAP_CHECKER |
| 913 | # heap-checker-bcad is last, in hopes its global ctor will run first. |
| 914 | # (Note this is added to libtcmalloc.la, not libtcmalloc_internal.la, |
| 915 | # but that's ok; the internal/external distinction is only useful for |
| 916 | # cygwin, and cygwin doesn't use HEAP_CHECKER anyway.) |
| 917 | HEAP_CHECKER_SOURCES = src/base/thread_lister.c \ |
| 918 | src/base/linuxthreads.cc \ |
| 919 | src/heap-checker.cc \ |
| 920 | src/heap-checker-bcad.cc |
| 921 | libtcmalloc_la_SOURCES += $(HEAP_CHECKER_SOURCES) |
| 922 | else !WITH_HEAP_CHECKER |
| 923 | HEAP_CHECKER_SOURCES = |
| 924 | libtcmalloc_internal_la_CXXFLAGS += -DNO_HEAP_CHECK |
| 925 | libtcmalloc_la_CXXFLAGS += -DNO_HEAP_CHECK |
| 926 | endif !WITH_HEAP_CHECKER |
| 927 | |
| 928 | LIBTCMALLOC = libtcmalloc.la |
| 929 | |
| 930 | LIBS_TO_WEAKEN += libtcmalloc.la |
| 931 | |
| 932 | ### Unittests |
| 933 | |
| 934 | TESTS += tcmalloc_unittest.sh$(EXEEXT) |
| 935 | tcmalloc_unittest_sh_SOURCES = src/tests/tcmalloc_unittest.sh |
| 936 | noinst_SCRIPTS += $(tcmalloc_unittest_sh_SOURCES) |
| 937 | tcmalloc_unittest.sh$(EXEEXT): $(top_srcdir)/$(tcmalloc_unittest_sh_SOURCES) \ |
| 938 | tcmalloc_unittest |
| 939 | rm -f $@ |
| 940 | cp -p $(top_srcdir)/$(tcmalloc_unittest_sh_SOURCES) $@ |
| 941 | |
| 942 | noinst_PROGRAMS += tcmalloc_unittest |
| 943 | tcmalloc_unittest_INCLUDES = src/config_for_unittests.h \ |
| 944 | src/gperftools/malloc_extension.h |
| 945 | tcmalloc_unittest_SOURCES = src/tests/tcmalloc_unittest.cc \ |
| 946 | src/tcmalloc.h \ |
| 947 | src/tests/testutil.h src/tests/testutil.cc \ |
| 948 | $(TCMALLOC_UNITTEST_INCLUDES) |
| 949 | tcmalloc_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 950 | tcmalloc_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 951 | # We want libtcmalloc last on the link line, but due to a bug in |
| 952 | # libtool involving convenience libs, they need to come last on the |
| 953 | # link line in order to get dependency ordering right. This is ok: |
| 954 | # convenience libraries are .a's, so tcmalloc is still the last .so. |
| 955 | # We also put pthreads after tcmalloc, because some pthread |
| 956 | # implementations define their own malloc, and we need to go on the |
| 957 | # first linkline to make sure our malloc 'wins'. |
| 958 | tcmalloc_unittest_LDADD = $(LIBTCMALLOC) liblogging.la $(PTHREAD_LIBS) |
| 959 | |
| 960 | # This makes sure it's safe to link in both tcmalloc and |
| 961 | # tcmalloc_minimal. (One would never do this on purpose, but perhaps |
| 962 | # by accident...) When we can compile libprofiler, we also link it in |
| 963 | # to make sure that works too. NOTE: On OS X, it's *not* safe to |
| 964 | # link both in (we end up with two copies of every global var, and |
| 965 | # the code tends to pick one arbitrarily), so don't run the test there. |
| 966 | # (We define these outside the 'if' because they're reused below.) |
| 967 | tcmalloc_both_unittest_srcs = src/tests/tcmalloc_unittest.cc \ |
| 968 | src/tests/testutil.h src/tests/testutil.cc \ |
| 969 | $(TCMALLOC_UNITTEST_INCLUDES) |
| 970 | tcmalloc_both_unittest_cflags = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 971 | tcmalloc_both_unittest_lflags = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 972 | if WITH_CPU_PROFILER |
| 973 | # We want libtcmalloc last on the link line, but due to a bug in |
| 974 | # libtool involving convenience libs, they need to come last on the |
| 975 | # link line in order to get dependency ordering right. This is ok: |
| 976 | # convenience libraries are .a's, so tcmalloc is still the last .so. |
| 977 | # We also put pthreads after tcmalloc, because some pthread |
| 978 | # implementations define their own malloc, and we need to go on the |
| 979 | # first linkline to make sure our malloc 'wins'. |
| 980 | tcmalloc_both_unittest_ladd = $(LIBTCMALLOC) $(LIBTCMALLOC_MINIMAL) \ |
| 981 | libprofiler.la liblogging.la $(PTHREAD_LIBS) |
| 982 | else |
| 983 | tcmalloc_both_unittest_ladd = $(LIBTCMALLOC) $(LIBTCMALLOC_MINIMAL) \ |
| 984 | liblogging.la $(PTHREAD_LIBS) |
| 985 | endif !WITH_CPU_PROFILER |
| 986 | if !OSX |
| 987 | TESTS += tcmalloc_both_unittest |
| 988 | tcmalloc_both_unittest_SOURCES = $(tcmalloc_both_unittest_srcs) |
| 989 | tcmalloc_both_unittest_CXXFLAGS = $(tcmalloc_both_unittest_cflags) |
| 990 | tcmalloc_both_unittest_LDFLAGS = $(tcmalloc_both_unittest_lflags) |
| 991 | tcmalloc_both_unittest_LDADD = $(tcmalloc_both_unittest_ladd) |
| 992 | endif !OSX |
| 993 | |
| 994 | TESTS += tcmalloc_large_unittest |
| 995 | tcmalloc_large_unittest_SOURCES = src/tests/tcmalloc_large_unittest.cc |
| 996 | tcmalloc_large_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 997 | tcmalloc_large_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 998 | tcmalloc_large_unittest_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) |
| 999 | |
| 1000 | TESTS += tcmalloc_large_heap_fragmentation_unittest |
| 1001 | tcmalloc_large_heap_fragmentation_unittest_SOURCES = src/tests/large_heap_fragmentation_unittest.cc |
| 1002 | tcmalloc_large_heap_fragmentation_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 1003 | tcmalloc_large_heap_fragmentation_unittest_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1004 | tcmalloc_large_heap_fragmentation_unittest_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) |
| 1005 | |
| 1006 | TESTS += raw_printer_test |
| 1007 | raw_printer_test_SOURCES = src/tests/raw_printer_test.cc |
| 1008 | raw_printer_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 1009 | raw_printer_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1010 | raw_printer_test_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) |
| 1011 | |
| 1012 | # sampler_test and sampling_test both require sampling to be turned |
| 1013 | # on, which it's not by default. Use the "standard" value of 2^19. |
| 1014 | TESTS_ENVIRONMENT += TCMALLOC_SAMPLE_PARAMETER=524288 |
| 1015 | |
| 1016 | TESTS += sampler_test |
| 1017 | WINDOWS_PROJECTS += vsprojects/sampler_test/sampler_test.vcproj |
| 1018 | sampler_test_SOURCES = src/tests/sampler_test.cc \ |
| 1019 | src/config_for_unittests.h |
| 1020 | sampler_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 1021 | sampler_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1022 | sampler_test_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) -lm |
| 1023 | |
| 1024 | |
| 1025 | # These unittests often need to run binaries. They're in the current dir |
| 1026 | TESTS_ENVIRONMENT += BINDIR=. |
| 1027 | TESTS_ENVIRONMENT += TMPDIR=/tmp/perftools |
| 1028 | |
| 1029 | TESTS += sampling_test.sh$(EXEEXT) |
| 1030 | sampling_test_sh_SOURCES = src/tests/sampling_test.sh |
| 1031 | noinst_SCRIPTS += $(sampling_test_sh_SOURCES) |
| 1032 | sampling_test.sh$(EXEEXT): $(top_srcdir)/$(sampling_test_sh_SOURCES) \ |
| 1033 | sampling_test |
| 1034 | rm -f $@ |
| 1035 | cp -p $(top_srcdir)/$(sampling_test_sh_SOURCES) $@ |
| 1036 | |
| 1037 | # This is the sub-program used by sampling_test.sh |
| 1038 | # The -g is so pprof can get symbol information. |
| 1039 | noinst_PROGRAMS += sampling_test |
| 1040 | SAMPLING_TEST_INCLUDES = src/config_for_unittests.h \ |
| 1041 | src/base/logging.h \ |
| 1042 | src/gperftools/malloc_extension.h |
| 1043 | sampling_test_SOURCES = src/tests/sampling_test.cc \ |
| 1044 | $(SAMPLING_TEST_INCLUDES) |
| 1045 | sampling_test_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 1046 | sampling_test_LDFLAGS = -g $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1047 | sampling_test_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) |
| 1048 | |
| 1049 | endif WITH_HEAP_PROFILER_OR_CHECKER |
| 1050 | |
| 1051 | if WITH_HEAP_PROFILER |
| 1052 | |
| 1053 | TESTS += heap-profiler_unittest.sh$(EXEEXT) |
| 1054 | heap_profiler_unittest_sh_SOURCES = src/tests/heap-profiler_unittest.sh |
| 1055 | noinst_SCRIPTS += $(heap_profiler_unittest_sh_SOURCES) |
| 1056 | heap-profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) \ |
| 1057 | heap-profiler_unittest |
| 1058 | rm -f $@ |
| 1059 | cp -p $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) $@ |
| 1060 | |
| 1061 | # These are sub-programs used by heap-profiler_unittest.sh |
| 1062 | noinst_PROGRAMS += heap-profiler_unittest |
| 1063 | HEAP_PROFILER_UNITTEST_INCLUDES = src/config_for_unittests.h \ |
| 1064 | src/gperftools/heap-profiler.h |
| 1065 | heap_profiler_unittest_SOURCES = src/tests/heap-profiler_unittest.cc \ |
| 1066 | $(HEAP_PROFILER_UNITTEST_INCLUDES) |
| 1067 | heap_profiler_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 1068 | heap_profiler_unittest_LDFLAGS = -g $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1069 | heap_profiler_unittest_LDADD = $(LIBTCMALLOC) $(PTHREAD_LIBS) |
| 1070 | |
| 1071 | # Tests the compatibility include-headers in google/. Requires a function |
| 1072 | # defined in the heap-profiler, which is why the test lives here. |
| 1073 | TESTS += simple_compat_test |
| 1074 | simple_compat_test_SOURCES = src/tests/simple_compat_test.cc \ |
| 1075 | $(googleinclude_HEADERS) |
| 1076 | simple_compat_test_LDFLAGS = $(TCMALLOC_FLAGS) |
| 1077 | simple_compat_test_LDADD = $(LIBTCMALLOC) |
| 1078 | |
| 1079 | endif WITH_HEAP_PROFILER |
| 1080 | |
| 1081 | if WITH_HEAP_CHECKER |
| 1082 | |
| 1083 | TESTS += heap-checker_unittest.sh$(EXEEXT) |
| 1084 | heap_checker_unittest_sh_SOURCES = src/tests/heap-checker_unittest.sh |
| 1085 | noinst_SCRIPTS += $(heap_checker_unittest_sh_SOURCES) |
| 1086 | heap-checker_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) \ |
| 1087 | heap-checker_unittest |
| 1088 | rm -f $@ |
| 1089 | cp -p $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) $@ |
| 1090 | |
| 1091 | TESTS += heap-checker-death_unittest.sh$(EXEEXT) |
| 1092 | heap_checker_death_unittest_sh_SOURCES = src/tests/heap-checker-death_unittest.sh |
| 1093 | noinst_SCRIPTS += $(top_srcdir)/$(heap_checker_death_unittest_sh_SOURCES) |
| 1094 | heap-checker-death_unittest.sh$(EXEEXT): $(heap_checker_death_unittest_sh_SOURCES) \ |
| 1095 | heap-checker_unittest |
| 1096 | rm -f $@ |
| 1097 | cp -p $(top_srcdir)/$(heap_checker_death_unittest_sh_SOURCES) $@ |
| 1098 | |
| 1099 | # These are sub-programs used by heap-checker_unittest.sh |
| 1100 | noinst_PROGRAMS += heap-checker_unittest |
| 1101 | HEAP_CHECKER_UNITTEST_INCLUDES = src/config_for_unittests.h \ |
| 1102 | src/memory_region_map.h \ |
| 1103 | src/base/commandlineflags.h \ |
| 1104 | src/base/googleinit.h \ |
| 1105 | src/gperftools/heap-checker.h \ |
| 1106 | $(LOGGING_INCLUDES) |
| 1107 | heap_checker_unittest_SOURCES = src/tests/heap-checker_unittest.cc \ |
| 1108 | $(HEAP_CHECKER_UNITTEST_INCLUDES) |
| 1109 | heap_checker_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) $(NO_BUILTIN_CXXFLAGS) |
| 1110 | heap_checker_unittest_LDFLAGS = -g $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS) |
| 1111 | # We want libtcmalloc last on the link line, but due to a bug in |
| 1112 | # libtool involving convenience libs, they need to come last on the |
| 1113 | # link line in order to get dependency ordering right. This is ok: |
| 1114 | # convenience libraries are .a's, so tcmalloc is still the last .so. |
| 1115 | # We also put pthreads after tcmalloc, because some pthread |
| 1116 | # implementations define their own malloc, and we need to go on the |
| 1117 | # first linkline to make sure our malloc 'wins'. |
| 1118 | heap_checker_unittest_LDADD = $(LIBTCMALLOC) liblogging.la $(PTHREAD_LIBS) |
| 1119 | |
| 1120 | endif WITH_HEAP_CHECKER |
| 1121 | |
| 1122 | ### Documentation (above and beyond tcmalloc_minimal documentation) |
| 1123 | if WITH_HEAP_PROFILER |
| 1124 | dist_doc_DATA += doc/heapprofile.html doc/heap-example1.png |
| 1125 | endif WITH_HEAP_PROFILER |
| 1126 | |
| 1127 | if WITH_HEAP_CHECKER |
| 1128 | dist_doc_DATA += doc/heap_checker.html |
| 1129 | endif WITH_HEAP_CHECKER |
| 1130 | |
| 1131 | |
| 1132 | ### ------- tcmalloc with debugallocation |
| 1133 | |
| 1134 | if WITH_DEBUGALLOC |
| 1135 | if WITH_HEAP_PROFILER_OR_CHECKER |
| 1136 | |
| 1137 | lib_LTLIBRARIES += libtcmalloc_debug.la |
| 1138 | libtcmalloc_debug_la_SOURCES = src/debugallocation.cc $(HEAP_CHECKER_SOURCES) \ |
| 1139 | $(TCMALLOC_INCLUDES) |
| 1140 | libtcmalloc_debug_la_CXXFLAGS = $(libtcmalloc_la_CXXFLAGS) \ |
| 1141 | -DTCMALLOC_FOR_DEBUGALLOCATION |
| 1142 | libtcmalloc_debug_la_LDFLAGS = $(libtcmalloc_la_LDFLAGS) \ |
| 1143 | -version-info @TCMALLOC_SO_VERSION@ |
| 1144 | libtcmalloc_debug_la_LIBADD = $(libtcmalloc_la_LIBADD) |
| 1145 | |
| 1146 | LIBS_TO_WEAKEN += libtcmalloc_debug.la |
| 1147 | |
| 1148 | ### Unittests |
| 1149 | |
| 1150 | TESTS += tcmalloc_debug_unittest |
| 1151 | tcmalloc_debug_unittest_SOURCES = $(tcmalloc_unittest_SOURCES) |
| 1152 | tcmalloc_debug_unittest_CXXFLAGS = $(tcmalloc_unittest_CXXFLAGS) \ |
| 1153 | -DDEBUGALLOCATION |
| 1154 | tcmalloc_debug_unittest_LDFLAGS = $(tcmalloc_unittest_LDFLAGS) |
| 1155 | tcmalloc_debug_unittest_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS) |
| 1156 | |
| 1157 | TESTS += sampler_debug_test |
| 1158 | sampler_debug_test_SOURCES = $(sampler_test_SOURCES) |
| 1159 | sampler_debug_test_CXXFLAGS = $(samples_test_CXXFLAGS) |
| 1160 | sampler_debug_test_LDFLAGS = $(sampler_test_LDFLAGS) |
| 1161 | sampler_debug_test_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS) -lm |
| 1162 | |
| 1163 | TESTS += sampling_debug_test.sh$(EXEEXT) |
| 1164 | sampling_debug_test_sh_SOURCES = src/tests/sampling_test.sh |
| 1165 | sampling_debug_test.sh$(EXEEXT): $(top_srcdir)/$(sampling_test_sh_SOURCES) \ |
| 1166 | sampling_debug_test |
| 1167 | rm -f $@ |
| 1168 | cp -p $(top_srcdir)/$(sampling_test_sh_SOURCES) $@ |
| 1169 | |
| 1170 | # This is the sub-program using by sampling_debug_test.sh |
| 1171 | # The -g is so pprof can get symbol information. |
| 1172 | noinst_PROGRAMS += sampling_debug_test |
| 1173 | sampling_debug_test_SOURCES = $(sampling_test_SOURCES) |
| 1174 | sampling_debug_test_CXXFLAGS = $(sampling_test_CXXFLAGS) |
| 1175 | sampling_debug_test_LDFLAGS = $(sampling_test_LDFLAGS) |
| 1176 | sampling_debug_test_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS) |
| 1177 | |
| 1178 | endif WITH_HEAP_PROFILER_OR_CHECKER |
| 1179 | |
| 1180 | if WITH_HEAP_PROFILER |
| 1181 | |
| 1182 | TESTS += heap-profiler_debug_unittest.sh$(EXEEXT) |
| 1183 | heap_profiler_debug_unittest_sh_SOURCES = src/tests/heap-profiler_unittest.sh |
| 1184 | heap-profiler_debug_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) \ |
| 1185 | heap-profiler_debug_unittest |
| 1186 | rm -f $@ |
| 1187 | cp -p $(top_srcdir)/$(heap_profiler_unittest_sh_SOURCES) $@ |
| 1188 | |
| 1189 | # These are sub-programs used by heap-profiler_debug_unittest.sh |
| 1190 | noinst_PROGRAMS += heap-profiler_debug_unittest |
| 1191 | heap_profiler_debug_unittest_SOURCES = $(heap_profiler_unittest_SOURCES) |
| 1192 | heap_profiler_debug_unittest_CXXFLAGS = $(heap_profiler_unittest_CXXFLAGS) |
| 1193 | heap_profiler_debug_unittest_LDFLAGS = $(heap_profiler_unittest_LDFLAGS) |
| 1194 | heap_profiler_debug_unittest_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS) |
| 1195 | |
| 1196 | endif WITH_HEAP_PROFILER |
| 1197 | |
| 1198 | if WITH_HEAP_CHECKER |
| 1199 | |
| 1200 | TESTS += heap-checker_debug_unittest.sh$(EXEEXT) |
| 1201 | heap_checker_debug_unittest_sh_SOURCES = src/tests/heap-checker_unittest.sh |
| 1202 | heap-checker_debug_unittest.sh$(EXEEXT): $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) \ |
| 1203 | heap-checker_debug_unittest |
| 1204 | rm -f $@ |
| 1205 | cp -p $(top_srcdir)/$(heap_checker_unittest_sh_SOURCES) $@ |
| 1206 | |
| 1207 | # These are sub-programs used by heap-checker_debug_unittest.sh |
| 1208 | noinst_PROGRAMS += heap-checker_debug_unittest |
| 1209 | heap_checker_debug_unittest_SOURCES = $(heap_checker_unittest_SOURCES) |
| 1210 | heap_checker_debug_unittest_CXXFLAGS = $(heap_checker_unittest_CXXFLAGS) |
| 1211 | heap_checker_debug_unittest_LDFLAGS = $(heap_checker_unittest_LDFLAGS) |
| 1212 | # We want libtcmalloc last on the link line, but due to a bug in |
| 1213 | # libtool involving convenience libs, they need to come last on the |
| 1214 | # link line in order to get dependency ordering right. This is ok: |
| 1215 | # convenience libraries are .a's, so tcmalloc is still the last .so. |
| 1216 | heap_checker_debug_unittest_LDADD = libtcmalloc_debug.la liblogging.la \ |
| 1217 | $(PTHREAD_LIBS) |
| 1218 | |
| 1219 | endif WITH_HEAP_CHECKER |
| 1220 | endif WITH_DEBUGALLOC |
| 1221 | |
| 1222 | |
| 1223 | ### ------- CPU profiler |
| 1224 | |
| 1225 | if WITH_CPU_PROFILER |
| 1226 | |
| 1227 | ### The header files we use. We divide into categories based on directory |
| 1228 | S_CPU_PROFILER_INCLUDES = src/profiledata.h \ |
| 1229 | src/profile-handler.h \ |
| 1230 | src/getpc.h \ |
| 1231 | src/base/basictypes.h \ |
| 1232 | src/base/commandlineflags.h \ |
| 1233 | src/base/googleinit.h \ |
| 1234 | src/base/logging.h \ |
| 1235 | src/base/simple_mutex.h \ |
| 1236 | src/base/sysinfo.h \ |
| 1237 | $(SPINLOCK_INCLUDES) \ |
| 1238 | $(LOGGING_INCLUDES) |
| 1239 | SG_CPU_PROFILER_INCLUDES = src/gperftools/profiler.h |
| 1240 | CPU_PROFILER_INCLUDES = $(S_CPU_PROFILER_INCLUDES) $(SG_CPU_PROFILER_INCLUDES) \ |
| 1241 | $(SG_STACKTRACE_INCLUDES) |
| 1242 | perftoolsinclude_HEADERS += $(SG_CPU_PROFILER_INCLUDES) |
| 1243 | |
| 1244 | ### Making the library |
| 1245 | lib_LTLIBRARIES += libprofiler.la |
| 1246 | libprofiler_la_SOURCES = src/profiler.cc \ |
| 1247 | src/profile-handler.cc \ |
| 1248 | src/profiledata.cc \ |
| 1249 | $(CPU_PROFILER_INCLUDES) |
| 1250 | libprofiler_la_LIBADD = libstacktrace.la libmaybe_threads.la |
| 1251 | # We have to include ProfileData for profiledata_unittest |
| 1252 | CPU_PROFILER_SYMBOLS = '(ProfilerStart|ProfilerStartWithOptions|ProfilerStop|ProfilerFlush|ProfilerEnable|ProfilerDisable|ProfilingIsEnabledForAllThreads|ProfilerRegisterThread|ProfilerGetCurrentState|ProfilerState|ProfileData|ProfileHandler)' |
| 1253 | libprofiler_la_LDFLAGS = -export-symbols-regex $(CPU_PROFILER_SYMBOLS) \ |
| 1254 | -version-info @PROFILER_SO_VERSION@ |
| 1255 | |
| 1256 | # See discussion above (under LIBTCMALLOC_MINIMAL) for why we do this. |
| 1257 | # Basically it's to work around systems where --rpath doesn't work right. |
| 1258 | LIBPROFILER = libstacktrace.la libprofiler.la |
| 1259 | |
| 1260 | ### Unittests |
| 1261 | TESTS += getpc_test |
| 1262 | #WINDOWS_PROJECTS += vsprojects/getpc_test/getpc_test.vcproj |
| 1263 | getpc_test_SOURCES = src/tests/getpc_test.cc src/getpc.h |
| 1264 | |
| 1265 | TESTS += profiledata_unittest |
| 1266 | #WINDOWS_PROJECTS += vsprojects/profiledata_unittest/profiledata_unittest.vcproj |
| 1267 | profiledata_unittest_SOURCES = src/tests/profiledata_unittest.cc \ |
| 1268 | src/profiledata.h \ |
| 1269 | src/base/commandlineflags.h \ |
| 1270 | src/base/logging.h \ |
| 1271 | src/base/basictypes.h |
| 1272 | profiledata_unittest_LDADD = $(LIBPROFILER) |
| 1273 | |
| 1274 | TESTS += profile_handler_unittest |
| 1275 | profile_handler_unittest_SOURCES = src/tests/profile-handler_unittest.cc \ |
| 1276 | src/profile-handler.h |
| 1277 | profile_handler_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) |
| 1278 | profile_handler_unittest_LDFLAGS = $(PTHREAD_CFLAGS) |
| 1279 | profile_handler_unittest_LDADD = $(LIBPROFILER) $(PTHREAD_LIBS) |
| 1280 | |
| 1281 | TESTS += profiler_unittest.sh$(EXEEXT) |
| 1282 | profiler_unittest_sh_SOURCES = src/tests/profiler_unittest.sh |
| 1283 | noinst_SCRIPTS += $(profiler_unittest_sh_SOURCES) |
| 1284 | profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(profiler_unittest_sh_SOURCES) \ |
| 1285 | profiler1_unittest profiler2_unittest \ |
| 1286 | profiler3_unittest profiler4_unittest |
| 1287 | rm -f $@ |
| 1288 | cp -p $(top_srcdir)/$(profiler_unittest_sh_SOURCES) $@ |
| 1289 | |
| 1290 | # These are sub-programs used by profiler_unittest.sh |
| 1291 | noinst_PROGRAMS += profiler1_unittest profiler2_unittest profiler3_unittest \ |
| 1292 | profiler4_unittest |
| 1293 | PROFILER_UNITTEST_INCLUDES = src/config_for_unittests.h \ |
| 1294 | src/gperftools/profiler.h |
| 1295 | PROFILER_UNITTEST_SRCS = src/tests/profiler_unittest.cc \ |
| 1296 | src/tests/testutil.h src/tests/testutil.cc \ |
| 1297 | $(PROFILER_UNITTEST_INCLUDES) |
| 1298 | profiler1_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS) |
| 1299 | profiler1_unittest_CXXFLAGS = -g -DNO_THREADS $(AM_CXXFLAGS) |
| 1300 | profiler1_unittest_LDADD = $(LIBPROFILER) |
| 1301 | profiler2_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS) |
| 1302 | profiler2_unittest_CXXFLAGS = -g -DNO_THREADS $(AM_CXXFLAGS) |
| 1303 | profiler2_unittest_LDADD = -lstacktrace -lprofiler |
| 1304 | # We depend on -lprofiler but haven't yet said how to build it. Do so now. |
| 1305 | profiler2_unittest_DEPENDENCIES = $(LIBPROFILER) |
| 1306 | profiler3_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS) |
| 1307 | profiler3_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 1308 | profiler3_unittest_LDFLAGS = $(PTHREAD_CFLAGS) |
| 1309 | profiler3_unittest_LDADD = $(LIBPROFILER) $(PTHREAD_LIBS) |
| 1310 | profiler4_unittest_SOURCES = $(PROFILER_UNITTEST_SRCS) |
| 1311 | profiler4_unittest_CXXFLAGS = -g $(PTHREAD_CFLAGS) $(AM_CXXFLAGS) |
| 1312 | profiler4_unittest_LDFLAGS = $(PTHREAD_CFLAGS) |
| 1313 | profiler4_unittest_LDADD = -lstacktrace -lprofiler $(PTHREAD_LIBS) |
| 1314 | # We depend on -lprofiler but haven't yet said how to build it. Do so now. |
| 1315 | profiler4_unittest_DEPENDENCIES = $(LIBPROFILER) |
| 1316 | |
| 1317 | |
| 1318 | ### Documentation |
| 1319 | dist_doc_DATA += doc/cpuprofile.html \ |
| 1320 | doc/cpuprofile-fileformat.html \ |
| 1321 | doc/pprof-test-big.gif \ |
| 1322 | doc/pprof-test.gif \ |
| 1323 | doc/pprof-vsnprintf-big.gif \ |
| 1324 | doc/pprof-vsnprintf.gif |
| 1325 | |
| 1326 | endif WITH_CPU_PROFILER |
| 1327 | |
| 1328 | |
| 1329 | ### ------- CPU profiler and heap checker, in one! |
| 1330 | |
| 1331 | # Ideally, folks who wanted to use both tcmalloc and libprofiler, |
| 1332 | # could just link them both into their application. But while this |
| 1333 | # works fine for .so files, it does not for .a files. The easiest way |
| 1334 | # around this -- and I've tried a bunch of the hard ways -- is to just |
| 1335 | # to create another set of libraries that has both functionality in it. |
| 1336 | |
| 1337 | if WITH_HEAP_PROFILER_OR_CHECKER |
| 1338 | if WITH_CPU_PROFILER |
| 1339 | |
| 1340 | lib_LTLIBRARIES += libtcmalloc_and_profiler.la |
| 1341 | libtcmalloc_and_profiler_la_SOURCES = $(libtcmalloc_la_SOURCES) $(libprofiler_la_SOURCES) |
| 1342 | libtcmalloc_and_profiler_la_CXXFLAGS = $(libtcmalloc_la_CXXFLAGS) $(libprofiler_la_CXXFLAGS) |
| 1343 | # Since this library is meant to be used as a .a, I don't worry as much |
| 1344 | # about .so versioning. I just give the libtcmalloc version number. |
| 1345 | # TODO(csilvers): use -export-symbols-regex? |
| 1346 | libtcmalloc_and_profiler_la_LDFLAGS = $(PTHREAD_CFLAGS) \ |
| 1347 | -version-info @TCMALLOC_SO_VERSION@ |
| 1348 | # We don't include libprofiler_la_LIBADD here because all it adds is |
| 1349 | # libstacktrace.la, which we already get via libtcmalloc. Trying to |
| 1350 | # specify it twice causes link-time duplicate-definition errors. :-( |
| 1351 | libtcmalloc_and_profiler_la_LIBADD = $(libtcmalloc_la_LIBADD) |
| 1352 | |
| 1353 | TESTS += tcmalloc_and_profiler_unittest |
| 1354 | tcmalloc_and_profiler_unittest_SOURCES = $(tcmalloc_both_unittest_srcs) |
| 1355 | tcmalloc_and_profiler_unittest_CXXFLAGS = $(tcmalloc_both_unittest_cflags) |
| 1356 | tcmalloc_and_profiler_unittest_LDFLAGS = $(tcmalloc_both_unittest_lflags) |
| 1357 | tcmalloc_and_profiler_unittest_LDADD = libtcmalloc_and_profiler.la |
| 1358 | |
| 1359 | LIBS_TO_WEAKEN += libtcmalloc_and_profiler.la |
| 1360 | |
| 1361 | endif WITH_CPU_PROFILER |
| 1362 | endif WITH_HEAP_PROFILER_OR_CHECKER |
| 1363 | |
| 1364 | ## ^^^^ END OF RULES TO MAKE YOUR LIBRARIES, BINARIES, AND UNITTESTS |
| 1365 | |
| 1366 | |
| 1367 | # Do the weakening on some exported libtcmalloc symbols. |
| 1368 | install-exec-local: all-local |
| 1369 | all-local: $(LIBS_TO_WEAKEN) |
| 1370 | for la in $(LIBS_TO_WEAKEN); do lib=".libs/`basename $$la .la`.a"; [ ! -f "$$lib" ] || $(WEAKEN) "$$lib"; done |
| 1371 | |
| 1372 | |
| 1373 | # This should always include $(TESTS), but may also include other |
| 1374 | # binaries that you compile but don't want automatically installed. |
| 1375 | # We'll add to this later, on a library-by-library basis |
| 1376 | noinst_PROGRAMS += $(TESTS) |
| 1377 | |
| 1378 | rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec |
| 1379 | @cd packages && ./rpm.sh ${PACKAGE} ${VERSION} |
| 1380 | |
| 1381 | deb: dist-gzip packages/deb.sh packages/deb/* |
| 1382 | @cd packages && ./deb.sh ${PACKAGE} ${VERSION} |
| 1383 | |
| 1384 | # http://linux.die.net/man/1/pkg-config, http://pkg-config.freedesktop.org/wiki |
| 1385 | pkgconfigdir = $(libdir)/pkgconfig |
| 1386 | pkgconfig_DATA = libtcmalloc.pc libtcmalloc_minimal.pc \ |
| 1387 | libtcmalloc_debug.pc libtcmalloc_minimal_debug.pc \ |
| 1388 | libprofiler.pc |
| 1389 | CLEANFILES = $(pkgconfig_DATA) |
| 1390 | |
| 1391 | # I get the description and URL lines from the rpm spec. I use sed to |
| 1392 | # try to rewrite exec_prefix, libdir, and includedir in terms of |
| 1393 | # prefix, if possible. |
| 1394 | libtcmalloc.pc: Makefile packages/rpm/rpm.spec |
| 1395 | echo 'prefix=$(prefix)' > "$@".tmp |
| 1396 | echo 'exec_prefix='`echo '$(exec_prefix)' | sed 's@^$(prefix)@$${prefix}@'` >> "$@".tmp |
| 1397 | echo 'libdir='`echo '$(libdir)' | sed 's@^$(exec_prefix)@$${exec_prefix}@'` >> "$@".tmp |
| 1398 | echo 'includedir='`echo '$(includedir)' | sed 's@^$(prefix)@$${prefix}@'` >> "$@".tmp |
| 1399 | echo '' >> "$@".tmp |
| 1400 | echo 'Name: $(PACKAGE)' >> "$@".tmp |
| 1401 | echo 'Version: $(VERSION)' >> "$@".tmp |
| 1402 | -grep '^Summary:' $(top_srcdir)/packages/rpm/rpm.spec | sed s/^Summary:/Description:/ | head -n1 >> "$@".tmp |
| 1403 | -grep '^URL: ' $(top_srcdir)/packages/rpm/rpm.spec >> "$@".tmp |
| 1404 | echo 'Requires:' >> "$@".tmp |
| 1405 | echo 'Libs: -L$${libdir} -ltcmalloc' >> "$@".tmp |
| 1406 | echo 'Libs.private: $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)' >> "$@".tmp |
| 1407 | echo 'Cflags: -I$${includedir}' >> "$@".tmp |
| 1408 | mv -f "$@".tmp "$@" |
| 1409 | |
| 1410 | # The other versions are mostly the same. |
| 1411 | libtcmalloc_minimal.pc: libtcmalloc.pc |
| 1412 | cat libtcmalloc.pc | sed s/-ltcmalloc/-ltcmalloc_minimal/ > "$@" |
| 1413 | |
| 1414 | libtcmalloc_debug.pc: libtcmalloc.pc |
| 1415 | cat libtcmalloc.pc | sed s/-ltcmalloc/-ltcmalloc_debug/ > "$@" |
| 1416 | |
| 1417 | libtcmalloc_minimal_debug.pc: libtcmalloc.pc |
| 1418 | cat libtcmalloc.pc | sed s/-ltcmalloc/-ltcmalloc_minimal_debug/ > "$@" |
| 1419 | |
| 1420 | libprofiler.pc: libtcmalloc.pc |
| 1421 | cat libtcmalloc.pc | sed s/-ltcmalloc/-lprofiler/ > "$@" |
| 1422 | |
| 1423 | libtool: $(LIBTOOL_DEPS) |
| 1424 | $(SHELL) ./config.status --recheck |
| 1425 | |
| 1426 | # Windows wants write permission to .vcproj files and maybe even sln files. |
| 1427 | dist-hook: |
| 1428 | test -e "$(distdir)/vsprojects" \ |
| 1429 | && chmod -R u+w $(distdir)/*.sln $(distdir)/vsprojects/ |
| 1430 | |
| 1431 | EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ |
| 1432 | $(SCRIPTS) libtool \ |
| 1433 | src/windows/get_mangled_names.cc src/windows/override_functions.cc \ |
| 1434 | src/windows/config.h src/windows/gperftools/tcmalloc.h \ |
| 1435 | doc/pprof.see_also src/windows/TODO \ |
| 1436 | $(WINDOWS_PROJECTS) \ |
| 1437 | src/solaris/libstdc++.la |