source: git/omalloc/Makefile.in @ 0d348b

spielwiese
Last change on this file since 0d348b was 0d348b, checked in by Alexander Dreyer <dreyer@…>, 14 years ago
FIX patch [Singular] #241 merged git-svn-id: file:///usr/local/Singular/svn/trunk@13009 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.2 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##
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     \
87omTables.h
88
89OBJS := $(CSOURCES:.c=.o)  $(GSOURCES:.c=.o)
90OBJS_NDEBUG := $(CSOURCES:.c=.o_ndebug) $(GSOURCES:.c=.o_ndebug)
91
92SOURCES=${CSOURCES} omGetPageSize.h omMallocSystem.h gmalloc.c dlmalloc.h dlmalloc.c \
93        omMmap.c gmalloc.c omTables.c pmalloc.h pmalloc.c omalloc.c omalloc_debug.c  \
94        $(TESTSOURCES) omtTestAlloc.c
95
96ASO_OBJS := $(ASO_SOURCES:.aso.cc=.aso)
97
98DISTFILES=$(SOURCES) $(HEADERS) omtTest.h makeheader Makefile.in \
99           omConfig.h.in omlimits.h.in mylimits.h configure.in mkinstalldirs install-sh configure
100
101##
102## Build Targets
103##
104%.o: %.c omConfig.h omlimits.h omTables.h omalloc.h omTables.inc
105        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $<
106
107%.o_ndebug: %.c omConfig.h omlimits.h mylimits.h omTables.h omalloc.h omTables.inc
108        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@
109
110%.aso.o: %.aso.cc mmtables.inc
111        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} $< -o $@
112.PRECIOUS: %.aso.o
113
114%.aso: %.aso.o
115        ./$< > $@
116
117all:    libomalloc.a libomalloc_ndebug.a omalloc.h omalloc.o omalloc_debug.o
118
119lib: libomalloc.a
120
121libomalloc.a: $(OBJS) Makefile omConfig.h omlimits.h mylimits.h
122        rm -f $@
123        $(AR) cr $@ $(OBJS)
124        $(RANLIB) $@
125
126libomalloc_ndebug.a: $(OBJS_NDEBUG) Makefile omConfig.h omlimits.h mylimits.h
127        rm -f $@
128        $(AR) cr $@ $(OBJS_NDEBUG)
129        $(RANLIB) $@
130
131omalloc.h: $(HEADERS) omTables.h
132        ./makeheader om_Alloc.h $@
133
134omalloc.o: omalloc.c omalloc.h
135        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@
136
137omalloc_debug.o: omalloc_debug.c omalloc.h
138        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< -o $@
139
140omTables.inc: omTables omalloc.h
141        ./omTables > omTables.xx && mv omTables.xx  $@
142
143omTables.h: omTables
144        ./omTables 1 >omTables.yy && mv omTables.yy $@
145
146omTables: omAllocPrivate.h omConfig.h omTables.c omlimits.h mylimits.h
147        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_GENERATE_INC omTables.c -o omTables
148
149#
150# targets to generate omExternalConfig.[c,h]
151#
152om_Alloc.h: omMalloc.h
153
154ifdef OM_MALLOC_SOURCE
155omMalloc.c: $(OM_MALLOC_SOURCE)
156        cp $(OM_MALLOC_SOURCE) omMalloc.c
157endif
158ifdef EXTERNAL_CONFIG_SOURCE
159omExternalConfig.c: $(EXTERNAL_CONFIG_SOURCE)
160        cp $(EXTERNAL_CONFIG_SOURCE) omExternalConfig.c
161endif
162
163ifdef EXTERNAL_CONFIG_HEADER
164omExternalConfig.h: $(EXTERNAL_CONFIG_HEADER)
165        cp $(EXTERNAL_CONFIG_HEADER) omExternalConfig.h
166omDerivedConfig.h: omExternalConfig.h
167endif
168
169#
170# configure related stuff
171#
172omConfig.h omMalloc.h omlimits.h mylimits.h: stamp-h
173
174stamp-h : config.status omConfig.h.in omlimits.h.in ${OM_MALLOC_HEADER}
175        CONFIG_FILES= CONFIG_HEADERS="omConfig.h omlimits.h omMalloc.h:${OM_MALLOC_HEADER}" ./config.status
176
177Makefile: Makefile.in config.status
178        CONFIG_FILES="Makefile" CONFIG_HEADERS= ./config.status
179
180config.status: configure
181        ./config.status --recheck
182
183configure: configure.in
184        @echo "WARNING: You need to rerun autoconf. I am proceeding, for now."
185        @touch configure
186#       autoconf
187
188##
189## install targets
190##
191install-nolns: install
192
193install-libsingular:
194        $(MKINSTALLDIRS) $(includedir)/singular
195        $(INSTALL) omalloc.h $(includedir)/singular
196
197install: all
198        $(MKINSTALLDIRS) $(libdir)
199        $(MKINSTALLDIRS) $(includedir)
200        $(INSTALL_DATA) libomalloc.a $(libdir)
201        $(RANLIB) $(libdir)/libomalloc.a
202        $(INSTALL_DATA) libomalloc_ndebug.a $(libdir)
203        $(RANLIB) $(libdir)/libomalloc_ndebug.a
204        $(INSTALL_DATA) omalloc.o $(libdir)
205        $(INSTALL_DATA) omalloc_debug.o $(libdir)
206        $(INSTALL_DATA) omalloc.h $(includedir)
207        $(INSTALL_DATA) omalloc.c $(includedir)
208        $(INSTALL_DATA) omlimits.h $(includedir)
209        $(INSTALL_DATA) mylimits.h $(includedir)
210
211install_all: install libomalloc_p.a
212        $(INSTALL_DATA) libomalloc_p.a $(libdir)
213        $(RANLIB) $(libdir)/libomalloc_p.a
214
215install_min: libomalloc_ndebug.a omalloc.o
216        $(MKINSTALLDIRS) $(libdir)
217        $(MKINSTALLDIRS) $(includedir)
218        $(INSTALL_DATA) libomalloc_ndebug.a $(libdir)
219        $(RANLIB) $(libdir)/libomalloc_ndebug.a
220        $(INSTALL_DATA) omalloc.o $(libdir)
221        $(INSTALL_DATA) omalloc.h $(includedir)
222        $(INSTALL_DATA) omalloc.c $(includedir)
223        $(INSTALL_DATA) omlimits.h $(includedir)
224        $(INSTALL_DATA) mylimits.h $(includedir)
225
226uninstall:
227        rm -f $(includedir)/omalloc.h $(includedir)/omalloc.c
228        rm -f $(libdir)/libomalloc.a $(libdir)/libomalloc_ndebug.a $(libdir)/libomalloc_p.a $(libdir)/omalloc.o $(libdir)/omalloc_debug.o
229
230##
231## dist targets
232##
233dist: omalloc-$(VERSION).tgz
234omalloc-$(VERSION).tgz: $(DISTFILES)
235        rm -rf omalloc-$(VERSION)
236        mkdir omalloc-$(VERSION)
237        cp $(DISTFILES) omalloc-$(VERSION)
238        tar czf omalloc-$(VERSION).tgz omalloc-$(VERSION)
239
240##
241## clean targest
242##
243mostlyclean:
244        -rm -f core *.d *.o *.og *.op *_d.c *.a depend *.out *.tgz omTables *.o_ndebug *.gp *.gprof
245        -rm -f omtTest omtTest_* libomalloc* *.bprof omtTest omtTest_*
246        -rm -f omMalloc.c omExternalConfig.h omExternalConfig.c
247
248clean: mostlyclean
249
250distclean: clean
251        -rm -f  *~ .\#*  stamp-h omMalloc.h
252        rm -rf omalloc-$(VERSION)
253        -rm -f omalloc.h omTables.h omTables.inc
254        -rm -f omConfig.h omlimits.h Makefile TAGS* tags config.status config.cache config.log
255
256srcclean: distclean
257
258maintainer-clean: distclean
259        rm configure
260
261.PHONY: TAGS
262
263TAGS:   omConfig.h.in omlimits.h.in
264        etags omConfig.h.in omlimits.h.in $(SOURCES) $(HEADERS)
265
266##
267## check
268##
269
270check: omtTest omtTest_ndebug
271        ./omtTest
272        ./omtTest_ndebug
273
274##
275## Below here is stuff for developpers
276#################################################################
277
278##
279## compiler and linker options for debug version
280##
281
282CCG             = ${CC}
283CCM             = gcc -MM -DGENERATE_DEPEND
284
285CFLAGSG         = -g -O -fno-inline-functions -Wall
286DEFSG           =  @DEFS@
287
288OBJG := $(CSOURCES:.c=.og) $(GSOURCES:.c=.og)
289
290%.og: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
291        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
292
293libg: libomalloc_g.a
294
295libomalloc_g.a: $(OBJG) Makefile omConfig.h mylimits.h omlimits.h
296        rm -f $@
297        $(AR) cr $@ $(OBJG)
298        $(RANLIB) $@
299
300
301##
302## expanded macros
303##
304OBJD := $(CSOURCES:%.c=%_d.og) $(GSOURCES:%.c=%_d.og)
305
306%_d.c : %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
307        $(CCG) -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
308.PRECIOUS: %_d.c
309
310libd: libomalloc_d.a
311
312libomalloc_d.a: $(OBJD) Makefile omConfig.h mylimits.h omlimits.h
313        rm -f $@
314        $(AR) cr $@ $(OBJD)
315        $(RANLIB) $@
316
317####################################################
318## compiler and linker options for profile version
319##
320
321CCP             = ${CC}
322
323CFLAGSP         = -g -pg -O3
324DEFSP           =  @DEFS@
325
326OBJP := $(CSOURCES:.c=.op) $(GSOURCES:.c=.op)
327
328
329##
330## Profile Targets
331##
332%.op: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h
333        $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
334
335libp: libomalloc_p.a
336
337libomalloc_p.a: $(OBJP) Makefile omConfig.h mylimits.h omlimits.h
338        rm -f $@
339        $(AR) cr $@ $(OBJP)
340        $(RANLIB) $@
341
342####################################################
343## Test program
344##
345TESTSOURCES     = omtTest.c omtTestReal.c omtTestDebug.c omtTestKeep.c omtTestError.c
346
347TEST_D := $(TESTSOURCES:.c=_d.og)
348omtTest_d: libd $(TEST_D)
349        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_D) -L. -lomalloc_d -o omtTest_d
350
351TEST_G := $(TESTSOURCES:.c=.og)
352omtTest_g: libg $(TEST_G)
353        $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_G) -L. -lomalloc_g -o omtTest_g
354
355TEST_P := $(TESTSOURCES:.c=.op)
356omtTest_p: libp $(TEST_P)
357        $(CCG) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} $(TEST_P) -L. -lomalloc_p -o omtTest_p
358
359TEST_O := $(TESTSOURCES:.c=.o)
360omtTest: lib  $(TEST_O)
361        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_O) -L. -lomalloc -o omtTest
362
363TEST_NDEBUG_O := $(TESTSOURCES:.c=.o_ndebug)
364omtTest_ndebug: libomalloc_ndebug.a $(TEST_NDEBUG_O)
365        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_NDEBUG_O) -DOM_NDEBUG -L. -lomalloc_ndebug -o omtTest_ndebug
366
367%.om : %.c omalloc.h
368        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC -c $< -o $@
369TEST_M := $(TESTSOURCES:.c=.om)
370omtTest_m: lib $(TEST_M)
371        $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC $(TEST_M) -L. -lomalloc -o omtTest_m
372
373##
374## backup
375##
376
377backup: omalloc-$(VERSION).tgz
378        mcopy -o omalloc-$(VERSION).tgz a:
379
380##
381## Dependencies
382##
383%.d: %.c omConfig.h mylimits.h Makefile omTables.h omTables.inc omalloc.h omlimits.h
384        echo $(@:.d=.o_ndebug) $(@:.d=.og) $(@:.d=.od)  $(@:.d=.op) $(@:.d=_d.c) $(@:.d=.om)" " \\ > $@
385        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
386
387depend:   $(CSOURCES:.c=.d) omConfig.h omlimits.h mylimits.h $(TESTSOURCES:.c=.d)
388        cat *.d >depend
389
390ifeq (depend,$(wildcard depend))
391include depend
392endif
393
394
395
Note: See TracBrowser for help on using the repository browser.