2
0

Makefile.in 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. # Clear out all vpaths, then set just one (default vpath) for the main build
  2. # directory.
  3. vpath
  4. vpath % .
  5. # Clear the default suffixes, so that built-in rules are not used.
  6. .SUFFIXES :
  7. SHELL := /bin/sh
  8. CC := @CC@
  9. CXX := @CXX@
  10. # Configuration parameters.
  11. DESTDIR =
  12. BINDIR := $(DESTDIR)@BINDIR@
  13. INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
  14. LIBDIR := $(DESTDIR)@LIBDIR@
  15. DATADIR := $(DESTDIR)@DATADIR@
  16. MANDIR := $(DESTDIR)@MANDIR@
  17. srcroot := @srcroot@
  18. objroot := @objroot@
  19. abs_srcroot := @abs_srcroot@
  20. abs_objroot := @abs_objroot@
  21. # Build parameters.
  22. CPPFLAGS := @CPPFLAGS@ -I$(objroot)include -I$(srcroot)include
  23. CONFIGURE_CFLAGS := @CONFIGURE_CFLAGS@
  24. SPECIFIED_CFLAGS := @SPECIFIED_CFLAGS@
  25. EXTRA_CFLAGS := @EXTRA_CFLAGS@
  26. CFLAGS := $(strip $(CONFIGURE_CFLAGS) $(SPECIFIED_CFLAGS) $(EXTRA_CFLAGS))
  27. CONFIGURE_CXXFLAGS := @CONFIGURE_CXXFLAGS@
  28. SPECIFIED_CXXFLAGS := @SPECIFIED_CXXFLAGS@
  29. EXTRA_CXXFLAGS := @EXTRA_CXXFLAGS@
  30. CXXFLAGS := $(strip $(CONFIGURE_CXXFLAGS) $(SPECIFIED_CXXFLAGS) $(EXTRA_CXXFLAGS))
  31. LDFLAGS := @LDFLAGS@
  32. EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
  33. LIBS := @LIBS@
  34. RPATH_EXTRA := @RPATH_EXTRA@
  35. SO := @so@
  36. IMPORTLIB := @importlib@
  37. O := @o@
  38. A := @a@
  39. EXE := @exe@
  40. LIBPREFIX := @libprefix@
  41. REV := @rev@
  42. install_suffix := @install_suffix@
  43. ABI := @abi@
  44. XSLTPROC := @XSLTPROC@
  45. AUTOCONF := @AUTOCONF@
  46. _RPATH = @RPATH@
  47. RPATH = $(if $(1),$(call _RPATH,$(1)))
  48. cfghdrs_in := $(addprefix $(srcroot),@cfghdrs_in@)
  49. cfghdrs_out := @cfghdrs_out@
  50. cfgoutputs_in := $(addprefix $(srcroot),@cfgoutputs_in@)
  51. cfgoutputs_out := @cfgoutputs_out@
  52. enable_autogen := @enable_autogen@
  53. enable_prof := @enable_prof@
  54. enable_zone_allocator := @enable_zone_allocator@
  55. MALLOC_CONF := @JEMALLOC_CPREFIX@MALLOC_CONF
  56. link_whole_archive := @link_whole_archive@
  57. DSO_LDFLAGS = @DSO_LDFLAGS@
  58. SOREV = @SOREV@
  59. PIC_CFLAGS = @PIC_CFLAGS@
  60. CTARGET = @CTARGET@
  61. LDTARGET = @LDTARGET@
  62. TEST_LD_MODE = @TEST_LD_MODE@
  63. MKLIB = @MKLIB@
  64. AR = @AR@
  65. ARFLAGS = @ARFLAGS@
  66. DUMP_SYMS = @DUMP_SYMS@
  67. AWK := @AWK@
  68. CC_MM = @CC_MM@
  69. LM := @LM@
  70. INSTALL = @INSTALL@
  71. ifeq (macho, $(ABI))
  72. TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
  73. else
  74. ifeq (pecoff, $(ABI))
  75. TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
  76. else
  77. TEST_LIBRARY_PATH :=
  78. endif
  79. endif
  80. LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
  81. # Lists of files.
  82. BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof
  83. C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
  84. C_SRCS := $(srcroot)src/jemalloc.c \
  85. $(srcroot)src/arena.c \
  86. $(srcroot)src/background_thread.c \
  87. $(srcroot)src/base.c \
  88. $(srcroot)src/bin.c \
  89. $(srcroot)src/bitmap.c \
  90. $(srcroot)src/ckh.c \
  91. $(srcroot)src/ctl.c \
  92. $(srcroot)src/div.c \
  93. $(srcroot)src/extent.c \
  94. $(srcroot)src/extent_dss.c \
  95. $(srcroot)src/extent_mmap.c \
  96. $(srcroot)src/hash.c \
  97. $(srcroot)src/hooks.c \
  98. $(srcroot)src/large.c \
  99. $(srcroot)src/log.c \
  100. $(srcroot)src/malloc_io.c \
  101. $(srcroot)src/mutex.c \
  102. $(srcroot)src/mutex_pool.c \
  103. $(srcroot)src/nstime.c \
  104. $(srcroot)src/pages.c \
  105. $(srcroot)src/prng.c \
  106. $(srcroot)src/prof.c \
  107. $(srcroot)src/rtree.c \
  108. $(srcroot)src/stats.c \
  109. $(srcroot)src/sz.c \
  110. $(srcroot)src/tcache.c \
  111. $(srcroot)src/ticker.c \
  112. $(srcroot)src/tsd.c \
  113. $(srcroot)src/witness.c
  114. ifeq ($(enable_zone_allocator), 1)
  115. C_SRCS += $(srcroot)src/zone.c
  116. endif
  117. ifeq ($(IMPORTLIB),$(SO))
  118. STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
  119. endif
  120. ifdef PIC_CFLAGS
  121. STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
  122. else
  123. STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
  124. endif
  125. DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
  126. ifneq ($(SOREV),$(SO))
  127. DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
  128. endif
  129. ifeq (1, $(link_whole_archive))
  130. LJEMALLOC := -Wl,--whole-archive -L$(objroot)lib -l$(LIBJEMALLOC) -Wl,--no-whole-archive
  131. else
  132. LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
  133. endif
  134. PC := $(objroot)jemalloc.pc
  135. MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
  136. DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
  137. DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html)
  138. DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3)
  139. DOCS := $(DOCS_HTML) $(DOCS_MAN3)
  140. C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
  141. $(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \
  142. $(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \
  143. $(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \
  144. $(srcroot)test/src/thd.c $(srcroot)test/src/timer.c
  145. ifeq (1, $(link_whole_archive))
  146. C_UTIL_INTEGRATION_SRCS :=
  147. C_UTIL_CPP_SRCS :=
  148. else
  149. C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c
  150. C_UTIL_CPP_SRCS := $(srcroot)src/nstime.c $(srcroot)src/malloc_io.c
  151. endif
  152. TESTS_UNIT := \
  153. $(srcroot)test/unit/a0.c \
  154. $(srcroot)test/unit/arena_reset.c \
  155. $(srcroot)test/unit/atomic.c \
  156. $(srcroot)test/unit/background_thread.c \
  157. $(srcroot)test/unit/background_thread_enable.c \
  158. $(srcroot)test/unit/base.c \
  159. $(srcroot)test/unit/bitmap.c \
  160. $(srcroot)test/unit/ckh.c \
  161. $(srcroot)test/unit/decay.c \
  162. $(srcroot)test/unit/div.c \
  163. $(srcroot)test/unit/emitter.c \
  164. $(srcroot)test/unit/extent_quantize.c \
  165. $(srcroot)test/unit/fork.c \
  166. $(srcroot)test/unit/hash.c \
  167. $(srcroot)test/unit/hooks.c \
  168. $(srcroot)test/unit/junk.c \
  169. $(srcroot)test/unit/junk_alloc.c \
  170. $(srcroot)test/unit/junk_free.c \
  171. $(srcroot)test/unit/log.c \
  172. $(srcroot)test/unit/mallctl.c \
  173. $(srcroot)test/unit/malloc_io.c \
  174. $(srcroot)test/unit/math.c \
  175. $(srcroot)test/unit/mq.c \
  176. $(srcroot)test/unit/mtx.c \
  177. $(srcroot)test/unit/pack.c \
  178. $(srcroot)test/unit/pages.c \
  179. $(srcroot)test/unit/ph.c \
  180. $(srcroot)test/unit/prng.c \
  181. $(srcroot)test/unit/prof_accum.c \
  182. $(srcroot)test/unit/prof_active.c \
  183. $(srcroot)test/unit/prof_gdump.c \
  184. $(srcroot)test/unit/prof_idump.c \
  185. $(srcroot)test/unit/prof_reset.c \
  186. $(srcroot)test/unit/prof_tctx.c \
  187. $(srcroot)test/unit/prof_thread_name.c \
  188. $(srcroot)test/unit/ql.c \
  189. $(srcroot)test/unit/qr.c \
  190. $(srcroot)test/unit/rb.c \
  191. $(srcroot)test/unit/retained.c \
  192. $(srcroot)test/unit/rtree.c \
  193. $(srcroot)test/unit/SFMT.c \
  194. $(srcroot)test/unit/size_classes.c \
  195. $(srcroot)test/unit/slab.c \
  196. $(srcroot)test/unit/smoothstep.c \
  197. $(srcroot)test/unit/spin.c \
  198. $(srcroot)test/unit/stats.c \
  199. $(srcroot)test/unit/stats_print.c \
  200. $(srcroot)test/unit/ticker.c \
  201. $(srcroot)test/unit/nstime.c \
  202. $(srcroot)test/unit/tsd.c \
  203. $(srcroot)test/unit/witness.c \
  204. $(srcroot)test/unit/zero.c
  205. ifeq (@enable_prof@, 1)
  206. TESTS_UNIT += \
  207. $(srcroot)test/unit/arena_reset_prof.c
  208. endif
  209. TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
  210. $(srcroot)test/integration/allocated.c \
  211. $(srcroot)test/integration/extent.c \
  212. $(srcroot)test/integration/mallocx.c \
  213. $(srcroot)test/integration/MALLOCX_ARENA.c \
  214. $(srcroot)test/integration/overflow.c \
  215. $(srcroot)test/integration/posix_memalign.c \
  216. $(srcroot)test/integration/rallocx.c \
  217. $(srcroot)test/integration/sdallocx.c \
  218. $(srcroot)test/integration/thread_arena.c \
  219. $(srcroot)test/integration/thread_tcache_enabled.c \
  220. $(srcroot)test/integration/xallocx.c
  221. ifeq (@enable_cxx@, 1)
  222. CPP_SRCS := $(srcroot)src/jemalloc_cpp.cpp
  223. TESTS_INTEGRATION_CPP := $(srcroot)test/integration/cpp/basic.cpp
  224. else
  225. CPP_SRCS :=
  226. TESTS_INTEGRATION_CPP :=
  227. endif
  228. TESTS_STRESS := $(srcroot)test/stress/microbench.c
  229. TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_INTEGRATION_CPP) $(TESTS_STRESS)
  230. PRIVATE_NAMESPACE_HDRS := $(objroot)include/jemalloc/internal/private_namespace.h $(objroot)include/jemalloc/internal/private_namespace_jet.h
  231. PRIVATE_NAMESPACE_GEN_HDRS := $(PRIVATE_NAMESPACE_HDRS:%.h=%.gen.h)
  232. C_SYM_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.sym.$(O))
  233. C_SYMS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.sym)
  234. C_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.$(O))
  235. CPP_OBJS := $(CPP_SRCS:$(srcroot)%.cpp=$(objroot)%.$(O))
  236. C_PIC_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
  237. CPP_PIC_OBJS := $(CPP_SRCS:$(srcroot)%.cpp=$(objroot)%.pic.$(O))
  238. C_JET_SYM_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.sym.$(O))
  239. C_JET_SYMS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.sym)
  240. C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O))
  241. C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O))
  242. C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
  243. C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
  244. C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O))
  245. C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_STRESS_OBJS)
  246. TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O))
  247. TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O))
  248. TESTS_INTEGRATION_CPP_OBJS := $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%.$(O))
  249. TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O))
  250. TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_STRESS_OBJS)
  251. TESTS_CPP_OBJS := $(TESTS_INTEGRATION_CPP_OBJS)
  252. .PHONY: all dist build_doc_html build_doc_man build_doc
  253. .PHONY: install_bin install_include install_lib
  254. .PHONY: install_doc_html install_doc_man install_doc install
  255. .PHONY: tests check clean distclean relclean
  256. .SECONDARY : $(PRIVATE_NAMESPACE_GEN_HDRS) $(TESTS_OBJS) $(TESTS_CPP_OBJS)
  257. # Default target.
  258. all: build_lib
  259. dist: build_doc
  260. $(objroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
  261. $(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
  262. $(objroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
  263. $(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
  264. build_doc_html: $(DOCS_HTML)
  265. build_doc_man: $(DOCS_MAN3)
  266. build_doc: $(DOCS)
  267. #
  268. # Include generated dependency files.
  269. #
  270. ifdef CC_MM
  271. -include $(C_SYM_OBJS:%.$(O)=%.d)
  272. -include $(C_OBJS:%.$(O)=%.d)
  273. -include $(CPP_OBJS:%.$(O)=%.d)
  274. -include $(C_PIC_OBJS:%.$(O)=%.d)
  275. -include $(CPP_PIC_OBJS:%.$(O)=%.d)
  276. -include $(C_JET_SYM_OBJS:%.$(O)=%.d)
  277. -include $(C_JET_OBJS:%.$(O)=%.d)
  278. -include $(C_TESTLIB_OBJS:%.$(O)=%.d)
  279. -include $(TESTS_OBJS:%.$(O)=%.d)
  280. -include $(TESTS_CPP_OBJS:%.$(O)=%.d)
  281. endif
  282. $(C_SYM_OBJS): $(objroot)src/%.sym.$(O): $(srcroot)src/%.c
  283. $(C_SYM_OBJS): CPPFLAGS += -DJEMALLOC_NO_PRIVATE_NAMESPACE
  284. $(C_SYMS): $(objroot)src/%.sym: $(objroot)src/%.sym.$(O)
  285. $(C_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
  286. $(CPP_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.cpp
  287. $(C_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
  288. $(C_PIC_OBJS): CFLAGS += $(PIC_CFLAGS)
  289. $(CPP_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.cpp
  290. $(CPP_PIC_OBJS): CXXFLAGS += $(PIC_CFLAGS)
  291. $(C_JET_SYM_OBJS): $(objroot)src/%.jet.sym.$(O): $(srcroot)src/%.c
  292. $(C_JET_SYM_OBJS): CPPFLAGS += -DJEMALLOC_JET -DJEMALLOC_NO_PRIVATE_NAMESPACE
  293. $(C_JET_SYMS): $(objroot)src/%.jet.sym: $(objroot)src/%.jet.sym.$(O)
  294. $(C_JET_OBJS): $(objroot)src/%.jet.$(O): $(srcroot)src/%.c
  295. $(C_JET_OBJS): CPPFLAGS += -DJEMALLOC_JET
  296. $(C_TESTLIB_UNIT_OBJS): $(objroot)test/src/%.unit.$(O): $(srcroot)test/src/%.c
  297. $(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
  298. $(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c
  299. $(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
  300. $(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c
  301. $(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c
  302. $(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB
  303. $(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
  304. $(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
  305. $(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
  306. $(TESTS_INTEGRATION_CPP_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_CPP_TEST
  307. $(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST
  308. $(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
  309. $(TESTS_CPP_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.cpp
  310. $(TESTS_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
  311. $(TESTS_CPP_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
  312. ifneq ($(IMPORTLIB),$(SO))
  313. $(CPP_OBJS) $(C_SYM_OBJS) $(C_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS): CPPFLAGS += -DDLLEXPORT
  314. endif
  315. # Dependencies.
  316. ifndef CC_MM
  317. HEADER_DIRS = $(srcroot)include/jemalloc/internal \
  318. $(objroot)include/jemalloc $(objroot)include/jemalloc/internal
  319. HEADERS = $(filter-out $(PRIVATE_NAMESPACE_HDRS),$(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h)))
  320. $(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)
  321. $(TESTS_OBJS) $(TESTS_CPP_OBJS): $(objroot)test/include/test/jemalloc_test.h
  322. endif
  323. $(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
  324. $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_STRESS_OBJS) $(TESTS_UNIT_OBJS) $(TESTS_STRESS_OBJS): $(objroot)include/jemalloc/internal/private_namespace_jet.h
  325. $(C_SYM_OBJS) $(C_OBJS) $(C_PIC_OBJS) $(C_JET_SYM_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O):
  326. @mkdir -p $(@D)
  327. $(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
  328. ifdef CC_MM
  329. @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
  330. endif
  331. $(C_SYMS): %.sym:
  332. @mkdir -p $(@D)
  333. $(DUMP_SYMS) $< | $(AWK) -f $(objroot)include/jemalloc/internal/private_symbols.awk > $@
  334. $(C_JET_SYMS): %.sym:
  335. @mkdir -p $(@D)
  336. $(DUMP_SYMS) $< | $(AWK) -f $(objroot)include/jemalloc/internal/private_symbols_jet.awk > $@
  337. $(objroot)include/jemalloc/internal/private_namespace.gen.h: $(C_SYMS)
  338. $(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@
  339. $(objroot)include/jemalloc/internal/private_namespace_jet.gen.h: $(C_JET_SYMS)
  340. $(SHELL) $(srcroot)include/jemalloc/internal/private_namespace.sh $^ > $@
  341. %.h: %.gen.h
  342. @if ! `cmp -s $< $@` ; then echo "cp $< $<"; cp $< $@ ; fi
  343. $(CPP_OBJS) $(CPP_PIC_OBJS) $(TESTS_CPP_OBJS): %.$(O):
  344. @mkdir -p $(@D)
  345. $(CXX) $(CXXFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
  346. ifdef CC_MM
  347. @$(CXX) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
  348. endif
  349. ifneq ($(SOREV),$(SO))
  350. %.$(SO) : %.$(SOREV)
  351. @mkdir -p $(@D)
  352. ln -sf $(<F) $@
  353. endif
  354. $(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(C_PIC_OBJS),$(C_OBJS)) $(if $(PIC_CFLAGS),$(CPP_PIC_OBJS),$(CPP_OBJS))
  355. @mkdir -p $(@D)
  356. $(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
  357. $(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(C_PIC_OBJS) $(CPP_PIC_OBJS)
  358. $(objroot)lib/$(LIBJEMALLOC).$(A) : $(C_OBJS) $(CPP_OBJS)
  359. $(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(C_OBJS) $(CPP_OBJS)
  360. $(STATIC_LIBS):
  361. @mkdir -p $(@D)
  362. $(AR) $(ARFLAGS)@AROUT@ $+
  363. $(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS)
  364. @mkdir -p $(@D)
  365. $(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
  366. $(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
  367. @mkdir -p $(@D)
  368. $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -lpthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
  369. $(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
  370. @mkdir -p $(@D)
  371. $(CXX) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS)
  372. $(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
  373. @mkdir -p $(@D)
  374. $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
  375. build_lib_shared: $(DSOS)
  376. build_lib_static: $(STATIC_LIBS)
  377. build_lib: build_lib_shared build_lib_static
  378. install_bin:
  379. $(INSTALL) -d $(BINDIR)
  380. @for b in $(BINS); do \
  381. echo "$(INSTALL) -m 755 $$b $(BINDIR)"; \
  382. $(INSTALL) -m 755 $$b $(BINDIR); \
  383. done
  384. install_include:
  385. $(INSTALL) -d $(INCLUDEDIR)/jemalloc
  386. @for h in $(C_HDRS); do \
  387. echo "$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
  388. $(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc; \
  389. done
  390. install_lib_shared: $(DSOS)
  391. $(INSTALL) -d $(LIBDIR)
  392. $(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
  393. ifneq ($(SOREV),$(SO))
  394. ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
  395. endif
  396. install_lib_static: $(STATIC_LIBS)
  397. $(INSTALL) -d $(LIBDIR)
  398. @for l in $(STATIC_LIBS); do \
  399. echo "$(INSTALL) -m 755 $$l $(LIBDIR)"; \
  400. $(INSTALL) -m 755 $$l $(LIBDIR); \
  401. done
  402. install_lib_pc: $(PC)
  403. $(INSTALL) -d $(LIBDIR)/pkgconfig
  404. @for l in $(PC); do \
  405. echo "$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig"; \
  406. $(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
  407. done
  408. install_lib: install_lib_shared install_lib_static install_lib_pc
  409. install_doc_html:
  410. $(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
  411. @for d in $(DOCS_HTML); do \
  412. echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
  413. $(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
  414. done
  415. install_doc_man:
  416. $(INSTALL) -d $(MANDIR)/man3
  417. @for d in $(DOCS_MAN3); do \
  418. echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \
  419. $(INSTALL) -m 644 $$d $(MANDIR)/man3; \
  420. done
  421. install_doc: install_doc_html install_doc_man
  422. install: install_bin install_include install_lib install_doc
  423. tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
  424. tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE))
  425. tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE))
  426. tests: tests_unit tests_integration tests_stress
  427. check_unit_dir:
  428. @mkdir -p $(objroot)test/unit
  429. check_integration_dir:
  430. @mkdir -p $(objroot)test/integration
  431. stress_dir:
  432. @mkdir -p $(objroot)test/stress
  433. check_dir: check_unit_dir check_integration_dir
  434. check_unit: tests_unit check_unit_dir
  435. $(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
  436. check_integration_prof: tests_integration check_integration_dir
  437. ifeq ($(enable_prof), 1)
  438. $(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
  439. $(MALLOC_CONF)="prof:true,prof_active:false" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
  440. endif
  441. check_integration_decay: tests_integration check_integration_dir
  442. $(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)%)
  443. $(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)%)
  444. check_integration: tests_integration check_integration_dir
  445. $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%)
  446. stress: tests_stress stress_dir
  447. $(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
  448. check: check_unit check_integration check_integration_decay check_integration_prof
  449. clean:
  450. rm -f $(PRIVATE_NAMESPACE_HDRS)
  451. rm -f $(PRIVATE_NAMESPACE_GEN_HDRS)
  452. rm -f $(C_SYM_OBJS)
  453. rm -f $(C_SYMS)
  454. rm -f $(C_OBJS)
  455. rm -f $(CPP_OBJS)
  456. rm -f $(C_PIC_OBJS)
  457. rm -f $(CPP_PIC_OBJS)
  458. rm -f $(C_JET_SYM_OBJS)
  459. rm -f $(C_JET_SYMS)
  460. rm -f $(C_JET_OBJS)
  461. rm -f $(C_TESTLIB_OBJS)
  462. rm -f $(C_SYM_OBJS:%.$(O)=%.d)
  463. rm -f $(C_OBJS:%.$(O)=%.d)
  464. rm -f $(CPP_OBJS:%.$(O)=%.d)
  465. rm -f $(C_PIC_OBJS:%.$(O)=%.d)
  466. rm -f $(CPP_PIC_OBJS:%.$(O)=%.d)
  467. rm -f $(C_JET_SYM_OBJS:%.$(O)=%.d)
  468. rm -f $(C_JET_OBJS:%.$(O)=%.d)
  469. rm -f $(C_TESTLIB_OBJS:%.$(O)=%.d)
  470. rm -f $(TESTS_OBJS:%.$(O)=%$(EXE))
  471. rm -f $(TESTS_OBJS)
  472. rm -f $(TESTS_OBJS:%.$(O)=%.d)
  473. rm -f $(TESTS_OBJS:%.$(O)=%.out)
  474. rm -f $(TESTS_CPP_OBJS:%.$(O)=%$(EXE))
  475. rm -f $(TESTS_CPP_OBJS)
  476. rm -f $(TESTS_CPP_OBJS:%.$(O)=%.d)
  477. rm -f $(TESTS_CPP_OBJS:%.$(O)=%.out)
  478. rm -f $(DSOS) $(STATIC_LIBS)
  479. distclean: clean
  480. rm -f $(objroot)bin/jemalloc-config
  481. rm -f $(objroot)bin/jemalloc.sh
  482. rm -f $(objroot)bin/jeprof
  483. rm -f $(objroot)config.log
  484. rm -f $(objroot)config.status
  485. rm -f $(objroot)config.stamp
  486. rm -f $(cfghdrs_out)
  487. rm -f $(cfgoutputs_out)
  488. relclean: distclean
  489. rm -f $(objroot)configure
  490. rm -f $(objroot)VERSION
  491. rm -f $(DOCS_HTML)
  492. rm -f $(DOCS_MAN3)
  493. #===============================================================================
  494. # Re-configuration rules.
  495. ifeq ($(enable_autogen), 1)
  496. $(srcroot)configure : $(srcroot)configure.ac
  497. cd ./$(srcroot) && $(AUTOCONF)
  498. $(objroot)config.status : $(srcroot)configure
  499. ./$(objroot)config.status --recheck
  500. $(srcroot)config.stamp.in : $(srcroot)configure.ac
  501. echo stamp > $(srcroot)config.stamp.in
  502. $(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
  503. ./$(objroot)config.status
  504. @touch $@
  505. # There must be some action in order for make to re-read Makefile when it is
  506. # out of date.
  507. $(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
  508. @true
  509. endif