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