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