]> git.saurik.com Git - redis.git/blob - deps/jemalloc/Makefile.in
32bit build fixed, broken by a previous commit fixing build on Solaris
[redis.git] / deps / jemalloc / Makefile.in
1 # Clear out all vpaths, then set just one (default vpath) for the main build
2 # directory.
3 vpath
4 vpath % .
5
6 # Clear the default suffixes, so that built-in rules are not used.
7 .SUFFIXES :
8
9 SHELL := /bin/sh
10
11 CC := @CC@
12
13 # Configuration parameters.
14 DESTDIR =
15 BINDIR := $(DESTDIR)@BINDIR@
16 INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
17 LIBDIR := $(DESTDIR)@LIBDIR@
18 DATADIR := $(DESTDIR)@DATADIR@
19 MANDIR := $(DESTDIR)@MANDIR@
20
21 # Build parameters.
22 CPPFLAGS := @CPPFLAGS@ -I@srcroot@include -I@objroot@include
23 CFLAGS := @CFLAGS@
24 ifeq (macho, @abi@)
25 CFLAGS += -dynamic
26 endif
27 LDFLAGS := @LDFLAGS@
28 LIBS := @LIBS@
29 RPATH_EXTRA := @RPATH_EXTRA@
30 ifeq (macho, @abi@)
31 SO := dylib
32 WL_SONAME := dylib_install_name
33 else
34 SO := so
35 WL_SONAME := soname
36 endif
37 REV := 1
38 ifeq (macho, @abi@)
39 TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH=@objroot@lib
40 else
41 TEST_LIBRARY_PATH :=
42 endif
43
44 # Lists of files.
45 BINS := @srcroot@bin/pprof
46 CHDRS := @objroot@include/jemalloc/jemalloc@install_suffix@.h \
47 @objroot@include/jemalloc/jemalloc_defs@install_suffix@.h
48 CSRCS := @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
55 ifeq (macho, @abi@)
56 CSRCS += @srcroot@src/zone.c
57 endif
58 STATIC_LIBS := @objroot@lib/libjemalloc@install_suffix@.a
59 DSOS := @objroot@lib/libjemalloc@install_suffix@.$(SO).$(REV) \
60 @objroot@lib/libjemalloc@install_suffix@.$(SO) \
61 @objroot@lib/libjemalloc@install_suffix@_pic.a
62 MAN3 := @objroot@doc/jemalloc@install_suffix@.3
63 DOCS_XML := @objroot@doc/jemalloc@install_suffix@.xml
64 DOCS_HTML := $(DOCS_XML:@objroot@%.xml=@srcroot@%.html)
65 DOCS_MAN3 := $(DOCS_XML:@objroot@%.xml=@srcroot@%.3)
66 DOCS := $(DOCS_HTML) $(DOCS_MAN3)
67 CTESTS := @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.
80 all: $(DSOS) $(STATIC_LIBS)
81
82 dist: 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
90 doc_html: $(DOCS_HTML)
91 doc_man: $(DOCS_MAN3)
92 doc: $(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)
138 ifneq (@RPATH@, )
139 $(CC) -o $@ $< @RPATH@@objroot@lib -L@objroot@lib -ljemalloc@install_suffix@
140 else
141 $(CC) -o $@ $< -L@objroot@lib -ljemalloc@install_suffix@
142 endif
143
144 install_bin:
145 install -d $(BINDIR)
146 @for b in $(BINS); do \
147 echo "install -m 755 $$b $(BINDIR)"; \
148 install -m 755 $$b $(BINDIR); \
149 done
150
151 install_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; \
156 done
157
158 install_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
165 install_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@; \
170 done
171
172 install_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; \
177 done
178
179 install_doc: install_html install_man
180
181 install: install_bin install_include install_lib install_doc
182
183 tests: $(CTESTS:@srcroot@%.c=@objroot@%)
184
185 check: 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
213 clean:
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
224 distclean: 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
232 relclean: 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
241 ifeq (@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
259 endif