1 | ################################################################# |
---|
2 | ### File: Makefile.in |
---|
3 | ### Purpose: Makefile for omalloc |
---|
4 | ### Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) |
---|
5 | ### Created: 11/99 |
---|
6 | ### Version: $Id$ |
---|
7 | ################################################################# |
---|
8 | |
---|
9 | SHELL = /bin/sh |
---|
10 | VERSION = @VERSION@ |
---|
11 | |
---|
12 | ## |
---|
13 | ## various paths |
---|
14 | ## |
---|
15 | prefix = @prefix@ |
---|
16 | exec_prefix = @exec_prefix@ |
---|
17 | |
---|
18 | # header file is installed here |
---|
19 | includedir = @includedir@ |
---|
20 | # library is installed here |
---|
21 | libdir = @libdir@ |
---|
22 | |
---|
23 | ## |
---|
24 | ## various programs |
---|
25 | ## |
---|
26 | @SET_MAKE@ |
---|
27 | CC = @CC@ |
---|
28 | AR = @AR@ |
---|
29 | RANLIB = @RANLIB@ |
---|
30 | PERL = @PERL@ |
---|
31 | LN_S = @LN_S@ |
---|
32 | INSTALL = @INSTALL@ |
---|
33 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
---|
34 | INSTALL_DATA = @INSTALL_DATA@ |
---|
35 | MKINSTALLDIRS = ./mkinstalldirs |
---|
36 | ## |
---|
37 | ## compiler and linker options |
---|
38 | ## |
---|
39 | CFLAGS = @CFLAGS@ |
---|
40 | CPPFLAGS = -I. @CPPFLAGS@ |
---|
41 | DEFS = @DEFS@ |
---|
42 | |
---|
43 | ## |
---|
44 | ## external config and and malloc files |
---|
45 | ## |
---|
46 | EXTERNAL_CONFIG_SOURCE = @EXTERNAL_CONFIG_SOURCE@ |
---|
47 | EXTERNAL_CONFIG_HEADER = @EXTERNAL_CONFIG_HEADER@ |
---|
48 | |
---|
49 | OM_MALLOC_HEADER = @OM_MALLOC_HEADER@ |
---|
50 | OM_MALLOC_SOURCE = @OM_MALLOC_SOURCE@ |
---|
51 | |
---|
52 | ## |
---|
53 | ## End configuration dependend stuff |
---|
54 | ################################################################# |
---|
55 | |
---|
56 | ### |
---|
57 | ### file sets |
---|
58 | ### |
---|
59 | |
---|
60 | # normal C source files |
---|
61 | CSOURCES= \ |
---|
62 | omBinPage.c omList.c omAllocEmulate.c omDebug.c \ |
---|
63 | om_Alloc.c omDebugCheck.c omOpts.c omGetBackTrace.c\ |
---|
64 | omAllocSystem.c omError.c omStats.c omRet2Info.c \ |
---|
65 | omBin.c omFindExec.c omDebugTrack.c \ |
---|
66 | omalloc_provide.c omAllocFunc.c |
---|
67 | |
---|
68 | ifdef EXTERNAL_CONFIG_SOURCE |
---|
69 | GSOURCES := ${GSOURCES} omExternalConfig.c |
---|
70 | endif |
---|
71 | ifdef OM_MALLOC_SOURCE |
---|
72 | GSOURCES := ${GSOURCES} omMalloc.c |
---|
73 | endif |
---|
74 | |
---|
75 | # ASO_SOURCES |
---|
76 | ASO_SOURCES = |
---|
77 | |
---|
78 | HEADERS= mylimits.h omlimits.h \ |
---|
79 | om_Alloc.h omList.h omDerivedConfig.h \ |
---|
80 | omAllocDecl.h omConfig.h omMemOps.h \ |
---|
81 | omDebug.h omOpts.h omInlineDecl.h \ |
---|
82 | omAllocPrivate.h omError.h omPage.h \ |
---|
83 | omAllocSystem.h omFindExec.h omStats.h \ |
---|
84 | omBin.h omDefaultConfig.h omStructs.h \ |
---|
85 | omBinPage.h omInline.h omGetBackTrace.h \ |
---|
86 | omReturn.h omRet2Info.h omAllocFunc.h |
---|
87 | |
---|
88 | OBJS := $(CSOURCES:.c=.o) $(GSOURCES:.c=.o) |
---|
89 | OBJS_NDEBUG := $(CSOURCES:.c=.o_ndebug) $(GSOURCES:.c=.o_ndebug) |
---|
90 | |
---|
91 | SOURCES=${CSOURCES} omGetPageSize.h omMallocSystem.h gmalloc.c dlmalloc.h dlmalloc.c \ |
---|
92 | omMmap.c gmalloc.c omTables.c pmalloc.h pmalloc.c omalloc.c omalloc_debug.c \ |
---|
93 | $(TESTSOURCES) omtTestAlloc.c |
---|
94 | |
---|
95 | ASO_OBJS := $(ASO_SOURCES:.aso.cc=.aso) |
---|
96 | |
---|
97 | DISTFILES=$(SOURCES) $(HEADERS) omtTest.h makeheader Makefile.in \ |
---|
98 | omConfig.h.in omlimits.h.in mylimits.h configure.in mkinstalldirs install-sh configure |
---|
99 | |
---|
100 | ## |
---|
101 | ## Build Targets |
---|
102 | ## |
---|
103 | %.o: %.c omConfig.h omlimits.h omTables.h omalloc.h omTables.inc |
---|
104 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< |
---|
105 | |
---|
106 | %.o_ndebug: %.c omConfig.h omlimits.h mylimits.h omTables.h omalloc.h omTables.inc |
---|
107 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@ |
---|
108 | |
---|
109 | %.aso.o: %.aso.cc mmtables.inc |
---|
110 | ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} $< -o $@ |
---|
111 | .PRECIOUS: %.aso.o |
---|
112 | |
---|
113 | %.aso: %.aso.o |
---|
114 | ./$< > $@ |
---|
115 | |
---|
116 | all: libomalloc.a libomalloc_ndebug.a omalloc.h omalloc.o omalloc_debug.o |
---|
117 | |
---|
118 | lib: libomalloc.a |
---|
119 | |
---|
120 | libomalloc.a: $(OBJS) Makefile omConfig.h omlimits.h mylimits.h |
---|
121 | rm -f $@ |
---|
122 | $(AR) cr $@ $(OBJS) |
---|
123 | $(RANLIB) $@ |
---|
124 | |
---|
125 | libomalloc_ndebug.a: $(OBJS_NDEBUG) Makefile omConfig.h omlimits.h mylimits.h |
---|
126 | rm -f $@ |
---|
127 | $(AR) cr $@ $(OBJS_NDEBUG) |
---|
128 | $(RANLIB) $@ |
---|
129 | |
---|
130 | omalloc.h: $(HEADERS) omTables.h |
---|
131 | ./makeheader om_Alloc.h $@ |
---|
132 | |
---|
133 | omalloc.o: omalloc.c omalloc.h |
---|
134 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@ |
---|
135 | |
---|
136 | omalloc_debug.o: omalloc_debug.c omalloc.h |
---|
137 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< -o $@ |
---|
138 | |
---|
139 | omTables.inc: omTables omalloc.h |
---|
140 | ./omTables > omTables.xx && mv omTables.xx $@ |
---|
141 | |
---|
142 | omTables.h: omTables |
---|
143 | ./omTables 1 >omTables.yy && mv omTables.yy $@ |
---|
144 | |
---|
145 | omTables: omAllocPrivate.h omConfig.h omTables.c omlimits.h mylimits.h |
---|
146 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_GENERATE_INC omTables.c -o omTables |
---|
147 | |
---|
148 | # |
---|
149 | # targets to generate omExternalConfig.[c,h] |
---|
150 | # |
---|
151 | om_Alloc.h: omMalloc.h |
---|
152 | |
---|
153 | ifdef OM_MALLOC_SOURCE |
---|
154 | omMalloc.c: $(OM_MALLOC_SOURCE) |
---|
155 | cp $(OM_MALLOC_SOURCE) omMalloc.c |
---|
156 | endif |
---|
157 | ifdef EXTERNAL_CONFIG_SOURCE |
---|
158 | omExternalConfig.c: $(EXTERNAL_CONFIG_SOURCE) |
---|
159 | cp $(EXTERNAL_CONFIG_SOURCE) omExternalConfig.c |
---|
160 | endif |
---|
161 | |
---|
162 | ifdef EXTERNAL_CONFIG_HEADER |
---|
163 | omExternalConfig.h: $(EXTERNAL_CONFIG_HEADER) |
---|
164 | cp $(EXTERNAL_CONFIG_HEADER) omExternalConfig.h |
---|
165 | omDerivedConfig.h: omExternalConfig.h |
---|
166 | endif |
---|
167 | |
---|
168 | # |
---|
169 | # configure related stuff |
---|
170 | # |
---|
171 | omConfig.h omMalloc.h omlimits.h mylimits.h: stamp-h |
---|
172 | |
---|
173 | stamp-h : config.status omConfig.h.in omlimits.h.in ${OM_MALLOC_HEADER} |
---|
174 | CONFIG_FILES= CONFIG_HEADERS="omConfig.h omlimits.h omMalloc.h:${OM_MALLOC_HEADER}" ./config.status |
---|
175 | |
---|
176 | Makefile: Makefile.in config.status |
---|
177 | CONFIG_FILES="Makefile" CONFIG_HEADERS= ./config.status |
---|
178 | |
---|
179 | config.status: configure |
---|
180 | ./config.status --recheck |
---|
181 | |
---|
182 | configure: configure.in |
---|
183 | @echo "WARNING: You need to rerun autoconf. I am proceeding, for now." |
---|
184 | @touch configure |
---|
185 | # autoconf |
---|
186 | |
---|
187 | ## |
---|
188 | ## install targets |
---|
189 | ## |
---|
190 | install-nolns: install |
---|
191 | |
---|
192 | install-libsingular: |
---|
193 | $(MKINSTALLDIRS) $(includedir)/singular |
---|
194 | $(INSTALL) omalloc.h $(includedir)/singular |
---|
195 | |
---|
196 | install: all |
---|
197 | $(MKINSTALLDIRS) $(libdir) |
---|
198 | $(MKINSTALLDIRS) $(includedir) |
---|
199 | $(INSTALL_DATA) libomalloc.a $(libdir) |
---|
200 | $(RANLIB) $(libdir)/libomalloc.a |
---|
201 | $(INSTALL_DATA) libomalloc_ndebug.a $(libdir) |
---|
202 | $(RANLIB) $(libdir)/libomalloc_ndebug.a |
---|
203 | $(INSTALL_DATA) omalloc.o $(libdir) |
---|
204 | $(INSTALL_DATA) omalloc_debug.o $(libdir) |
---|
205 | $(INSTALL_DATA) omalloc.h $(includedir) |
---|
206 | $(INSTALL_DATA) omalloc.c $(includedir) |
---|
207 | $(INSTALL_DATA) omlimits.h $(includedir) |
---|
208 | $(INSTALL_DATA) mylimits.h $(includedir) |
---|
209 | |
---|
210 | install_all: install libomalloc_p.a |
---|
211 | $(INSTALL_DATA) libomalloc_p.a $(libdir) |
---|
212 | $(RANLIB) $(libdir)/libomalloc_p.a |
---|
213 | |
---|
214 | install_min: libomalloc_ndebug.a omalloc.o |
---|
215 | $(MKINSTALLDIRS) $(libdir) |
---|
216 | $(MKINSTALLDIRS) $(includedir) |
---|
217 | $(INSTALL_DATA) libomalloc_ndebug.a $(libdir) |
---|
218 | $(RANLIB) $(libdir)/libomalloc_ndebug.a |
---|
219 | $(INSTALL_DATA) omalloc.o $(libdir) |
---|
220 | $(INSTALL_DATA) omalloc.h $(includedir) |
---|
221 | $(INSTALL_DATA) omalloc.c $(includedir) |
---|
222 | $(INSTALL_DATA) omlimits.h $(includedir) |
---|
223 | $(INSTALL_DATA) mylimits.h $(includedir) |
---|
224 | |
---|
225 | uninstall: |
---|
226 | rm -f $(includedir)/omalloc.h $(includedir)/omalloc.c |
---|
227 | rm -f $(libdir)/libomalloc.a $(libdir)/libomalloc_ndebug.a $(libdir)/libomalloc_p.a $(libdir)/omalloc.o $(libdir)/omalloc_debug.o |
---|
228 | |
---|
229 | ## |
---|
230 | ## dist targets |
---|
231 | ## |
---|
232 | dist: omalloc-$(VERSION).tgz |
---|
233 | omalloc-$(VERSION).tgz: $(DISTFILES) |
---|
234 | rm -rf omalloc-$(VERSION) |
---|
235 | mkdir omalloc-$(VERSION) |
---|
236 | cp $(DISTFILES) omalloc-$(VERSION) |
---|
237 | tar czf omalloc-$(VERSION).tgz omalloc-$(VERSION) |
---|
238 | |
---|
239 | ## |
---|
240 | ## clean targest |
---|
241 | ## |
---|
242 | mostlyclean: |
---|
243 | -rm -f core *.d *.o *.og *.op *_d.c *.a depend *.out *.tgz omTables *.o_ndebug *.gp *.gprof |
---|
244 | -rm -f omtTest omtTest_* libomalloc* *.bprof omtTest omtTest_* |
---|
245 | -rm -f omMalloc.c omExternalConfig.h omExternalConfig.c |
---|
246 | |
---|
247 | clean: mostlyclean |
---|
248 | |
---|
249 | distclean: clean |
---|
250 | -rm -f *~ .\#* stamp-h omMalloc.h |
---|
251 | rm -rf omalloc-$(VERSION) |
---|
252 | -rm -f omalloc.h omTables.h omTables.inc |
---|
253 | -rm -f omConfig.h omlimits.h Makefile TAGS* tags config.status config.cache config.log |
---|
254 | |
---|
255 | srcclean: distclean |
---|
256 | |
---|
257 | maintainer-clean: distclean |
---|
258 | rm configure |
---|
259 | |
---|
260 | .PHONY: TAGS |
---|
261 | |
---|
262 | TAGS: omConfig.h.in omlimits.h.in |
---|
263 | etags omConfig.h.in omlimits.h.in $(SOURCES) $(HEADERS) |
---|
264 | |
---|
265 | ## |
---|
266 | ## check |
---|
267 | ## |
---|
268 | |
---|
269 | check: omtTest omtTest_ndebug |
---|
270 | ./omtTest |
---|
271 | ./omtTest_ndebug |
---|
272 | |
---|
273 | ## |
---|
274 | ## Below here is stuff for developpers |
---|
275 | ################################################################# |
---|
276 | |
---|
277 | ## |
---|
278 | ## compiler and linker options for debug version |
---|
279 | ## |
---|
280 | |
---|
281 | CCG = ${CC} |
---|
282 | CCM = gcc -MM -DGENERATE_DEPEND |
---|
283 | |
---|
284 | CFLAGSG = -g -O -fno-inline-functions -Wall |
---|
285 | DEFSG = @DEFS@ |
---|
286 | |
---|
287 | OBJG := $(CSOURCES:.c=.og) $(GSOURCES:.c=.og) |
---|
288 | |
---|
289 | %.og: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h |
---|
290 | $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@ |
---|
291 | |
---|
292 | libg: libomalloc_g.a |
---|
293 | |
---|
294 | libomalloc_g.a: $(OBJG) Makefile omConfig.h mylimits.h omlimits.h |
---|
295 | rm -f $@ |
---|
296 | $(AR) cr $@ $(OBJG) |
---|
297 | $(RANLIB) $@ |
---|
298 | |
---|
299 | |
---|
300 | ## |
---|
301 | ## expanded macros |
---|
302 | ## |
---|
303 | OBJD := $(CSOURCES:%.c=%_d.og) $(GSOURCES:%.c=%_d.og) |
---|
304 | |
---|
305 | %_d.c : %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h |
---|
306 | $(CCG) -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@ |
---|
307 | .PRECIOUS: %_d.c |
---|
308 | |
---|
309 | libd: libomalloc_d.a |
---|
310 | |
---|
311 | libomalloc_d.a: $(OBJD) Makefile omConfig.h mylimits.h omlimits.h |
---|
312 | rm -f $@ |
---|
313 | $(AR) cr $@ $(OBJD) |
---|
314 | $(RANLIB) $@ |
---|
315 | |
---|
316 | #################################################### |
---|
317 | ## compiler and linker options for profile version |
---|
318 | ## |
---|
319 | |
---|
320 | CCP = ${CC} |
---|
321 | |
---|
322 | CFLAGSP = -g -pg -O3 |
---|
323 | DEFSP = @DEFS@ |
---|
324 | |
---|
325 | OBJP := $(CSOURCES:.c=.op) $(GSOURCES:.c=.op) |
---|
326 | |
---|
327 | |
---|
328 | ## |
---|
329 | ## Profile Targets |
---|
330 | ## |
---|
331 | %.op: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h |
---|
332 | $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@ |
---|
333 | |
---|
334 | libp: libomalloc_p.a |
---|
335 | |
---|
336 | libomalloc_p.a: $(OBJP) Makefile omConfig.h mylimits.h omlimits.h |
---|
337 | rm -f $@ |
---|
338 | $(AR) cr $@ $(OBJP) |
---|
339 | $(RANLIB) $@ |
---|
340 | |
---|
341 | #################################################### |
---|
342 | ## Test program |
---|
343 | ## |
---|
344 | TESTSOURCES = omtTest.c omtTestReal.c omtTestDebug.c omtTestKeep.c omtTestError.c |
---|
345 | |
---|
346 | TEST_D := $(TESTSOURCES:.c=_d.og) |
---|
347 | omtTest_d: libd $(TEST_D) |
---|
348 | $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_D) -L. -lomalloc_d -o omtTest_d |
---|
349 | |
---|
350 | TEST_G := $(TESTSOURCES:.c=.og) |
---|
351 | omtTest_g: libg $(TEST_G) |
---|
352 | $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_G) -L. -lomalloc_g -o omtTest_g |
---|
353 | |
---|
354 | TEST_P := $(TESTSOURCES:.c=.op) |
---|
355 | omtTest_p: libp $(TEST_P) |
---|
356 | $(CCG) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} $(TEST_P) -L. -lomalloc_p -o omtTest_p |
---|
357 | |
---|
358 | TEST_O := $(TESTSOURCES:.c=.o) |
---|
359 | omtTest: lib $(TEST_O) |
---|
360 | $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_O) -L. -lomalloc -o omtTest |
---|
361 | |
---|
362 | TEST_NDEBUG_O := $(TESTSOURCES:.c=.o_ndebug) |
---|
363 | omtTest_ndebug: libomalloc_ndebug.a $(TEST_NDEBUG_O) |
---|
364 | $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_NDEBUG_O) -DOM_NDEBUG -L. -lomalloc_ndebug -o omtTest_ndebug |
---|
365 | |
---|
366 | %.om : %.c omalloc.h |
---|
367 | $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC -c $< -o $@ |
---|
368 | TEST_M := $(TESTSOURCES:.c=.om) |
---|
369 | omtTest_m: lib $(TEST_M) |
---|
370 | $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC $(TEST_M) -L. -lomalloc -o omtTest_m |
---|
371 | |
---|
372 | ## |
---|
373 | ## backup |
---|
374 | ## |
---|
375 | |
---|
376 | backup: omalloc-$(VERSION).tgz |
---|
377 | mcopy -o omalloc-$(VERSION).tgz a: |
---|
378 | |
---|
379 | ## |
---|
380 | ## Dependencies |
---|
381 | ## |
---|
382 | %.d: %.c omConfig.h mylimits.h Makefile omTables.h omTables.inc omalloc.h omlimits.h |
---|
383 | echo $(@:.d=.o_ndebug) $(@:.d=.og) $(@:.d=.od) $(@:.d=.op) $(@:.d=_d.c) $(@:.d=.om)" " \\ > $@ |
---|
384 | $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@ |
---|
385 | |
---|
386 | depend: $(CSOURCES:.c=.d) omConfig.h omlimits.h mylimits.h $(TESTSOURCES:.c=.d) |
---|
387 | cat *.d >depend |
---|
388 | |
---|
389 | ifeq (depend,$(wildcard depend)) |
---|
390 | include depend |
---|
391 | endif |
---|
392 | |
---|
393 | |
---|
394 | |
---|