Home | History | Annotate | Line # | Download | only in dist
      1 # Clear out all vpaths, then set just one (default vpath) for the main build
      2 # directory.
      3 vpath
      4 vpath % .
      5 
      6 # Clear the default suffixes, so that built-in rules are not used.
      7 .SUFFIXES :
      8 
      9 SHELL := /bin/sh
     10 
     11 CC := gcc
     12 CXX := g++ -std=c++17
     13 
     14 # Configuration parameters.
     15 DESTDIR =
     16 BINDIR := $(DESTDIR)/usr/local/bin
     17 INCLUDEDIR := $(DESTDIR)/usr/local/include
     18 LIBDIR := $(DESTDIR)/usr/local/lib
     19 DATADIR := $(DESTDIR)/usr/local/share
     20 MANDIR := $(DESTDIR)/usr/local/share/man
     21 srcroot := 
     22 objroot := 
     23 abs_srcroot := /home/gdai/gdai-jemalloc/jemalloc-5.3.1/
     24 abs_objroot := /home/gdai/gdai-jemalloc/jemalloc-5.3.1/
     25 
     26 # Build parameters.
     27 CPPFLAGS := -D_GNU_SOURCE -D_REENTRANT -I$(objroot)include -I$(srcroot)include
     28 CONFIGURE_CFLAGS := -std=gnu11 -Wall -Wextra -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -Wno-missing-attributes -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -Wdeprecated-declarations -O3 -funroll-loops
     29 SPECIFIED_CFLAGS := 
     30 EXTRA_CFLAGS := 
     31 CFLAGS := $(strip $(CONFIGURE_CFLAGS) $(SPECIFIED_CFLAGS) $(EXTRA_CFLAGS))
     32 CONFIGURE_CXXFLAGS := -Wall -Wextra -g3 -fvisibility=hidden -Wimplicit-fallthrough -Wdeprecated-declarations -O3
     33 SPECIFIED_CXXFLAGS := 
     34 EXTRA_CXXFLAGS := 
     35 CXXFLAGS := $(strip $(CONFIGURE_CXXFLAGS) $(SPECIFIED_CXXFLAGS) $(EXTRA_CXXFLAGS))
     36 LDFLAGS := 
     37 EXTRA_LDFLAGS := 
     38 LIBS := -lm -lstdc++ -pthread
     39 RPATH_EXTRA := 
     40 SO := so
     41 IMPORTLIB := so
     42 O := o
     43 A := a
     44 EXE := 
     45 LIBPREFIX := lib
     46 REV := 2
     47 install_suffix := 
     48 ABI := elf
     49 XSLTPROC := /usr/bin/xsltproc
     50 XSLROOT := /usr/share/sgml/docbook/xsl-stylesheets
     51 AUTOCONF := /usr/bin/autoconf
     52 _RPATH = -Wl,-rpath,$(1)
     53 RPATH = $(if $(1),$(call _RPATH,$(1)))
     54 cfghdrs_in := $(addprefix $(srcroot),include/jemalloc/jemalloc_defs.h.in include/jemalloc/internal/jemalloc_internal_defs.h.in include/jemalloc/internal/private_symbols.sh include/jemalloc/internal/private_namespace.sh include/jemalloc/internal/public_namespace.sh include/jemalloc/internal/public_unnamespace.sh include/jemalloc/jemalloc_rename.sh include/jemalloc/jemalloc_mangle.sh include/jemalloc/jemalloc.sh test/include/test/jemalloc_test_defs.h.in)
     55 cfghdrs_out := include/jemalloc/jemalloc_defs.h include/jemalloc/jemalloc.h include/jemalloc/internal/private_symbols.awk include/jemalloc/internal/private_symbols_jet.awk include/jemalloc/internal/public_symbols.txt include/jemalloc/internal/public_namespace.h include/jemalloc/internal/public_unnamespace.h include/jemalloc/jemalloc_protos_jet.h include/jemalloc/jemalloc_rename.h include/jemalloc/jemalloc_mangle.h include/jemalloc/jemalloc_mangle_jet.h include/jemalloc/internal/jemalloc_internal_defs.h test/include/test/jemalloc_test_defs.h
     56 cfgoutputs_in := $(addprefix $(srcroot),Makefile.in jemalloc.pc.in doc/html.xsl.in doc/manpages.xsl.in doc/jemalloc.xml.in include/jemalloc/jemalloc_macros.h.in include/jemalloc/jemalloc_protos.h.in include/jemalloc/jemalloc_typedefs.h.in include/jemalloc/internal/jemalloc_preamble.h.in test/test.sh.in test/include/test/jemalloc_test.h.in)
     57 cfgoutputs_out := Makefile jemalloc.pc doc/html.xsl doc/manpages.xsl doc/jemalloc.xml include/jemalloc/jemalloc_macros.h include/jemalloc/jemalloc_protos.h include/jemalloc/jemalloc_typedefs.h include/jemalloc/internal/jemalloc_preamble.h test/test.sh test/include/test/jemalloc_test.h
     58 enable_autogen := 0
     59 enable_doc := 1
     60 enable_shared := 1
     61 enable_static := 1
     62 enable_prof := 0
     63 enable_zone_allocator := 
     64 enable_experimental_smallocx := 0
     65 MALLOC_CONF := MALLOC_CONF
     66 link_whole_archive := 0
     67 DSO_LDFLAGS = -shared -Wl,-soname,$(@F)
     68 SOREV = so.2
     69 PIC_CFLAGS = -fPIC -DPIC
     70 CTARGET = -o $@
     71 LDTARGET = -o $@
     72 TEST_LD_MODE = 
     73 MKLIB = 
     74 AR = ar
     75 ARFLAGS = crus
     76 DUMP_SYMS = nm -a
     77 AWK := gawk
     78 CC_MM = 1
     79 LM := -lm
     80 INSTALL = /usr/bin/install -c
     81 
     82 ifeq (macho, $(ABI))
     83 TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
     84 else
     85 ifeq (pecoff, $(ABI))
     86 TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
     87 else
     88 TEST_LIBRARY_PATH :=
     89 endif
     90 endif
     91 
     92 LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
     93 
     94 # Lists of files.
     95 BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof
     96 C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
     97 C_SRCS := $(srcroot)src/jemalloc.c \
     98 	$(srcroot)src/arena.c \
     99 	$(srcroot)src/background_thread.c \
    100 	$(srcroot)src/base.c \
    101 	$(srcroot)src/bin.c \
    102 	$(srcroot)src/bin_info.c \
    103 	$(srcroot)src/bitmap.c \
    104 	$(srcroot)src/buf_writer.c \
    105 	$(srcroot)src/cache_bin.c \
    106 	$(srcroot)src/ckh.c \
    107 	$(srcroot)src/counter.c \
    108 	$(srcroot)src/ctl.c \
    109 	$(srcroot)src/decay.c \
    110 	$(srcroot)src/div.c \
    111 	$(srcroot)src/ecache.c \
    112 	$(srcroot)src/edata.c \
    113 	$(srcroot)src/edata_cache.c \
    114 	$(srcroot)src/ehooks.c \
    115 	$(srcroot)src/emap.c \
    116 	$(srcroot)src/eset.c \
    117 	$(srcroot)src/exp_grow.c \
    118 	$(srcroot)src/extent.c \
    119 	$(srcroot)src/extent_dss.c \
    120 	$(srcroot)src/extent_mmap.c \
    121 	$(srcroot)src/fxp.c \
    122 	$(srcroot)src/san.c \
    123 	$(srcroot)src/san_bump.c \
    124 	$(srcroot)src/hook.c \
    125 	$(srcroot)src/hpa.c \
    126 	$(srcroot)src/hpa_central.c \
    127 	$(srcroot)src/hpa_hooks.c \
    128 	$(srcroot)src/hpa_utils.c \
    129 	$(srcroot)src/hpdata.c \
    130 	$(srcroot)src/inspect.c \
    131 	$(srcroot)src/large.c \
    132 	$(srcroot)src/log.c \
    133 	$(srcroot)src/malloc_io.c \
    134 	$(srcroot)src/conf.c \
    135 	$(srcroot)src/mutex.c \
    136 	$(srcroot)src/nstime.c \
    137 	$(srcroot)src/pa.c \
    138 	$(srcroot)src/pa_extra.c \
    139 	$(srcroot)src/pac.c \
    140 	$(srcroot)src/pages.c \
    141 	$(srcroot)src/peak_event.c \
    142 	$(srcroot)src/prof.c \
    143 	$(srcroot)src/prof_data.c \
    144 	$(srcroot)src/prof_log.c \
    145 	$(srcroot)src/prof_recent.c \
    146 	$(srcroot)src/prof_stack_range.c \
    147 	$(srcroot)src/prof_stats.c \
    148 	$(srcroot)src/prof_sys.c \
    149 	$(srcroot)src/psset.c \
    150 	$(srcroot)src/rtree.c \
    151 	$(srcroot)src/safety_check.c \
    152 	$(srcroot)src/sc.c \
    153 	$(srcroot)src/sec.c \
    154 	$(srcroot)src/stats.c \
    155 	$(srcroot)src/sz.c \
    156 	$(srcroot)src/tcache.c \
    157 	$(srcroot)src/test_hooks.c \
    158 	$(srcroot)src/thread_event.c \
    159 	$(srcroot)src/thread_event_registry.c \
    160 	$(srcroot)src/ticker.c \
    161 	$(srcroot)src/tsd.c \
    162 	$(srcroot)src/util.c \
    163 	$(srcroot)src/witness.c
    164 ifeq ($(enable_zone_allocator), 1)
    165 C_SRCS += $(srcroot)src/zone.c
    166 endif
    167 ifeq ($(IMPORTLIB),$(SO))
    168 STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
    169 endif
    170 ifdef PIC_CFLAGS
    171 STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
    172 else
    173 STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
    174 endif
    175 DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
    176 ifneq ($(SOREV),$(SO))
    177 DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
    178 endif
    179 ifeq (1, $(link_whole_archive))
    180 LJEMALLOC := -Wl,--whole-archive -L$(objroot)lib -l$(LIBJEMALLOC) -Wl,--no-whole-archive
    181 else
    182 LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
    183 endif
    184 PC := $(objroot)jemalloc.pc
    185 DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
    186 DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html)
    187 DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3)
    188 DOCS := $(DOCS_HTML) $(DOCS_MAN3)
    189 C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
    190 	$(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \
    191 	$(srcroot)test/src/mtx.c $(srcroot)test/src/sleep.c \
    192 	$(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \
    193 	$(srcroot)test/src/thd.c $(srcroot)test/src/timer.c
    194 ifeq (1, $(link_whole_archive))
    195 C_UTIL_INTEGRATION_SRCS :=
    196 C_UTIL_CPP_SRCS :=
    197 else
    198 C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c \
    199 	$(srcroot)src/ticker.c
    200 C_UTIL_CPP_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c
    201 endif
    202 TESTS_UNIT := \
    203 	$(srcroot)test/unit/a0.c \
    204 	$(srcroot)test/unit/arena_decay.c \
    205 	$(srcroot)test/unit/arena_reset.c \
    206 	$(srcroot)test/unit/atomic.c \
    207 	$(srcroot)test/unit/background_thread.c \
    208 	$(srcroot)test/unit/background_thread_enable.c \
    209 	$(srcroot)test/unit/background_thread_init.c \
    210 	$(srcroot)test/unit/base.c \
    211 	$(srcroot)test/unit/batch_alloc.c \
    212 	$(srcroot)test/unit/bin.c \
    213 	$(srcroot)test/unit/binshard.c \
    214 	$(srcroot)test/unit/bitmap.c \
    215 	$(srcroot)test/unit/bit_util.c \
    216 	$(srcroot)test/unit/buf_writer.c \
    217 	$(srcroot)test/unit/cache_bin.c \
    218 	$(srcroot)test/unit/ckh.c \
    219 	$(srcroot)test/unit/conf.c \
    220 	$(srcroot)test/unit/conf_init_0.c \
    221 	$(srcroot)test/unit/conf_init_1.c \
    222 	$(srcroot)test/unit/conf_init_confirm.c \
    223 	$(srcroot)test/unit/conf_parse.c \
    224 	$(srcroot)test/unit/counter.c \
    225 	$(srcroot)test/unit/decay.c \
    226 	$(srcroot)test/unit/div.c \
    227 	$(srcroot)test/unit/double_free.c \
    228 	$(srcroot)test/unit/edata_cache.c \
    229 	$(srcroot)test/unit/emitter.c \
    230 	$(srcroot)test/unit/extent_quantize.c \
    231 	${srcroot}test/unit/fb.c \
    232 	$(srcroot)test/unit/fork.c \
    233 	${srcroot}test/unit/fxp.c \
    234 	${srcroot}test/unit/san.c \
    235 	${srcroot}test/unit/san_bump.c \
    236 	$(srcroot)test/unit/hash.c \
    237 	$(srcroot)test/unit/hook.c \
    238 	$(srcroot)test/unit/hpa.c \
    239 	$(srcroot)test/unit/hpa_sec_integration.c \
    240 	$(srcroot)test/unit/hpa_thp_always.c \
    241 	$(srcroot)test/unit/hpa_vectorized_madvise.c \
    242 	$(srcroot)test/unit/hpa_vectorized_madvise_large_batch.c \
    243 	$(srcroot)test/unit/hpa_background_thread.c \
    244 	$(srcroot)test/unit/hpdata.c \
    245 	$(srcroot)test/unit/huge.c \
    246 	$(srcroot)test/unit/inspect.c \
    247 	$(srcroot)test/unit/junk.c \
    248 	$(srcroot)test/unit/junk_alloc.c \
    249 	$(srcroot)test/unit/junk_free.c \
    250 	$(srcroot)test/unit/json_stats.c \
    251 	$(srcroot)test/unit/large_ralloc.c \
    252 	$(srcroot)test/unit/log.c \
    253 	$(srcroot)test/unit/mallctl.c \
    254 	$(srcroot)test/unit/malloc_conf_2.c \
    255 	$(srcroot)test/unit/malloc_io.c \
    256 	$(srcroot)test/unit/math.c \
    257 	$(srcroot)test/unit/mpsc_queue.c \
    258 	$(srcroot)test/unit/mq.c \
    259 	$(srcroot)test/unit/mtx.c \
    260 	$(srcroot)test/unit/nstime.c \
    261 	$(srcroot)test/unit/ncached_max.c \
    262 	$(srcroot)test/unit/oversize_threshold.c \
    263 	$(srcroot)test/unit/pa.c \
    264 	$(srcroot)test/unit/pack.c \
    265 	$(srcroot)test/unit/pages.c \
    266 	$(srcroot)test/unit/peak.c \
    267 	$(srcroot)test/unit/ph.c \
    268 	$(srcroot)test/unit/prng.c \
    269 	$(srcroot)test/unit/prof_accum.c \
    270 	$(srcroot)test/unit/prof_active.c \
    271 	$(srcroot)test/unit/prof_gdump.c \
    272 	$(srcroot)test/unit/prof_hook.c \
    273 	$(srcroot)test/unit/prof_idump.c \
    274 	$(srcroot)test/unit/prof_log.c \
    275 	$(srcroot)test/unit/prof_mdump.c \
    276 	$(srcroot)test/unit/prof_recent.c \
    277 	$(srcroot)test/unit/prof_reset.c \
    278 	$(srcroot)test/unit/prof_small.c \
    279 	$(srcroot)test/unit/prof_stats.c \
    280 	$(srcroot)test/unit/prof_tctx.c \
    281 	$(srcroot)test/unit/prof_thread_name.c \
    282 	$(srcroot)test/unit/prof_sys_thread_name.c \
    283 	$(srcroot)test/unit/psset.c \
    284 	$(srcroot)test/unit/ql.c \
    285 	$(srcroot)test/unit/qr.c \
    286 	$(srcroot)test/unit/rb.c \
    287 	$(srcroot)test/unit/retained.c \
    288 	$(srcroot)test/unit/rtree.c \
    289 	$(srcroot)test/unit/safety_check.c \
    290 	$(srcroot)test/unit/sc.c \
    291 	$(srcroot)test/unit/sec.c \
    292 	$(srcroot)test/unit/seq.c \
    293 	$(srcroot)test/unit/SFMT.c \
    294 	$(srcroot)test/unit/size_check.c \
    295 	$(srcroot)test/unit/size_classes.c \
    296 	$(srcroot)test/unit/slab.c \
    297 	$(srcroot)test/unit/smoothstep.c \
    298 	$(srcroot)test/unit/spin.c \
    299 	$(srcroot)test/unit/stats.c \
    300 	$(srcroot)test/unit/stats_print.c \
    301 	$(srcroot)test/unit/sz.c \
    302 	$(srcroot)test/unit/tcache_init.c \
    303 	$(srcroot)test/unit/tcache_max.c \
    304 	$(srcroot)test/unit/test_hooks.c \
    305 	$(srcroot)test/unit/thread_event.c \
    306 	$(srcroot)test/unit/ticker.c \
    307 	$(srcroot)test/unit/tsd.c \
    308 	$(srcroot)test/unit/uaf.c \
    309 	$(srcroot)test/unit/witness.c \
    310 	$(srcroot)test/unit/zero.c \
    311 	$(srcroot)test/unit/zero_realloc_abort.c \
    312 	$(srcroot)test/unit/zero_realloc_free.c \
    313 	$(srcroot)test/unit/zero_realloc_alloc.c \
    314 	$(srcroot)test/unit/zero_reallocs.c
    315 ifeq (0, 1)
    316 TESTS_UNIT += \
    317 	$(srcroot)test/unit/arena_reset_prof.c \
    318 	$(srcroot)test/unit/batch_alloc_prof.c
    319 endif
    320 TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
    321 	$(srcroot)test/integration/allocated.c \
    322 	$(srcroot)test/integration/extent.c \
    323 	$(srcroot)test/integration/malloc.c \
    324 	$(srcroot)test/integration/mallocx.c \
    325 	$(srcroot)test/integration/MALLOCX_ARENA.c \
    326 	$(srcroot)test/integration/overflow.c \
    327 	$(srcroot)test/integration/posix_memalign.c \
    328 	$(srcroot)test/integration/rallocx.c \
    329 	$(srcroot)test/integration/sdallocx.c \
    330 	$(srcroot)test/integration/slab_sizes.c \
    331 	$(srcroot)test/integration/thread_arena.c \
    332 	$(srcroot)test/integration/thread_tcache_enabled.c \
    333 	$(srcroot)test/integration/xallocx.c
    334 ifeq (0, 1)
    335 TESTS_INTEGRATION += \
    336   $(srcroot)test/integration/smallocx.c
    337 endif
    338 ifeq (1, 1)
    339 CPP_SRCS := $(srcroot)src/jemalloc_cpp.cpp
    340 TESTS_INTEGRATION_CPP := $(srcroot)test/integration/cpp/basic.cpp \
    341 	$(srcroot)test/integration/cpp/infallible_new_true.cpp \
    342 	$(srcroot)test/integration/cpp/infallible_new_false.cpp
    343 else
    344 CPP_SRCS :=
    345 TESTS_INTEGRATION_CPP :=
    346 endif
    347 TESTS_ANALYZE := $(srcroot)test/analyze/prof_bias.c \
    348 	$(srcroot)test/analyze/rand.c \
    349 	$(srcroot)test/analyze/sizes.c
    350 TESTS_STRESS := $(srcroot)test/stress/batch_alloc.c \
    351 	$(srcroot)test/stress/fill_flush.c \
    352 	$(srcroot)test/stress/hookbench.c \
    353 	$(srcroot)test/stress/large_microbench.c \
    354 	$(srcroot)test/stress/mallctl.c \
    355 	$(srcroot)test/stress/microbench.c
    356 ifeq (1, 1)
    357 TESTS_STRESS_CPP := $(srcroot)test/stress/cpp/microbench.cpp
    358 else
    359 TESTS_STRESS_CPP :=
    360 endif
    361 
    362 
    363 TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_INTEGRATION_CPP) \
    364 	$(TESTS_ANALYZE) $(TESTS_STRESS) $(TESTS_STRESS_CPP)
    365 
    366 PRIVATE_NAMESPACE_HDRS := $(objroot)include/jemalloc/internal/private_namespace.h $(objroot)include/jemalloc/internal/private_namespace_jet.h
    367 PRIVATE_NAMESPACE_GEN_HDRS := $(PRIVATE_NAMESPACE_HDRS:%.h=%.gen.h)
    368 C_SYM_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.sym.$(O))
    369 C_SYMS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.sym)
    370 C_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.$(O))
    371 CPP_OBJS := $(CPP_SRCS:$(srcroot)%.cpp=$(objroot)%.$(O))
    372 C_PIC_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
    373 CPP_PIC_OBJS := $(CPP_SRCS:$(srcroot)%.cpp=$(objroot)%.pic.$(O))
    374 C_JET_SYM_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.sym.$(O))
    375 C_JET_SYMS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.sym)
    376 C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O))
    377 C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O))
    378 C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
    379 C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
    380 C_TESTLIB_ANALYZE_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.analyze.$(O))
    381 C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O))
    382 C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) \
    383 	$(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_ANALYZE_OBJS) \
    384 	$(C_TESTLIB_STRESS_OBJS)
    385 
    386 TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O))
    387 TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O))
    388 TESTS_INTEGRATION_CPP_OBJS := $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%.$(O))
    389 TESTS_ANALYZE_OBJS := $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%.$(O))
    390 TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O))
    391 TESTS_STRESS_CPP_OBJS := $(TESTS_STRESS_CPP:$(srcroot)%.cpp=$(objroot)%.$(O))
    392 TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_ANALYZE_OBJS) \
    393 	$(TESTS_STRESS_OBJS)
    394 TESTS_CPP_OBJS := $(TESTS_INTEGRATION_CPP_OBJS) $(TESTS_STRESS_CPP_OBJS)
    395 
    396 .PHONY: all dist build_doc_html build_doc_man build_doc
    397 .PHONY: install_bin install_include install_lib
    398 .PHONY: install_doc_html install_doc_man install_doc install
    399 .PHONY: tests check clean distclean relclean
    400 
    401 .SECONDARY : $(PRIVATE_NAMESPACE_GEN_HDRS) $(TESTS_OBJS) $(TESTS_CPP_OBJS)
    402 
    403 # Default target.
    404 all: build_lib
    405 
    406 dist: build_doc
    407 
    408 $(objroot)doc/%$(install_suffix).html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
    409 ifneq ($(XSLROOT),)
    410 	$(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
    411 else
    412 ifeq ($(wildcard $(DOCS_HTML)),)
    413 	@echo "<p>Missing xsltproc.  Doc not built.</p>" > $@
    414 endif
    415 	@echo "Missing xsltproc.  "$@" not (re)built."
    416 endif
    417 
    418 $(objroot)doc/%$(install_suffix).3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
    419 ifneq ($(XSLROOT),)
    420 	$(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
    421 # The -o option (output filename) of xsltproc may not work (it uses the
    422 # <refname> in the .xml file).  Manually add the suffix if so.
    423   ifneq ($(install_suffix),)
    424 	@if [ -f $(objroot)doc/jemalloc.3 ]; then \
    425 		mv $(objroot)doc/jemalloc.3 $(objroot)doc/jemalloc$(install_suffix).3 ; \
    426 	fi
    427   endif
    428 else
    429 ifeq ($(wildcard $(DOCS_MAN3)),)
    430 	@echo "Missing xsltproc.  Doc not built." > $@
    431 endif
    432 	@echo "Missing xsltproc.  "$@" not (re)built."
    433 endif
    434 
    435 build_doc_html: $(DOCS_HTML)
    436 build_doc_man: $(DOCS_MAN3)
    437 build_doc: $(DOCS)
    438 
    439 #
    440 # Include generated dependency files.
    441 #
    442 ifdef CC_MM
    443 -include $(C_SYM_OBJS:%.$(O)=%.d)
    444 -include $(C_OBJS:%.$(O)=%.d)
    445 -include $(CPP_OBJS:%.$(O)=%.d)
    446 -include $(C_PIC_OBJS:%.$(O)=%.d)
    447 -include $(CPP_PIC_OBJS:%.$(O)=%.d)
    448 -include $(C_JET_SYM_OBJS:%.$(O)=%.d)
    449 -include $(C_JET_OBJS:%.$(O)=%.d)
    450 -include $(C_TESTLIB_OBJS:%.$(O)=%.d)
    451 -include $(TESTS_OBJS:%.$(O)=%.d)
    452 -include $(TESTS_CPP_OBJS:%.$(O)=%.d)
    453 endif
    454 
    455 $(C_SYM_OBJS): $(objroot)src/%.sym.$(O): $(srcroot)src/%.c
    456 $(C_SYM_OBJS): CPPFLAGS += -DJEMALLOC_NO_PRIVATE_NAMESPACE
    457 $(C_SYMS): $(objroot)src/%.sym: $(objroot)src/%.sym.$(O)
    458 $(C_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
    459 $(CPP_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.cpp
    460 $(C_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
    461 $(C_PIC_OBJS): CFLAGS += $(PIC_CFLAGS)
    462 $(CPP_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.cpp
    463 $(CPP_PIC_OBJS): CXXFLAGS += $(PIC_CFLAGS)
    464 $(C_JET_SYM_OBJS): $(objroot)src/%.jet.sym.$(O): $(srcroot)src/%.c
    465 $(C_JET_SYM_OBJS): CPPFLAGS += -DJEMALLOC_JET -DJEMALLOC_NO_PRIVATE_NAMESPACE
    466 $(C_JET_SYMS): $(objroot)src/%.jet.sym: $(objroot)src/%.jet.sym.$(O)
    467 $(C_JET_OBJS): $(objroot)src/%.jet.$(O): $(srcroot)src/%.c
    468 $(C_JET_OBJS): CPPFLAGS += -DJEMALLOC_JET
    469 $(C_TESTLIB_UNIT_OBJS): $(objroot)test/src/%.unit.$(O): $(srcroot)test/src/%.c
    470 $(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
    471 $(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c
    472 $(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
    473 $(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c
    474 $(C_TESTLIB_ANALYZE_OBJS): $(objroot)test/src/%.analyze.$(O): $(srcroot)test/src/%.c
    475 $(C_TESTLIB_ANALYZE_OBJS): CPPFLAGS += -DJEMALLOC_ANALYZE_TEST
    476 $(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c
    477 $(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB
    478 $(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
    479 $(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
    480 $(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
    481 $(TESTS_INTEGRATION_CPP_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_CPP_TEST
    482 $(TESTS_ANALYZE_OBJS): CPPFLAGS += -DJEMALLOC_ANALYZE_TEST
    483 $(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST
    484 $(TESTS_STRESS_CPP_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_CPP_TEST
    485 $(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
    486 $(TESTS_CPP_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.cpp
    487 $(TESTS_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
    488 $(TESTS_CPP_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
    489 $(TESTS_OBJS): CFLAGS += -fno-builtin
    490 $(TESTS_CPP_OBJS): CPPFLAGS += -fno-builtin
    491 ifneq ($(IMPORTLIB),$(SO))
    492 $(CPP_OBJS) $(C_SYM_OBJS) $(C_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS): CPPFLAGS += -DDLLEXPORT
    493 endif
    494 
    495 # Dependencies.
    496 ifndef CC_MM
    497 HEADER_DIRS = $(srcroot)include/jemalloc/internal \
    498 	$(objroot)include/jemalloc $(objroot)include/jemalloc/internal
    499 HEADERS = $(filter-out $(PRIVATE_NAMESPACE_HDRS),$(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h)))
    500 $(C_SYM_OBJS) $(C_OBJS) $(CPP_OBJS) $(C_PIC_OBJS) $(CPP_PIC_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS) $(TESTS_CPP_OBJS): $(HEADERS)
    501 $(TESTS_OBJS) $(TESTS_CPP_OBJS): $(objroot)test/include/test/jemalloc_test.h
    502 endif
    503 
    504 $(C_OBJS) $(CPP_OBJS) $(C_PIC_OBJS) $(CPP_PIC_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_INTEGRATION_CPP_OBJS): $(objroot)include/jemalloc/internal/private_namespace.h
    505 $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_ANALYZE_OBJS) $(C_TESTLIB_STRESS_OBJS) $(TESTS_UNIT_OBJS) $(TESTS_ANALYZE_OBJS) $(TESTS_STRESS_OBJS) $(TESTS_STRESS_CPP_OBJS): $(objroot)include/jemalloc/internal/private_namespace_jet.h
    506 
    507 $(C_SYM_OBJS) $(C_OBJS) $(C_PIC_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O):
    508 	@mkdir -p $(@D)
    509 	$(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
    510 ifdef CC_MM
    511 	@$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
    512 endif
    513 
    514 $(C_SYMS): %.sym:
    515 	@mkdir -p $(@D)
    516 	$(DUMP_SYMS) $< | $(AWK) -f $(objroot)include/jemalloc/internal/private_symbols.awk > $@
    517 
    518 $(C_JET_SYMS): %.sym:
    519 	@mkdir -p $(@D)
    520 	$(DUMP_SYMS) $< | $(AWK) -f $(objroot)include/jemalloc/internal/private_symbols_jet.awk > $@
    521 
    522 $(objroot)include/jemalloc/internal/private_namespace.gen.h: $(C_SYMS)
    523 	$(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@
    524 
    525 $(objroot)include/jemalloc/internal/private_namespace_jet.gen.h: $(C_JET_SYMS)
    526 	$(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@
    527 
    528 %.h: %.gen.h
    529 	@if ! `cmp -s $< $@` ; then echo "cp $< $@"; cp $< $@ ; fi
    530 
    531 $(CPP_OBJS) $(CPP_PIC_OBJS) $(TESTS_CPP_OBJS): %.$(O):
    532 	@mkdir -p $(@D)
    533 	$(CXX) $(CXXFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
    534 ifdef CC_MM
    535 	@$(CXX) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
    536 endif
    537 
    538 ifneq ($(SOREV),$(SO))
    539 %.$(SO) : %.$(SOREV)
    540 	@mkdir -p $(@D)
    541 	ln -sf $(<F) $@
    542 endif
    543 
    544 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(C_PIC_OBJS),$(C_OBJS)) $(if $(PIC_CFLAGS),$(CPP_PIC_OBJS),$(CPP_OBJS))
    545 	@mkdir -p $(@D)
    546 ifeq (1, 1)
    547 	$(CXX) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
    548 else
    549 	$(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
    550 endif
    551 
    552 $(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(C_PIC_OBJS) $(CPP_PIC_OBJS)
    553 $(objroot)lib/$(LIBJEMALLOC).$(A) : $(C_OBJS) $(CPP_OBJS)
    554 $(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(C_OBJS) $(CPP_OBJS)
    555 
    556 $(STATIC_LIBS):
    557 	@mkdir -p $(@D)
    558 	$(AR) $(ARFLAGS) $@ $+
    559 
    560 $(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS)
    561 	@mkdir -p $(@D)
    562 	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
    563 
    564 $(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
    565 	@mkdir -p $(@D)
    566 	$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -pthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
    567 
    568 $(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
    569 	@mkdir -p $(@D)
    570 	$(CXX) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS)
    571 
    572 $(objroot)test/analyze/%$(EXE): $(objroot)test/analyze/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_ANALYZE_OBJS)
    573 	@mkdir -p $(@D)
    574 	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
    575 
    576 $(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
    577 	@mkdir -p $(@D)
    578 	$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
    579 
    580 $(objroot)test/stress/pa/pa_data_preprocessor$(EXE): $(objroot)test/stress/pa/pa_data_preprocessor.$(O)
    581 	@mkdir -p $(@D)
    582 	$(CXX) $(LDTARGET) $(filter %.$(O),$^) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
    583 
    584 $(objroot)test/stress/pa/pa_microbench$(EXE): $(objroot)test/stress/pa/pa_microbench.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS)
    585 	@mkdir -p $(@D)
    586 	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
    587 
    588 $(objroot)test/stress/pa/%.$(O): $(srcroot)test/stress/pa/%.c
    589 	@mkdir -p $(@D)
    590 	$(CC) $(CFLAGS) -c $(CPPFLAGS) -DJEMALLOC_STRESS_TEST -I$(srcroot)test/include -I$(objroot)test/include $(CTARGET) $<
    591 ifdef CC_MM
    592 	@$(CC) -MM $(CPPFLAGS) -DJEMALLOC_STRESS_TEST -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
    593 endif
    594 
    595 $(objroot)test/stress/pa/%.$(O): $(srcroot)test/stress/pa/%.cpp
    596 	@mkdir -p $(@D)
    597 	$(CXX) $(CXXFLAGS) -c $(CPPFLAGS) -I$(srcroot)test/include -I$(objroot)test/include $(CTARGET) $<
    598 ifdef CC_MM
    599 	@$(CXX) -MM $(CPPFLAGS) -I$(srcroot)test/include -I$(objroot)test/include -MT $@ -o $(@:%.$(O)=%.d) $<
    600 endif
    601 
    602 build_lib_shared: $(DSOS)
    603 build_lib_static: $(STATIC_LIBS)
    604 ifeq ($(enable_shared), 1)
    605 build_lib: build_lib_shared
    606 endif
    607 ifeq ($(enable_static), 1)
    608 build_lib: build_lib_static
    609 endif
    610 
    611 install_bin:
    612 	$(INSTALL) -d $(BINDIR)
    613 	@for b in $(BINS); do \
    614 	echo "$(INSTALL) -m 755 $$b $(BINDIR)"; \
    615 	$(INSTALL) -m 755 $$b $(BINDIR); \
    616 done
    617 
    618 install_include:
    619 	$(INSTALL) -d $(INCLUDEDIR)/jemalloc
    620 	@for h in $(C_HDRS); do \
    621 	echo "$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
    622 	$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc; \
    623 done
    624 
    625 install_lib_shared: $(DSOS)
    626 	$(INSTALL) -d $(LIBDIR)
    627 	$(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
    628 ifneq ($(SOREV),$(SO))
    629 	ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
    630 endif
    631 
    632 install_lib_static: $(STATIC_LIBS)
    633 	$(INSTALL) -d $(LIBDIR)
    634 	@for l in $(STATIC_LIBS); do \
    635 	echo "$(INSTALL) -m 755 $$l $(LIBDIR)"; \
    636 	$(INSTALL) -m 755 $$l $(LIBDIR); \
    637 done
    638 
    639 install_lib_pc: $(PC)
    640 	$(INSTALL) -d $(LIBDIR)/pkgconfig
    641 	@for l in $(PC); do \
    642 	echo "$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig"; \
    643 	$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
    644 done
    645 
    646 ifeq ($(enable_shared), 1)
    647 install_lib: install_lib_shared
    648 endif
    649 ifeq ($(enable_static), 1)
    650 install_lib: install_lib_static
    651 endif
    652 install_lib: install_lib_pc
    653 
    654 install_doc_html: build_doc_html
    655 	$(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
    656 	@for d in $(DOCS_HTML); do \
    657 	echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
    658 	$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
    659 done
    660 
    661 install_doc_man: build_doc_man
    662 	$(INSTALL) -d $(MANDIR)/man3
    663 	@for d in $(DOCS_MAN3); do \
    664 	echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \
    665 	$(INSTALL) -m 644 $$d $(MANDIR)/man3; \
    666 done
    667 
    668 install_doc: install_doc_html install_doc_man
    669 
    670 install: install_bin install_include install_lib
    671 
    672 ifeq ($(enable_doc), 1)
    673 install: install_doc
    674 endif
    675 
    676 uninstall_bin:
    677 	$(RM) -v $(foreach b,$(notdir $(BINS)),$(BINDIR)/$(b))
    678 
    679 uninstall_include:
    680 	$(RM) -v $(foreach h,$(notdir $(C_HDRS)),$(INCLUDEDIR)/jemalloc/$(h))
    681 	rmdir -v $(INCLUDEDIR)/jemalloc
    682 
    683 uninstall_lib_shared:
    684 	$(RM) -v $(LIBDIR)/$(LIBJEMALLOC).$(SOREV)
    685 ifneq ($(SOREV),$(SO))
    686 	$(RM) -v $(LIBDIR)/$(LIBJEMALLOC).$(SO)
    687 endif
    688 
    689 uninstall_lib_static:
    690 	$(RM) -v $(foreach l,$(notdir $(STATIC_LIBS)),$(LIBDIR)/$(l))
    691 
    692 uninstall_lib_pc:
    693 	$(RM) -v $(foreach p,$(notdir $(PC)),$(LIBDIR)/pkgconfig/$(p))
    694 
    695 ifeq ($(enable_shared), 1)
    696 uninstall_lib: uninstall_lib_shared
    697 endif
    698 ifeq ($(enable_static), 1)
    699 uninstall_lib: uninstall_lib_static
    700 endif
    701 uninstall_lib: uninstall_lib_pc
    702 
    703 uninstall_doc_html:
    704 	$(RM) -v $(foreach d,$(notdir $(DOCS_HTML)),$(DATADIR)/doc/jemalloc$(install_suffix)/$(d))
    705 	rmdir -v $(DATADIR)/doc/jemalloc$(install_suffix)
    706 
    707 uninstall_doc_man:
    708 	$(RM) -v $(foreach d,$(notdir $(DOCS_MAN3)),$(MANDIR)/man3/$(d))
    709 
    710 uninstall_doc: uninstall_doc_html uninstall_doc_man
    711 
    712 uninstall: uninstall_bin uninstall_include uninstall_lib
    713 
    714 ifeq ($(enable_doc), 1)
    715 uninstall: uninstall_doc
    716 endif
    717 
    718 tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
    719 tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE))
    720 tests_analyze: $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%$(EXE))
    721 tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_STRESS_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE))
    722 tests_pa: $(objroot)test/stress/pa/pa_data_preprocessor$(EXE) $(objroot)test/stress/pa/pa_microbench$(EXE)
    723 tests: tests_unit tests_integration tests_analyze tests_stress
    724 
    725 check_unit_dir:
    726 	@mkdir -p $(objroot)test/unit
    727 check_integration_dir:
    728 	@mkdir -p $(objroot)test/integration
    729 analyze_dir:
    730 	@mkdir -p $(objroot)test/analyze
    731 stress_dir:
    732 	@mkdir -p $(objroot)test/stress
    733 check_dir: check_unit_dir check_integration_dir
    734 
    735 check_unit: tests_unit check_unit_dir
    736 	$(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
    737 check_integration_prof: tests_integration check_integration_dir
    738 ifeq ($(enable_prof), 1)
    739 	$(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
    740 	$(MALLOC_CONF)="prof:true,prof_active:false" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
    741 endif
    742 check_integration_decay: tests_integration check_integration_dir
    743 	$(MALLOC_CONF)="dirty_decay_ms:-1,muzzy_decay_ms:-1" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
    744 	$(MALLOC_CONF)="dirty_decay_ms:0,muzzy_decay_ms:0" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
    745 check_integration: tests_integration check_integration_dir
    746 	$(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
    747 analyze: tests_analyze analyze_dir
    748 ifeq ($(enable_prof), 1)
    749 	$(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%)
    750 else
    751 	$(SHELL) $(objroot)test/test.sh $(TESTS_ANALYZE:$(srcroot)%.c=$(objroot)%)
    752 endif
    753 stress: tests_stress stress_dir
    754 	$(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
    755 	$(SHELL) $(objroot)test/test.sh $(TESTS_STRESS_CPP:$(srcroot)%.cpp=$(objroot)%)
    756 check: check_unit check_integration check_integration_decay check_integration_prof
    757 
    758 clean:
    759 	rm -f $(PRIVATE_NAMESPACE_HDRS)
    760 	rm -f $(PRIVATE_NAMESPACE_GEN_HDRS)
    761 	rm -f $(C_SYM_OBJS)
    762 	rm -f $(C_SYMS)
    763 	rm -f $(C_OBJS)
    764 	rm -f $(CPP_OBJS)
    765 	rm -f $(C_PIC_OBJS)
    766 	rm -f $(CPP_PIC_OBJS)
    767 	rm -f $(C_JET_SYM_OBJS)
    768 	rm -f $(C_JET_SYMS)
    769 	rm -f $(C_JET_OBJS)
    770 	rm -f $(C_TESTLIB_OBJS)
    771 	rm -f $(C_SYM_OBJS:%.$(O)=%.d)
    772 	rm -f $(C_OBJS:%.$(O)=%.d)
    773 	rm -f $(CPP_OBJS:%.$(O)=%.d)
    774 	rm -f $(C_PIC_OBJS:%.$(O)=%.d)
    775 	rm -f $(CPP_PIC_OBJS:%.$(O)=%.d)
    776 	rm -f $(C_JET_SYM_OBJS:%.$(O)=%.d)
    777 	rm -f $(C_JET_OBJS:%.$(O)=%.d)
    778 	rm -f $(C_TESTLIB_OBJS:%.$(O)=%.d)
    779 	rm -f $(TESTS_OBJS:%.$(O)=%$(EXE))
    780 	rm -f $(TESTS_OBJS)
    781 	rm -f $(TESTS_OBJS:%.$(O)=%.d)
    782 	rm -f $(TESTS_OBJS:%.$(O)=%.out)
    783 	rm -f $(TESTS_CPP_OBJS:%.$(O)=%$(EXE))
    784 	rm -f $(TESTS_CPP_OBJS)
    785 	rm -f $(TESTS_CPP_OBJS:%.$(O)=%.d)
    786 	rm -f $(TESTS_CPP_OBJS:%.$(O)=%.out)
    787 	rm -f $(DSOS) $(STATIC_LIBS)
    788 
    789 distclean: clean
    790 	rm -f $(objroot)bin/jemalloc-config
    791 	rm -f $(objroot)bin/jemalloc.sh
    792 	rm -f $(objroot)bin/jeprof
    793 	rm -f $(objroot)config.log
    794 	rm -f $(objroot)config.status
    795 	rm -f $(objroot)config.stamp
    796 	rm -f $(cfghdrs_out)
    797 	rm -f $(cfgoutputs_out)
    798 
    799 relclean: distclean
    800 	rm -f $(objroot)configure
    801 	rm -f $(objroot)VERSION
    802 	rm -f $(DOCS_HTML)
    803 	rm -f $(DOCS_MAN3)
    804 
    805 #===============================================================================
    806 # Re-configuration rules.
    807 
    808 ifeq ($(enable_autogen), 1)
    809 $(srcroot)configure : $(srcroot)configure.ac
    810 	cd ./$(srcroot) && $(AUTOCONF)
    811 
    812 $(objroot)config.status : $(srcroot)configure
    813 	./$(objroot)config.status --recheck
    814 
    815 $(srcroot)config.stamp.in : $(srcroot)configure.ac
    816 	echo stamp > $(srcroot)config.stamp.in
    817 
    818 $(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
    819 	./$(objroot)config.status
    820 	@touch $@
    821 
    822 # There must be some action in order for make to re-read Makefile when it is
    823 # out of date.
    824 $(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
    825 	@true
    826 endif
    827