source: git/omalloc/Makefile.in @ bfa90e5

spielwiese
Last change on this file since bfa90e5 was 82e3b3, checked in by Hans Schönemann <hannes@…>, 22 years ago
*hannes: distclean should not remove configure git-svn-id: file:///usr/local/Singular/svn/trunk@5983 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.6 KB
Line 
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: Makefile.in,v 1.15 2002-03-08 12:23:05 hannes Exp $
7#################################################################
8
9SHELL           = /bin/sh
10VERSION         = @VERSION@
11
12##
13## various paths
14##
15prefix          = @prefix@
16exec_prefix     = @exec_prefix@
17
18# header file is installed here
19includedir      = @includedir@
20# library is installed here
21libdir          = @libdir@
22
23##
24## various programs
25##
26@SET_MAKE@
27CC              = @CC@
28AR              = @AR@
29RANLIB          = @RANLIB@
30PERL            = @PERL@
31LN_S            = @LN_S@
32INSTALL         = @INSTALL@
33INSTALL_PROGRAM = @INSTALL_PROGRAM@
34INSTALL_DATA    = @INSTALL_DATA@
35MKINSTALLDIRS   = ./mkinstalldirs
36##
37## compiler and linker options
38##
39CFLAGS          = @CFLAGS@
40CPPFLAGS        = -I. @CPPFLAGS@
41DEFS            = @DEFS@
42
43##
44## external config and and malloc files
45##
46EXTERNAL_CONFIG_SOURCE = @EXTERNAL_CONFIG_SOURCE@
47EXTERNAL_CONFIG_HEADER = @EXTERNAL_CONFIG_HEADER@
48
49OM_MALLOC_HEADER = @OM_MALLOC_HEADER@
50OM_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
61CSOURCES=                                                          \
62omBinPage.c      omList.c         omAllocEmulate.c omDebug.c       \
63om_Alloc.c        omDebugCheck.c   omOpts.c         omGetBackTrace.c\
64omAllocSystem.c  omError.c        omStats.c        omRet2Info.c   \
65omBin.c          omFindExec.c     omDebugTrack.c                   \
66omalloc_provide.c omAllocFunc.c
67
68ifdef EXTERNAL_CONFIG_SOURCE
69GSOURCES := ${GSOURCES} omExternalConfig.c
70endif
71ifdef OM_MALLOC_SOURCE
72GSOURCES := ${GSOURCES} omMalloc.c
73endif
74
75# ASO_SOURCES
76ASO_SOURCES =
77
78HEADERS=               mylimits.h             omlimits.h \
79om_Alloc.h             omList.h               omDerivedConfig.h \
80omAllocDecl.h          omConfig.h             omMemOps.h        \
81omDebug.h              omOpts.h               omInlineDecl.h    \
82omAllocPrivate.h       omError.h              omPage.h          \
83omAllocSystem.h        omFindExec.h           omStats.h         \
84omBin.h                omDefaultConfig.h      omStructs.h       \
85omBinPage.h            omInline.h             omGetBackTrace.h  \
86omReturn.h             omRet2Info.h           omAllocFunc.h             
87
88OBJS := $(CSOURCES:.c=.o)  $(GSOURCES:.c=.o)
89OBJS_NDEBUG := $(CSOURCES:.c=.o_ndebug) $(GSOURCES:.c=.o_ndebug)
90
91SOURCES=${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
95ASO_OBJS := $(ASO_SOURCES:.aso.cc=.aso)
96
97DISTFILES=$(SOURCES) $(HEADERS) omtTest.h makeheader.pl 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
116all:    libomalloc.a libomalloc_ndebug.a omalloc.h omalloc.o omalloc_debug.o
117
118lib: libomalloc.a
119
120libomalloc.a: $(OBJS) Makefile omConfig.h omlimits.h mylimits.h
121        rm -f $@
122        $(AR) cr $@ $(OBJS)
123        $(RANLIB) $@
124
125libomalloc_ndebug.a: $(OBJS_NDEBUG) Makefile omConfig.h omlimits.h mylimits.h
126        rm -f $@
127        $(AR) cr $@ $(OBJS_NDEBUG)
128        $(RANLIB) $@
129
130omalloc.h: $(HEADERS)
131        $(PERL) makeheader.pl -a om_Alloc.h $@
132
133omalloc.o: omalloc.c
134        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@
135
136omalloc_debug.o: omalloc_debug.c
137        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< -o $@
138
139omTables.inc: omTables
140        ./omTables > $@
141
142omTables.h: omTables
143        ./omTables 1 >$@
144
145omTables: 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#
151om_Alloc.h: omMalloc.h
152
153ifdef OM_MALLOC_SOURCE
154omMalloc.c: $(OM_MALLOC_SOURCE)
155        cp $(OM_MALLOC_SOURCE) omMalloc.c
156endif
157ifdef EXTERNAL_CONFIG_SOURCE
158omExternalConfig.c: $(EXTERNAL_CONFIG_SOURCE)
159        cp $(EXTERNAL_CONFIG_SOURCE) omExternalConfig.c
160endif
161
162ifdef EXTERNAL_CONFIG_HEADER
163omExternalConfig.h: $(EXTERNAL_CONFIG_HEADER)
164        cp $(EXTERNAL_CONFIG_HEADER) omExternalConfig.h
165omDerivedConfig.h: omExternalConfig.h
166endif
167
168#
169# configure related stuff
170#
171omConfig.h omMalloc.h omlimits.h mylimits.h: stamp-h
172
173stamp-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
176Makefile: Makefile.in config.status
177        CONFIG_FILES="Makefile" CONFIG_HEADERS= ./config.status
178
179config.status: configure
180        ./config.status --recheck
181
182configure: 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##
190install_all: all libomalloc_p.a
191        $(MKINSTALLDIRS) $(libdir)
192        $(MKINSTALLDIRS) $(includedir)
193        $(INSTALL_DATA) libomalloc.a $(libdir)
194        $(RANLIB) $(libdir)/libomalloc.a
195        $(INSTALL_DATA) libomalloc_ndebug.a $(libdir)
196        $(RANLIB) $(libdir)/libomalloc_ndebug.a
197        $(INSTALL_DATA) libomalloc_p.a $(libdir)
198        $(RANLIB) $(libdir)/libomalloc_p.a
199        $(INSTALL_DATA) omalloc.o omalloc_debug.o $(libdir)
200        $(INSTALL_DATA) omalloc.h omalloc.c $(includedir)
201        $(INSTALL_DATA) omlimits.h mylimits.h omalloc.c $(includedir)
202
203install: libomalloc_ndebug.a omalloc.o
204        $(MKINSTALLDIRS) $(libdir)
205        $(MKINSTALLDIRS) $(includedir)
206        $(INSTALL_DATA) libomalloc_ndebug.a $(libdir)
207        $(RANLIB) $(libdir)/libomalloc_ndebug.a
208        $(INSTALL_DATA) omalloc.o $(libdir)
209        $(INSTALL_DATA) omalloc.h omalloc.c $(includedir)
210        $(INSTALL_DATA) omlimits.h mylimits.h omalloc.c $(includedir)
211
212uninstall:
213        rm -f $(includedir)/omalloc.h $(includedir)/omalloc.c
214        rm -f $(libdir)/libomalloc.a $(libdir)/libomalloc_ndebug.a $(libdir)/libomalloc_p.a $(libdir)/omalloc.o $(libdir)/omalloc_debug.o
215
216##
217## dist targets
218##
219dist: omalloc-$(VERSION).tgz
220omalloc-$(VERSION).tgz: $(DISTFILES)
221        rm -rf omalloc-$(VERSION)
222        mkdir omalloc-$(VERSION)
223        cp $(DISTFILES) omalloc-$(VERSION)
224        tar czf omalloc-$(VERSION).tgz omalloc-$(VERSION)
225
226##
227## clean targest
228##
229mostlyclean:
230        -rm -f core *.d *.o *.og *.op *_d.c *.ob *.a depend *.out *.tgz omTables *.o_ndebug *.gp *.gprof
231        -rm -f omtTest omtTest_* libomalloc* *.bprof omtTest omtTest_*
232        -rm -f omMalloc.c omExternalConfig.h omExternalConfig.c
233
234clean: mostlyclean
235
236distclean: clean
237        -rm -f  *~ .\#*  stamp-h omMalloc.h
238        rm -rf omalloc-$(VERSION)
239        -rm -f omConfig.h omlimits.h Makefile TAGS* tags config.status config.cache config.log
240
241srcclean: distclean
242
243maintainer-clean: distclean
244        rm configure
245
246.PHONY: TAGS
247
248TAGS:   omConfig.h.in omlimits.h.in
249        etags omConfig.h.in omlimits.h.in $(SOURCES) $(HEADERS)
250
251##
252## check
253##
254
255check: omtTest omtTest_ndebug
256        ./omtTest
257        ./omtTest_ndebug
258
259##
260## Below here is stuff for developpers
261#################################################################
262
263##
264## compiler and linker options for debug version
265##
266
267CCG             = gcc
268CCM             = gcc -MM -DGENERATE_DEPEND
269
270CFLAGSG         = -g -O -fno-inline-functions -Wall
271DEFSG           =  @DEFS@
272
273OBJG := $(CSOURCES:.c=.og) $(GSOURCES:.c=.og)
274
275%.og: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
276        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
277
278libg: libomalloc_g.a
279
280libomalloc_g.a: $(OBJG) Makefile omConfig.h mylimits.h omlimits.h
281        rm -f $@
282        $(AR) cr $@ $(OBJG)
283        $(RANLIB) $@
284
285
286##
287## expanded macros
288##
289OBJD := $(CSOURCES:%.c=%_d.og) $(GSOURCES:%.c=%_d.og)
290
291%_d.c : %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
292        $(CCG) -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
293.PRECIOUS: %_d.c
294
295libd: libomalloc_d.a
296
297libomalloc_d.a: $(OBJD) Makefile omConfig.h mylimits.h omlimits.h
298        rm -f $@
299        $(AR) cr $@ $(OBJD)
300        $(RANLIB) $@
301
302####################################################
303## compiler and linker options for profile version
304##
305
306CCP             = gcc
307
308CFLAGSP         = -g -pg -O3 -a
309DEFSP           =  @DEFS@
310
311OBJP := $(CSOURCES:.c=.op) $(GSOURCES:.c=.op)
312
313
314##
315## Profile Targets
316##
317%.op: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
318        $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
319
320libp: libomalloc_p.a
321
322libomalloc_p.a: $(OBJP) Makefile omConfig.h mylimits.h omlimits.h
323        rm -f $@
324        $(AR) cr $@ $(OBJP)
325        $(RANLIB) $@
326
327####################################################
328## compiler and linker options for bprof version
329##
330
331CCB             = gcc
332
333CFLAGSB         = -g -O3
334DEFSB           =  @DEFS@
335
336##
337## .og files for having -O and -g object versions available at the same time
338##
339OBJB := $(CSOURCES:.c=.ob) $(GSOURCES:.c=.ob)
340
341
342##
343## Profile Targets
344##
345%.ob: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
346        $(CCB) ${CFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@
347
348libb: libomalloc_b.a
349
350libomalloc_b.a: $(OBJB) Makefile omConfig.h mylimits.h omlimits.h
351        rm -f $@
352        $(AR) cr $@ $(OBJB)
353        $(RANLIB) $@
354
355####################################################
356## Test program
357##
358TESTSOURCES     = omtTest.c omtTestReal.c omtTestDebug.c omtTestKeep.c omtTestError.c
359
360TEST_D := $(TESTSOURCES:.c=_d.og)
361omtTest_d: libd $(TEST_D)
362        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_D) -L. -lomalloc_d -o omtTest_d
363
364TEST_G := $(TESTSOURCES:.c=.og)
365omtTest_g: libg $(TEST_G)
366        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_G) -L. -lomalloc_g -o omtTest_g
367
368TEST_P := $(TESTSOURCES:.c=.op)
369omtTest_p: libp $(TEST_P)
370        $(CCG) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} $(TEST_P) -L. -lomalloc_p -o omtTest_p
371
372TEST_B := $(TESTSOURCES:.c=.ob)
373omtTest_b: libb $(TEST_B)
374        $(CCG) ${CFLAGSB} ${CPPFLAGS} ${DEFSB} $(TEST_B) -L. -lomalloc_b  /usr/lib/bmon.o -o omtTest_b
375
376TEST_O := $(TESTSOURCES:.c=.o)
377omtTest: lib  $(TEST_O)
378        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_O) -L. -lomalloc -o omtTest
379
380TEST_NDEBUG_O := $(TESTSOURCES:.c=.o_ndebug)
381omtTest_ndebug: libomalloc_ndebug.a $(TEST_NDEBUG_O)
382        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_NDEBUG_O) -DOM_NDEBUG -L. -lomalloc_ndebug -o omtTest_ndebug
383
384%.om : %.c omalloc.h
385        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC -c $< -o $@
386TEST_M := $(TESTSOURCES:.c=.om)
387omtTest_m: lib $(TEST_M)
388        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC $(TEST_M) -L. -lomalloc -o omtTest_m
389
390##
391## backup
392##
393
394backup: omalloc-$(VERSION).tgz
395        mcopy -o omalloc-$(VERSION).tgz a:
396
397##
398## Dependencies
399##
400%.d: %.c omConfig.h mylimits.h Makefile omTables.h omTables.inc omalloc.h omlimits.h
401        echo $(@:.d=.o_ndebug) $(@:.d=.og) $(@:.d=.od)  $(@:.d=.op) $(@:.d=.ob) $(@:.d=_d.c) $(@:.d=.om)" " \\ > $@
402        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
403
404depend:   $(CSOURCES:.c=.d) omConfig.h omlimits.h mylimits.h $(TESTSOURCES:.c=.d)
405        cat *.d >depend
406
407ifeq (depend,$(wildcard depend))
408include depend
409endif
410
411
412
Note: See TracBrowser for help on using the repository browser.