]> git.saurik.com Git - redis.git/blame - deps/jemalloc/Makefile.in
Query the archive to provide a complete KEYS list.
[redis.git] / deps / jemalloc / Makefile.in
CommitLineData
a78e148b 1# Clear out all vpaths, then set just one (default vpath) for the main build
2# directory.
3vpath
4vpath % .
5
6# Clear the default suffixes, so that built-in rules are not used.
7.SUFFIXES :
8
9SHELL := /bin/sh
10
11CC := @CC@
12
13# Configuration parameters.
14DESTDIR =
15BINDIR := $(DESTDIR)@BINDIR@
16INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
17LIBDIR := $(DESTDIR)@LIBDIR@
18DATADIR := $(DESTDIR)@DATADIR@
19MANDIR := $(DESTDIR)@MANDIR@
4934f93d 20srcroot := @srcroot@
21objroot := @objroot@
22abs_srcroot := @abs_srcroot@
23abs_objroot := @abs_objroot@
a78e148b 24
25# Build parameters.
4934f93d 26CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include
a78e148b 27CFLAGS := @CFLAGS@
a78e148b 28LDFLAGS := @LDFLAGS@
4934f93d 29EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
a78e148b 30LIBS := @LIBS@
31RPATH_EXTRA := @RPATH_EXTRA@
4934f93d 32SO := @so@
33IMPORTLIB := @importlib@
34O := @o@
35A := @a@
36EXE := @exe@
37LIBPREFIX := @libprefix@
38REV := @rev@
39install_suffix := @install_suffix@
40ABI := @abi@
41XSLTPROC := @XSLTPROC@
42AUTOCONF := @AUTOCONF@
43_RPATH = @RPATH@
44RPATH = $(if $(1),$(call _RPATH,$(1)))
45cfghdrs_in := @cfghdrs_in@
46cfghdrs_out := @cfghdrs_out@
47cfgoutputs_in := @cfgoutputs_in@
48cfgoutputs_out := @cfgoutputs_out@
49enable_autogen := @enable_autogen@
50enable_experimental := @enable_experimental@
51DSO_LDFLAGS = @DSO_LDFLAGS@
52SOREV = @SOREV@
53PIC_CFLAGS = @PIC_CFLAGS@
54CTARGET = @CTARGET@
55LDTARGET = @LDTARGET@
56MKLIB = @MKLIB@
57CC_MM = @CC_MM@
58
59ifeq (macho, $(ABI))
60TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
a78e148b 61else
4934f93d 62ifeq (pecoff, $(ABI))
63TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
a78e148b 64else
65TEST_LIBRARY_PATH :=
66endif
4934f93d 67endif
68
69LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
a78e148b 70
71# Lists of files.
4934f93d 72BINS := $(srcroot)bin/pprof $(objroot)bin/jemalloc.sh
73CHDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h \
74 $(objroot)include/jemalloc/jemalloc_defs$(install_suffix).h
75CSRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c $(srcroot)src/atomic.c \
76 $(srcroot)src/base.c $(srcroot)src/bitmap.c $(srcroot)src/chunk.c \
77 $(srcroot)src/chunk_dss.c $(srcroot)src/chunk_mmap.c \
78 $(srcroot)src/ckh.c $(srcroot)src/ctl.c $(srcroot)src/extent.c \
79 $(srcroot)src/hash.c $(srcroot)src/huge.c $(srcroot)src/mb.c \
80 $(srcroot)src/mutex.c $(srcroot)src/prof.c $(srcroot)src/quarantine.c \
81 $(srcroot)src/rtree.c $(srcroot)src/stats.c $(srcroot)src/tcache.c \
82 $(srcroot)src/util.c $(srcroot)src/tsd.c
83ifeq (macho, $(ABI))
84CSRCS += $(srcroot)src/zone.c
85endif
86ifeq ($(IMPORTLIB),$(SO))
87STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
88endif
89ifdef PIC_CFLAGS
90STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
91else
92STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
a78e148b 93endif
4934f93d 94DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
95ifneq ($(SOREV),$(SO))
96DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
97endif
98MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
99DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
100DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(srcroot)%.html)
101DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(srcroot)%.3)
a78e148b 102DOCS := $(DOCS_HTML) $(DOCS_MAN3)
4934f93d 103CTESTS := $(srcroot)test/aligned_alloc.c $(srcroot)test/allocated.c \
21b26915 104 $(srcroot)test/ALLOCM_ARENA.c $(srcroot)test/bitmap.c \
105 $(srcroot)test/mremap.c $(srcroot)test/posix_memalign.c \
106 $(srcroot)test/thread_arena.c $(srcroot)test/thread_tcache_enabled.c
4934f93d 107ifeq ($(enable_experimental), 1)
108CTESTS += $(srcroot)test/allocm.c $(srcroot)test/rallocm.c
109endif
110
111COBJS := $(CSRCS:$(srcroot)%.c=$(objroot)%.$(O))
112CPICOBJS := $(CSRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
113CTESTOBJS := $(CTESTS:$(srcroot)%.c=$(objroot)%.$(O))
a78e148b 114
115.PHONY: all dist doc_html doc_man doc
116.PHONY: install_bin install_include install_lib
117.PHONY: install_html install_man install_doc install
118.PHONY: tests check clean distclean relclean
119
4934f93d 120.SECONDARY : $(CTESTOBJS)
a78e148b 121
122# Default target.
4934f93d 123all: build
a78e148b 124
4934f93d 125dist: build_doc
a78e148b 126
4934f93d 127$(srcroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
128 $(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
a78e148b 129
4934f93d 130$(srcroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
131 $(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
a78e148b 132
4934f93d 133build_doc_html: $(DOCS_HTML)
134build_doc_man: $(DOCS_MAN3)
135build_doc: $(DOCS)
a78e148b 136
137#
138# Include generated dependency files.
139#
4934f93d 140ifdef CC_MM
141-include $(COBJS:%.$(O)=%.d)
142-include $(CPICOBJS:%.$(O)=%.d)
143-include $(CTESTOBJS:%.$(O)=%.d)
144endif
a78e148b 145
4934f93d 146$(COBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
147$(CPICOBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
148$(CPICOBJS): CFLAGS += $(PIC_CFLAGS)
149$(CTESTOBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
150$(CTESTOBJS): CPPFLAGS += -I$(objroot)test
151ifneq ($(IMPORTLIB),$(SO))
152$(COBJS): CPPFLAGS += -DDLLEXPORT
153endif
a78e148b 154
4934f93d 155ifndef CC_MM
156# Dependencies
157HEADER_DIRS = $(srcroot)include/jemalloc/internal \
158 $(objroot)include/jemalloc $(objroot)include/jemalloc/internal
159HEADERS = $(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h))
160$(COBJS) $(CPICOBJS) $(CTESTOBJS): $(HEADERS)
161$(CTESTOBJS): $(objroot)test/jemalloc_test.h
162endif
a78e148b 163
4934f93d 164$(COBJS) $(CPICOBJS) $(CTESTOBJS): %.$(O):
a78e148b 165 @mkdir -p $(@D)
4934f93d 166 $(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
167ifdef CC_MM
168 @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
169endif
a78e148b 170
4934f93d 171ifneq ($(SOREV),$(SO))
172%.$(SO) : %.$(SOREV)
a78e148b 173 @mkdir -p $(@D)
4934f93d 174 ln -sf $(<F) $@
175endif
a78e148b 176
4934f93d 177$(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(CPICOBJS),$(COBJS))
a78e148b 178 @mkdir -p $(@D)
4934f93d 179 $(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
a78e148b 180
4934f93d 181$(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(CPICOBJS)
182$(objroot)lib/$(LIBJEMALLOC).$(A) : $(COBJS)
183$(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(COBJS)
a78e148b 184
4934f93d 185$(STATIC_LIBS):
a78e148b 186 @mkdir -p $(@D)
4934f93d 187 $(MKLIB) $+
a78e148b 188
4934f93d 189$(objroot)test/bitmap$(EXE): $(objroot)src/bitmap.$(O)
a78e148b 190
4934f93d 191$(objroot)test/%$(EXE): $(objroot)test/%.$(O) $(objroot)src/util.$(O) $(DSOS)
a78e148b 192 @mkdir -p $(@D)
4934f93d 193 $(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(filter -lpthread,$(LIBS)) $(EXTRA_LDFLAGS)
194
195build_lib_shared: $(DSOS)
196build_lib_static: $(STATIC_LIBS)
197build: build_lib_shared build_lib_static
a78e148b 198
199install_bin:
200 install -d $(BINDIR)
201 @for b in $(BINS); do \
202 echo "install -m 755 $$b $(BINDIR)"; \
203 install -m 755 $$b $(BINDIR); \
204done
205
206install_include:
207 install -d $(INCLUDEDIR)/jemalloc
208 @for h in $(CHDRS); do \
209 echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
210 install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
211done
212
4934f93d 213install_lib_shared: $(DSOS)
a78e148b 214 install -d $(LIBDIR)
4934f93d 215 install -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
216ifneq ($(SOREV),$(SO))
217 ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
218endif
219
220install_lib_static: $(STATIC_LIBS)
221 install -d $(LIBDIR)
222 @for l in $(STATIC_LIBS); do \
223 echo "install -m 755 $$l $(LIBDIR)"; \
224 install -m 755 $$l $(LIBDIR); \
225done
226
227install_lib: install_lib_shared install_lib_static
a78e148b 228
4934f93d 229install_doc_html:
230 install -d $(DATADIR)/doc/jemalloc$(install_suffix)
a78e148b 231 @for d in $(DOCS_HTML); do \
4934f93d 232 echo "install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
233 install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
a78e148b 234done
235
4934f93d 236install_doc_man:
a78e148b 237 install -d $(MANDIR)/man3
238 @for d in $(DOCS_MAN3); do \
239 echo "install -m 644 $$d $(MANDIR)/man3"; \
240 install -m 644 $$d $(MANDIR)/man3; \
241done
242
4934f93d 243install_doc: install_doc_html install_doc_man
a78e148b 244
245install: install_bin install_include install_lib install_doc
246
4934f93d 247tests: $(CTESTS:$(srcroot)%.c=$(objroot)%$(EXE))
a78e148b 248
249check: tests
4934f93d 250 @mkdir -p $(objroot)test
a78e148b 251 @$(SHELL) -c 'total=0; \
252 failures=0; \
253 echo "========================================="; \
4934f93d 254 for t in $(CTESTS:$(srcroot)%.c=$(objroot)%); do \
a78e148b 255 total=`expr $$total + 1`; \
256 /bin/echo -n "$${t} ... "; \
4934f93d 257 $(TEST_LIBRARY_PATH) $${t}$(EXE) $(abs_srcroot) \
258 $(abs_objroot) > $(objroot)$${t}.out 2>&1; \
259 if test -e "$(srcroot)$${t}.exp"; then \
260 diff -w -u $(srcroot)$${t}.exp \
261 $(objroot)$${t}.out >/dev/null 2>&1; \
a78e148b 262 fail=$$?; \
263 if test "$${fail}" -eq "1" ; then \
264 failures=`expr $${failures} + 1`; \
265 echo "*** FAIL ***"; \
266 else \
267 echo "pass"; \
268 fi; \
269 else \
270 echo "*** FAIL *** (.exp file is missing)"; \
271 failures=`expr $${failures} + 1`; \
272 fi; \
273 done; \
274 echo "========================================="; \
275 echo "Failures: $${failures}/$${total}"'
276
277clean:
4934f93d 278 rm -f $(COBJS)
279 rm -f $(CPICOBJS)
280 rm -f $(COBJS:%.$(O)=%.d)
281 rm -f $(CPICOBJS:%.$(O)=%.d)
282 rm -f $(CTESTOBJS:%.$(O)=%$(EXE))
283 rm -f $(CTESTOBJS)
284 rm -f $(CTESTOBJS:%.$(O)=%.d)
285 rm -f $(CTESTOBJS:%.$(O)=%.out)
a78e148b 286 rm -f $(DSOS) $(STATIC_LIBS)
287
288distclean: clean
4934f93d 289 rm -rf $(objroot)autom4te.cache
290 rm -f $(objroot)config.log
291 rm -f $(objroot)config.status
292 rm -f $(objroot)config.stamp
293 rm -f $(cfghdrs_out)
294 rm -f $(cfgoutputs_out)
a78e148b 295
296relclean: distclean
4934f93d 297 rm -f $(objroot)configure
298 rm -f $(srcroot)VERSION
a78e148b 299 rm -f $(DOCS_HTML)
300 rm -f $(DOCS_MAN3)
301
302#===============================================================================
303# Re-configuration rules.
304
4934f93d 305ifeq ($(enable_autogen), 1)
306$(srcroot)configure : $(srcroot)configure.ac
307 cd ./$(srcroot) && $(AUTOCONF)
a78e148b 308
4934f93d 309$(objroot)config.status : $(srcroot)configure
310 ./$(objroot)config.status --recheck
a78e148b 311
4934f93d 312$(srcroot)config.stamp.in : $(srcroot)configure.ac
313 echo stamp > $(srcroot)config.stamp.in
a78e148b 314
4934f93d 315$(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
316 ./$(objroot)config.status
a78e148b 317 @touch $@
318
319# There must be some action in order for make to re-read Makefile when it is
320# out of date.
4934f93d 321$(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
a78e148b 322 @true
323endif