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@
20srcroot := @srcroot@
21objroot := @objroot@
22abs_srcroot := @abs_srcroot@
23abs_objroot := @abs_objroot@
24
25# Build parameters.
26CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include
27CFLAGS := @CFLAGS@
28LDFLAGS := @LDFLAGS@
29EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
30LIBS := @LIBS@
31RPATH_EXTRA := @RPATH_EXTRA@
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 := $(addprefix $(srcroot),@cfghdrs_in@)
46cfghdrs_out := @cfghdrs_out@
47cfgoutputs_in := $(addprefix $(srcroot),@cfgoutputs_in@)
48cfgoutputs_out := @cfgoutputs_out@
49enable_autogen := @enable_autogen@
50enable_code_coverage := @enable_code_coverage@
51enable_valgrind := @enable_valgrind@
52enable_zone_allocator := @enable_zone_allocator@
53DSO_LDFLAGS = @DSO_LDFLAGS@
54SOREV = @SOREV@
55PIC_CFLAGS = @PIC_CFLAGS@
56CTARGET = @CTARGET@
57LDTARGET = @LDTARGET@
58MKLIB = @MKLIB@
59AR = @AR@
60ARFLAGS = @ARFLAGS@
61CC_MM = @CC_MM@
62
63ifeq (macho, $(ABI))
64TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
65else
66ifeq (pecoff, $(ABI))
67TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
68else
69TEST_LIBRARY_PATH :=
70endif
71endif
72
73LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
74
75# Lists of files.
76BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof
77C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
78C_SRCS := $(srcroot)src/jemalloc.c $(srcroot)src/arena.c \
79	$(srcroot)src/atomic.c $(srcroot)src/base.c $(srcroot)src/bitmap.c \
80	$(srcroot)src/chunk.c $(srcroot)src/chunk_dss.c \
81	$(srcroot)src/chunk_mmap.c $(srcroot)src/ckh.c $(srcroot)src/ctl.c \
82	$(srcroot)src/extent.c $(srcroot)src/hash.c $(srcroot)src/huge.c \
83	$(srcroot)src/mb.c $(srcroot)src/mutex.c $(srcroot)src/prof.c \
84	$(srcroot)src/quarantine.c $(srcroot)src/rtree.c $(srcroot)src/stats.c \
85	$(srcroot)src/tcache.c $(srcroot)src/util.c $(srcroot)src/tsd.c
86ifeq ($(enable_valgrind), 1)
87C_SRCS += $(srcroot)src/valgrind.c
88endif
89ifeq ($(enable_zone_allocator), 1)
90C_SRCS += $(srcroot)src/zone.c
91endif
92ifeq ($(IMPORTLIB),$(SO))
93STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
94endif
95ifdef PIC_CFLAGS
96STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
97else
98STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
99endif
100DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
101ifneq ($(SOREV),$(SO))
102DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
103endif
104PC := $(objroot)jemalloc.pc
105MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
106DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
107DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html)
108DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3)
109DOCS := $(DOCS_HTML) $(DOCS_MAN3)
110C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
111	$(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \
112	$(srcroot)test/src/mtx.c $(srcroot)test/src/SFMT.c \
113	$(srcroot)test/src/test.c $(srcroot)test/src/thd.c \
114	$(srcroot)test/src/timer.c
115C_UTIL_INTEGRATION_SRCS := $(srcroot)src/util.c
116TESTS_UNIT := $(srcroot)test/unit/atomic.c \
117	$(srcroot)test/unit/bitmap.c \
118	$(srcroot)test/unit/ckh.c \
119	$(srcroot)test/unit/hash.c \
120	$(srcroot)test/unit/junk.c \
121	$(srcroot)test/unit/junk_alloc.c \
122	$(srcroot)test/unit/junk_free.c \
123	$(srcroot)test/unit/lg_chunk.c \
124	$(srcroot)test/unit/mallctl.c \
125	$(srcroot)test/unit/math.c \
126	$(srcroot)test/unit/mq.c \
127	$(srcroot)test/unit/mtx.c \
128	$(srcroot)test/unit/prof_accum.c \
129	$(srcroot)test/unit/prof_active.c \
130	$(srcroot)test/unit/prof_gdump.c \
131	$(srcroot)test/unit/prof_idump.c \
132	$(srcroot)test/unit/prof_reset.c \
133	$(srcroot)test/unit/prof_thread_name.c \
134	$(srcroot)test/unit/ql.c \
135	$(srcroot)test/unit/qr.c \
136	$(srcroot)test/unit/quarantine.c \
137	$(srcroot)test/unit/rb.c \
138	$(srcroot)test/unit/rtree.c \
139	$(srcroot)test/unit/SFMT.c \
140	$(srcroot)test/unit/size_classes.c \
141	$(srcroot)test/unit/stats.c \
142	$(srcroot)test/unit/tsd.c \
143	$(srcroot)test/unit/util.c \
144	$(srcroot)test/unit/zero.c
145TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
146	$(srcroot)test/integration/allocated.c \
147	$(srcroot)test/integration/sdallocx.c \
148	$(srcroot)test/integration/mallocx.c \
149	$(srcroot)test/integration/MALLOCX_ARENA.c \
150	$(srcroot)test/integration/posix_memalign.c \
151	$(srcroot)test/integration/rallocx.c \
152	$(srcroot)test/integration/thread_arena.c \
153	$(srcroot)test/integration/thread_tcache_enabled.c \
154	$(srcroot)test/integration/xallocx.c \
155	$(srcroot)test/integration/chunk.c
156TESTS_STRESS := $(srcroot)test/stress/microbench.c
157TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_STRESS)
158
159C_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.$(O))
160C_PIC_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
161C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O))
162C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O))
163C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
164C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
165C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O))
166C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_STRESS_OBJS)
167
168TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O))
169TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O))
170TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O))
171TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_STRESS_OBJS)
172
173.PHONY: all dist build_doc_html build_doc_man build_doc
174.PHONY: install_bin install_include install_lib
175.PHONY: install_doc_html install_doc_man install_doc install
176.PHONY: tests check clean distclean relclean
177
178.SECONDARY : $(TESTS_OBJS)
179
180# Default target.
181all: build_lib
182
183dist: build_doc
184
185$(objroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
186	$(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
187
188$(objroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
189	$(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
190
191build_doc_html: $(DOCS_HTML)
192build_doc_man: $(DOCS_MAN3)
193build_doc: $(DOCS)
194
195#
196# Include generated dependency files.
197#
198ifdef CC_MM
199-include $(C_OBJS:%.$(O)=%.d)
200-include $(C_PIC_OBJS:%.$(O)=%.d)
201-include $(C_JET_OBJS:%.$(O)=%.d)
202-include $(C_TESTLIB_OBJS:%.$(O)=%.d)
203-include $(TESTS_OBJS:%.$(O)=%.d)
204endif
205
206$(C_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
207$(C_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
208$(C_PIC_OBJS): CFLAGS += $(PIC_CFLAGS)
209$(C_JET_OBJS): $(objroot)src/%.jet.$(O): $(srcroot)src/%.c
210$(C_JET_OBJS): CFLAGS += -DJEMALLOC_JET
211$(C_TESTLIB_UNIT_OBJS): $(objroot)test/src/%.unit.$(O): $(srcroot)test/src/%.c
212$(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
213$(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c
214$(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
215$(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c
216$(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c
217$(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB
218$(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
219$(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
220$(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
221$(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST
222$(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
223$(TESTS_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
224ifneq ($(IMPORTLIB),$(SO))
225$(C_OBJS) $(C_JET_OBJS): CPPFLAGS += -DDLLEXPORT
226endif
227
228ifndef CC_MM
229# Dependencies.
230HEADER_DIRS = $(srcroot)include/jemalloc/internal \
231	$(objroot)include/jemalloc $(objroot)include/jemalloc/internal
232HEADERS = $(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h))
233$(C_OBJS) $(C_PIC_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): $(HEADERS)
234$(TESTS_OBJS): $(objroot)test/include/test/jemalloc_test.h
235endif
236
237$(C_OBJS) $(C_PIC_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O):
238	@mkdir -p $(@D)
239	$(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
240ifdef CC_MM
241	@$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
242endif
243
244ifneq ($(SOREV),$(SO))
245%.$(SO) : %.$(SOREV)
246	@mkdir -p $(@D)
247	ln -sf $(<F) $@
248endif
249
250$(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(C_PIC_OBJS),$(C_OBJS))
251	@mkdir -p $(@D)
252	$(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
253
254$(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(C_PIC_OBJS)
255$(objroot)lib/$(LIBJEMALLOC).$(A) : $(C_OBJS)
256$(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(C_OBJS)
257
258$(STATIC_LIBS):
259	@mkdir -p $(@D)
260	$(AR) $(ARFLAGS)@AROUT@ $+
261
262$(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(TESTS_UNIT_LINK_OBJS) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS)
263	@mkdir -p $(@D)
264	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS)
265
266$(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
267	@mkdir -p $(@D)
268	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(filter -lpthread,$(LIBS))) -lm $(EXTRA_LDFLAGS)
269
270$(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
271	@mkdir -p $(@D)
272	$(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) -lm $(EXTRA_LDFLAGS)
273
274build_lib_shared: $(DSOS)
275build_lib_static: $(STATIC_LIBS)
276build_lib: build_lib_shared build_lib_static
277
278install_bin:
279	install -d $(BINDIR)
280	@for b in $(BINS); do \
281	echo "install -m 755 $$b $(BINDIR)"; \
282	install -m 755 $$b $(BINDIR); \
283done
284
285install_include:
286	install -d $(INCLUDEDIR)/jemalloc
287	@for h in $(C_HDRS); do \
288	echo "install -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
289	install -m 644 $$h $(INCLUDEDIR)/jemalloc; \
290done
291
292install_lib_shared: $(DSOS)
293	install -d $(LIBDIR)
294	install -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
295ifneq ($(SOREV),$(SO))
296	ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
297endif
298
299install_lib_static: $(STATIC_LIBS)
300	install -d $(LIBDIR)
301	@for l in $(STATIC_LIBS); do \
302	echo "install -m 755 $$l $(LIBDIR)"; \
303	install -m 755 $$l $(LIBDIR); \
304done
305
306install_lib_pc: $(PC)
307	install -d $(LIBDIR)/pkgconfig
308	@for l in $(PC); do \
309	echo "install -m 644 $$l $(LIBDIR)/pkgconfig"; \
310	install -m 644 $$l $(LIBDIR)/pkgconfig; \
311done
312
313install_lib: install_lib_shared install_lib_static install_lib_pc
314
315install_doc_html:
316	install -d $(DATADIR)/doc/jemalloc$(install_suffix)
317	@for d in $(DOCS_HTML); do \
318	echo "install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
319	install -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
320done
321
322install_doc_man:
323	install -d $(MANDIR)/man3
324	@for d in $(DOCS_MAN3); do \
325	echo "install -m 644 $$d $(MANDIR)/man3"; \
326	install -m 644 $$d $(MANDIR)/man3; \
327done
328
329install_doc: install_doc_html install_doc_man
330
331install: install_bin install_include install_lib install_doc
332
333tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
334tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE))
335tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE))
336tests: tests_unit tests_integration tests_stress
337
338check_unit_dir:
339	@mkdir -p $(objroot)test/unit
340check_integration_dir:
341	@mkdir -p $(objroot)test/integration
342check_stress_dir:
343	@mkdir -p $(objroot)test/stress
344check_dir: check_unit_dir check_integration_dir check_stress_dir
345
346check_unit: tests_unit check_unit_dir
347	$(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
348check_integration: tests_integration check_integration_dir
349	$(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
350check_stress: tests_stress check_stress_dir
351	$(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
352check: tests check_dir
353	$(SHELL) $(objroot)test/test.sh $(TESTS:$(srcroot)%.c=$(objroot)%)
354
355ifeq ($(enable_code_coverage), 1)
356coverage_unit: check_unit
357	$(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
358	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src unit $(C_TESTLIB_UNIT_OBJS)
359	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/unit unit $(TESTS_UNIT_OBJS)
360
361coverage_integration: check_integration
362	$(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
363	$(SHELL) $(srcroot)coverage.sh $(srcroot)src integration $(C_UTIL_INTEGRATION_OBJS)
364	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src integration $(C_TESTLIB_INTEGRATION_OBJS)
365	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/integration integration $(TESTS_INTEGRATION_OBJS)
366
367coverage_stress: check_stress
368	$(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
369	$(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
370	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src stress $(C_TESTLIB_STRESS_OBJS)
371	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/stress stress $(TESTS_STRESS_OBJS)
372
373coverage: check
374	$(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
375	$(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
376	$(SHELL) $(srcroot)coverage.sh $(srcroot)src integration $(C_UTIL_INTEGRATION_OBJS)
377	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src unit $(C_TESTLIB_UNIT_OBJS)
378	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src integration $(C_TESTLIB_INTEGRATION_OBJS)
379	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/src stress $(C_TESTLIB_STRESS_OBJS)
380	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/unit unit $(TESTS_UNIT_OBJS) $(TESTS_UNIT_AUX_OBJS)
381	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/integration integration $(TESTS_INTEGRATION_OBJS)
382	$(SHELL) $(srcroot)coverage.sh $(srcroot)test/stress integration $(TESTS_STRESS_OBJS)
383endif
384
385clean:
386	rm -f $(C_OBJS)
387	rm -f $(C_PIC_OBJS)
388	rm -f $(C_JET_OBJS)
389	rm -f $(C_TESTLIB_OBJS)
390	rm -f $(C_OBJS:%.$(O)=%.d)
391	rm -f $(C_OBJS:%.$(O)=%.gcda)
392	rm -f $(C_OBJS:%.$(O)=%.gcno)
393	rm -f $(C_PIC_OBJS:%.$(O)=%.d)
394	rm -f $(C_PIC_OBJS:%.$(O)=%.gcda)
395	rm -f $(C_PIC_OBJS:%.$(O)=%.gcno)
396	rm -f $(C_JET_OBJS:%.$(O)=%.d)
397	rm -f $(C_JET_OBJS:%.$(O)=%.gcda)
398	rm -f $(C_JET_OBJS:%.$(O)=%.gcno)
399	rm -f $(C_TESTLIB_OBJS:%.$(O)=%.d)
400	rm -f $(C_TESTLIB_OBJS:%.$(O)=%.gcda)
401	rm -f $(C_TESTLIB_OBJS:%.$(O)=%.gcno)
402	rm -f $(TESTS_OBJS:%.$(O)=%$(EXE))
403	rm -f $(TESTS_OBJS)
404	rm -f $(TESTS_OBJS:%.$(O)=%.d)
405	rm -f $(TESTS_OBJS:%.$(O)=%.gcda)
406	rm -f $(TESTS_OBJS:%.$(O)=%.gcno)
407	rm -f $(TESTS_OBJS:%.$(O)=%.out)
408	rm -f $(DSOS) $(STATIC_LIBS)
409	rm -f $(objroot)*.gcov.*
410
411distclean: clean
412	rm -f $(objroot)bin/jemalloc-config
413	rm -f $(objroot)bin/jemalloc.sh
414	rm -f $(objroot)bin/jeprof
415	rm -f $(objroot)config.log
416	rm -f $(objroot)config.status
417	rm -f $(objroot)config.stamp
418	rm -f $(cfghdrs_out)
419	rm -f $(cfgoutputs_out)
420
421relclean: distclean
422	rm -f $(objroot)configure
423	rm -f $(objroot)VERSION
424	rm -f $(DOCS_HTML)
425	rm -f $(DOCS_MAN3)
426
427#===============================================================================
428# Re-configuration rules.
429
430ifeq ($(enable_autogen), 1)
431$(srcroot)configure : $(srcroot)configure.ac
432	cd ./$(srcroot) && $(AUTOCONF)
433
434$(objroot)config.status : $(srcroot)configure
435	./$(objroot)config.status --recheck
436
437$(srcroot)config.stamp.in : $(srcroot)configure.ac
438	echo stamp > $(srcroot)config.stamp.in
439
440$(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
441	./$(objroot)config.status
442	@touch $@
443
444# There must be some action in order for make to re-read Makefile when it is
445# out of date.
446$(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
447	@true
448endif
449