]> git.saurik.com Git - redis.git/blame - deps/jemalloc/Makefile.in
merge conflicts resolved
[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@
20
21# Build parameters.
22CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include
23CFLAGS := @CFLAGS@
24ifeq (macho, @abi@)
25CFLAGS += -dynamic
26endif
27LDFLAGS := @LDFLAGS@
28LIBS := @LIBS@
29RPATH_EXTRA := @RPATH_EXTRA@
30ifeq (macho, @abi@)
31SO := dylib
32WL_SONAME := dylib_install_name
33else
34SO := so
35WL_SONAME := soname
36endif
37REV := 1
38ifeq (macho, @abi@)
39TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH=@objroot@lib
40else
41TEST_LIBRARY_PATH :=
42endif
43
44# Lists of files.
45BINS := @srcroot@bin/pprof
46CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
47 @objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
48CSRCS := @srcroot@src/jemalloc.c @srcroot@src/arena.c @srcroot@src/atomic.c \
49 @srcroot@src/base.c @srcroot@src/bitmap.c @srcroot@src/chunk.c \
50 @srcroot@src/chunk_dss.c @srcroot@src/chunk_mmap.c \
51 @srcroot@src/chunk_swap.c @srcroot@src/ckh.c @srcroot@src/ctl.c \
52 @srcroot@src/extent.c @srcroot@src/hash.c @srcroot@src/huge.c \
53 @srcroot@src/mb.c @srcroot@src/mutex.c @srcroot@src/prof.c \
54 @srcroot@src/rtree.c @srcroot@src/stats.c @srcroot@src/tcache.c
55ifeq (macho, @abi@)
56CSRCS += @srcroot@src/zone.c
57endif
58STATIC_LIBS := @objroot@lib/libjemalloc@install_suffix@.a
59DSOS := @objroot@lib/libjemalloc@install_suffix@.$(SO).$(REV) \
60 @objroot@lib/libjemalloc@install_suffix@.$(SO) \
61 @objroot@lib/libjemalloc@install_suffix@_pic.a
62MAN3 := @objroot@doc/jemalloc@install_suffix@.3
63DOCS_XML := @objroot@doc/jemalloc@install_suffix@.xml
64DOCS_HTML := $(DOCS_XML:@objroot@%.xml=@srcroot@%.html)
65DOCS_MAN3 := $(DOCS_XML:@objroot@%.xml=@srcroot@%.3)
66DOCS := $(DOCS_HTML) $(DOCS_MAN3)
67CTESTS := @srcroot@test/allocated.c @srcroot@test/allocm.c \
68 @srcroot@test/bitmap.c @srcroot@test/mremap.c \
69 @srcroot@test/posix_memalign.c @srcroot@test/rallocm.c \
70 @srcroot@test/thread_arena.c
71
72.PHONY: all dist doc_html doc_man doc
73.PHONY: install_bin install_include install_lib
74.PHONY: install_html install_man install_doc install
75.PHONY: tests check clean distclean relclean
76
77.SECONDARY : $(CTESTS:@srcroot@%.c=@objroot@%.o)
78
79# Default target.
80all: $(DSOS) $(STATIC_LIBS)
81
82dist: doc
83
84@srcroot@doc/%.html : @objroot@doc/%.xml @srcroot@doc/stylesheet.xsl @objroot@doc/html.xsl
85 @XSLTPROC@ -o $@ @objroot@doc/html.xsl $<
86
87@srcroot@doc/%.3 : @objroot@doc/%.xml @srcroot@doc/stylesheet.xsl @objroot@doc/manpages.xsl
88 @XSLTPROC@ -o $@ @objroot@doc/manpages.xsl $<
89
90doc_html: $(DOCS_HTML)
91doc_man: $(DOCS_MAN3)
92doc: $(DOCS)
93
94#
95# Include generated dependency files.
96#
97-include $(CSRCS:@srcroot@%.c=@objroot@%.d)
98-include $(CSRCS:@srcroot@%.c=@objroot@%.pic.d)
99-include $(CTESTS:@srcroot@%.c=@objroot@%.d)
100
101@objroot@src/%.o: @srcroot@src/%.c
102 @mkdir -p $(@D)
103 $(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
104 @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)"
105
106@objroot@src/%.pic.o: @srcroot@src/%.c
107 @mkdir -p $(@D)
108 $(CC) $(CFLAGS) -fPIC -DPIC -c $(CPPFLAGS) -o $@ $<
109 @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $(basename $@))))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.pic.o \2/g\" > $(@:%.o=%.d)"
110
111%.$(SO) : %.$(SO).$(REV)
112 @mkdir -p $(@D)
113 ln -sf $(<F) $@
114
115@objroot@lib/libjemalloc@install_suffix@.$(SO).$(REV) : $(CSRCS:@srcroot@%.c=@objroot@%.pic.o)
116 @mkdir -p $(@D)
117 $(CC) -shared -Wl,-$(WL_SONAME),$(@F) $(RPATH_EXTRA:%=@RPATH@%) -o $@ $+ $(LDFLAGS) $(LIBS)
118
119@objroot@lib/libjemalloc@install_suffix@_pic.a : $(CSRCS:@srcroot@%.c=@objroot@%.pic.o)
120 @mkdir -p $(@D)
121 ar crus $@ $+
122
123@objroot@lib/libjemalloc@install_suffix@.a : $(CSRCS:@srcroot@%.c=@objroot@%.o)
124 @mkdir -p $(@D)
125 ar crus $@ $+
126
127@objroot@test/%.o: @srcroot@test/%.c
128 @mkdir -p $(@D)
129 $(CC) $(CFLAGS) -c $(CPPFLAGS) -I@objroot@test -o $@ $<
130 @$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) -I@objroot@test $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)"
131
132# Automatic dependency generation misses #include "*.c".
133@objroot@test/bitmap.o : @objroot@src/bitmap.o
134
135@objroot@test/%: @objroot@test/%.o \
136 @objroot@lib/libjemalloc@install_suffix@.$(SO)
137 @mkdir -p $(@D)
138ifneq (@RPATH@, )
139 $(CC) -o $@ $< @RPATH@@objroot@lib -L@objroot@lib -ljemalloc@install_suffix@
140else
141 $(CC) -o $@ $< -L@objroot@lib -ljemalloc@install_suffix@
142endif
143
144install_bin:
145 install -d $(BINDIR)
146 @for b in $(BINS); do \
147 echo "install -m 755 $$b $(BINDIR)"; \
148 install -m 755 $$b $(BINDIR); \
149done
150
151install_include:
152 install -d $(INCLUDEDIR)/jemalloc
153 @for h in $(CHDRS); do \
154 echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
155 install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
156done
157
158install_lib: $(DSOS) $(STATIC_LIBS)
159 install -d $(LIBDIR)
160 install -m 755 @objroot@lib/libjemalloc@install_suffix@.$(SO).$(REV) $(LIBDIR)
161 ln -sf libjemalloc@install_suffix@.$(SO).$(REV) $(LIBDIR)/libjemalloc@install_suffix@.$(SO)
162 install -m 755 @objroot@lib/libjemalloc@install_suffix@_pic.a $(LIBDIR)
163 install -m 755 @objroot@lib/libjemalloc@install_suffix@.a $(LIBDIR)
164
165install_html:
166 install -d $(DATADIR)/doc/jemalloc@install_suffix@
167 @for d in $(DOCS_HTML); do \
168 echo "install -m 644 $$d $(DATADIR)/doc/jemalloc@install_suffix@"; \
169 install -m 644 $$d $(DATADIR)/doc/jemalloc@install_suffix@; \
170done
171
172install_man:
173 install -d $(MANDIR)/man3
174 @for d in $(DOCS_MAN3); do \
175 echo "install -m 644 $$d $(MANDIR)/man3"; \
176 install -m 644 $$d $(MANDIR)/man3; \
177done
178
179install_doc: install_html install_man
180
181install: install_bin install_include install_lib install_doc
182
183tests: $(CTESTS:@srcroot@%.c=@objroot@%)
184
185check: tests
186 @mkdir -p @objroot@test
187 @$(SHELL) -c 'total=0; \
188 failures=0; \
189 echo "========================================="; \
190 for t in $(CTESTS:@srcroot@%.c=@objroot@%); do \
191 total=`expr $$total + 1`; \
192 /bin/echo -n "$${t} ... "; \
193 $(TEST_LIBRARY_PATH) $${t} @abs_srcroot@ @abs_objroot@ \
194 > @objroot@$${t}.out 2>&1; \
195 if test -e "@srcroot@$${t}.exp"; then \
196 diff -u @srcroot@$${t}.exp \
197 @objroot@$${t}.out >/dev/null 2>&1; \
198 fail=$$?; \
199 if test "$${fail}" -eq "1" ; then \
200 failures=`expr $${failures} + 1`; \
201 echo "*** FAIL ***"; \
202 else \
203 echo "pass"; \
204 fi; \
205 else \
206 echo "*** FAIL *** (.exp file is missing)"; \
207 failures=`expr $${failures} + 1`; \
208 fi; \
209 done; \
210 echo "========================================="; \
211 echo "Failures: $${failures}/$${total}"'
212
213clean:
214 rm -f $(CSRCS:@srcroot@%.c=@objroot@%.o)
215 rm -f $(CSRCS:@srcroot@%.c=@objroot@%.pic.o)
216 rm -f $(CSRCS:@srcroot@%.c=@objroot@%.d)
217 rm -f $(CSRCS:@srcroot@%.c=@objroot@%.pic.d)
218 rm -f $(CTESTS:@srcroot@%.c=@objroot@%)
219 rm -f $(CTESTS:@srcroot@%.c=@objroot@%.o)
220 rm -f $(CTESTS:@srcroot@%.c=@objroot@%.d)
221 rm -f $(CTESTS:@srcroot@%.c=@objroot@%.out)
222 rm -f $(DSOS) $(STATIC_LIBS)
223
224distclean: clean
225 rm -rf @objroot@autom4te.cache
226 rm -f @objroot@config.log
227 rm -f @objroot@config.status
228 rm -f @objroot@config.stamp
229 rm -f @cfghdrs_out@
230 rm -f @cfgoutputs_out@
231
232relclean: distclean
233 rm -f @objroot@configure
234 rm -f @srcroot@VERSION
235 rm -f $(DOCS_HTML)
236 rm -f $(DOCS_MAN3)
237
238#===============================================================================
239# Re-configuration rules.
240
241ifeq (@enable_autogen@, 1)
242@srcroot@configure : @srcroot@configure.ac
243 cd ./@srcroot@ && @AUTOCONF@
244
245@objroot@config.status : @srcroot@configure
246 ./@objroot@config.status --recheck
247
248@srcroot@config.stamp.in : @srcroot@configure.ac
249 echo stamp > @srcroot@config.stamp.in
250
251@objroot@config.stamp : @cfgoutputs_in@ @cfghdrs_in@ @srcroot@configure
252 ./@objroot@config.status
253 @touch $@
254
255# There must be some action in order for make to re-read Makefile when it is
256# out of date.
257@cfgoutputs_out@ @cfghdrs_out@ : @objroot@config.stamp
258 @true
259endif