source: git/omalloc/Makefile.in @ b1dfaf

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