source: git/omalloc/Makefile.in @ b36d80c

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