source: git/kernel/Makefile.in @ 10d98c

spielwiese
Last change on this file since 10d98c was 10d98c, checked in by Hans Schönemann <hannes@…>, 14 years ago
*Hannes: debug stuff git-svn-id: file:///usr/local/Singular/svn/trunk@11966 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 12.8 KB
Line 
1#################################################################
2###
3### Makefile for Singular
4###
5#################################################################
6
7SHELL           = /bin/sh
8
9##
10## version
11##
12SINGULAR_VERSION        = @SINGULAR_VERSION@
13SINGULAR                = @SINGULAR@
14SINGUNAME               = @SINGUNAME@
15##
16## various paths
17##
18srcdir          = @srcdir@
19prefix          = @prefix@
20exec_prefix     = @exec_prefix@
21libdir          = @libdir@
22# program executable goes here
23bindir          = @bindir@
24# includes are taken from here
25includedir      = @includedir@
26install_bindir  = ${install_prefix}/${SINGUNAME}
27
28##
29## various programs
30##
31@SET_MAKE@
32CC              = @CC@
33LD              = @LD@
34CXX             = @CXX@
35LEX             = @LEX@
36PERL            = @PERL@
37BISON           = bison
38INSTALL         = @INSTALL@
39INSTALL_PROGRAM = @INSTALL_PROGRAM@
40INSTALL_DATA    = @INSTALL_DATA@
41MKINSTALLDIRS   = ./mkinstalldirs
42LN_S            = @LN_S@
43
44##
45## compiler and linker options
46##
47PIPE            = @PIPE@
48CFLAGS          = @CFLAGS@ ${PIPE}
49CXXFLAGS        = @CXXFLAGS@ ${PIPE}
50CXXTEMPLFLAGS   = @CXXTEMPLFLAGS@
51CPPFLAGS        = -I${srcdir} @CPPFLAGS@
52DEFS            = -DNDEBUG -DOM_NDEBUG -D@SING_UNAME@ @DEFS@
53LDFLAGS         = @LDFLAGS@
54LD_DYN_FLAGS    = @LD_DYN_FLAGS@
55SFLAGS          = @SFLAGS@
56SLDFLAGS        = @SLDFLAGS@
57
58LD_LIBC         = -lc
59STATIC_LDFLAGS  = @STATIC_LDFLAGS@
60# under cygwin, do not explicitly link against -lm, for it is the cygwin
61# lib -- if you really want to do this, use -lm as the _last_ thing on the
62# arguments to link
63ifneq ($(SINGUNAME),ix86-Win)
64LIBS            = -lm @NEED_LIBS@
65else
66# for the 2-0-* versions under Windows, we don't need gdbm, readline and ncurses
67LIBS            = -lsingfac -lsingcf -lntl -lgmp -lreadline -lncurses -lomalloc_ndebug
68#LIBS           = -lsingfac -lsingcf -lgmp
69endif
70MP_LIBS         = @MP_LIBS@
71
72ifdef LD_STATIC
73LDFLAGS  := ${STATIC_LDFLAGS} ${LDFLAGS}
74LIBS := ${MP_LIBS} ${LIBS}
75DL_KERNEL =
76else
77LDFLAGS  := ${LD_DYN_FLAGS} ${LDFLAGS}
78DL_KERNEL       = @DL_KERNEL@
79endif
80
81# CXXFLAGS =  -g -Wall -Wno-unused
82# CFLAGS =  -g -Wall -Wno-unused
83##
84## End configuration dependend stuff
85#################################################################
86
87###
88### file sets
89###
90
91# normal C++ source files
92CXXSOURCES=clapconv.cc \
93    clapsing.cc mminit.cc\
94    febase.cc feread.cc feResource.cc \
95    ffields.cc hdegree.cc hilb.cc hutil.cc \
96    sca.cc gring.cc gr_kstd2.cc summator.cc ncSAMult.cc ncSACache.cc ncSAFormula.cc \
97    ideals.cc intvec.cc int64vec.cc \
98    khstd.cc kstdfac.cc \
99    kstd1.cc kstd2.cc kutil.cc \
100    longalg.cc longrat.cc longrat0.cc \
101    maps.cc matpol.cc misc.cc gnumpfl.cc gnumpc.cc \
102    rmodulo2m.cc rmodulon.cc rintegers.cc \
103    modulop.cc mpr_complex.cc sparsmat.cc fast_maps.cc \
104    fglmzero.cc fglmvec.cc fglmgauss.cc fglmhom.cc fglmcomb.cc \
105    numbers.cc polys.cc p_polys.cc polys0.cc polys1.cc polys-impl.cc \
106    ring.cc shortfl.cc kspoly.cc \
107    syz.cc syz0.cc syz1.cc syz2.cc syz3.cc\
108    timer.cc weight.cc \
109    GMPrat.cc multicnt.cc npolygon.cc semic.cc spectrum.cc splist.cc \
110    mod_raw.cc walkProc.cc walkMain.cc walkSupport.cc\
111    eigenval.cc units.cc kbuckets.cc sbuckets.cc\
112    mpr_inout.cc mpr_base.cc mpr_numeric.cc \
113    prCopy.cc p_Mult_q.cc \
114    pDebug.cc pInline2.cc pInline1.cc pInline0.cc \
115    pShallowCopyDelete.cc fast_mult.cc digitech.cc \
116    tgb.cc tgbgauss.cc ringgb.cc f5data.cc f5lists.cc f5gb.cc \
117    f5c.cc F5cLists.cc ratgring.cc shiftgb.cc gfan.cc
118
119# normal C source files
120CSOURCES=weight0.c fegetopt.c fereadl.c dError.c mmstd.c
121
122# C++ sources which are used if part of the kernel are dynamically linked
123ifeq ($(DL_KERNEL),1)
124DL_KERNEL_SOURCES=p_Procs_Dynamic.cc
125else
126DL_KERNEL_SOURCES=
127endif
128
129# C++ sources which are used for dynamic libraries if part of the kernel is
130# dynamically linked
131DL_LIB_SOURCES=p_Procs_Lib.cc
132
133# C++ sources which are used if no parts of the kernel are dynamically linked
134STATIC_SOURCES=p_Procs_Static.cc
135
136# special C++ source files (need extra compiling and/or linking), for which
137# dependencies should be generated
138ESOURCES=mmalloc.cc $(DL_KERNEL_SOURCES) $(DL_LIB_SOURCES) $(STATIC_SOURCES)
139
140SOURCES=${CSOURCES} ${CXXSOURCES} \
141        prCopyTemplate.cc \
142        p_Delete__T.cc p_ShallowCopyDelete__T.cc \
143        p_Copy__T.cc p_Mult_nn__T.cc  pp_Mult_nn__T.cc \
144        pp_Mult_mm__T.cc p_Mult_mm__T.cc \
145        p_Minus_mm_Mult_qq__T.cc p_Add_q__T.cc \
146        p_Neg__T.cc pp_Mult_Coeff_mm_DivSelect__T.cc \
147        pp_Mult_Coeff_mm_DivSelectMult__T.cc \
148        p_Merge_q__T.cc pp_Mult_mm_Noether__T.cc\
149        p_kBucketSetLm__T.cc \
150        kInline.cc
151
152HEADERS=hutil.h stairc.h ideals.h \
153        longalg.h structs.h intvec.h int64vec.h longrat.h \
154        numbers.h stype.h clapconv.h maps.h \
155        clapsing.h matpol.h polys.h p_polys.h syz.h \
156        ring.h timer.h dError.h fast_maps.h \
157        febase.h shortfl.h mpr_complex.h mpr_global.h \
158        summator.h ncSAMult.h ncSACache.h sca.h gring.h ncSAFormula.h \
159        walkProc.h walkMain.h walkSupport.h\
160        ffields.h khstd.h sparsmat.h gnumpfl.h gnumpc.h \
161        fglm.h kstd1.h \
162        rmodulo2m.h rmodulon.h rintegers.h modulop.h sing_dbm.h weight.h \
163        fglmgauss.h fglmvec.h \
164        kstdfac.h kmatrix.h\
165        kutil.h \
166        dbm_sl.h polys-impl.h \
167        GMPrat.h multicnt.h npolygon.h semic.h spectrum.h splist.h multicnt.h \
168        eigenval.h units.h mod_raw.h kbuckets.h sbuckets.h\
169        mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \
170        fegetopt.h distrib.h \
171        ratgring.h shiftgb.h prCopy.h prCopyMacros.h \
172        p_MemAdd.h p_MemCopy.h p_MemCmp.h p_Numbers.h \
173        pInline2.h pInline1.h pInline0.h mmalloc.h \
174        omSingularConfig.h pShallowCopyDelete.h \
175        p_Procs_Dynamic.h p_Procs_Impl.h p_Procs_Set.h \
176        p_Procs.h p_Procs_Static.h p_Mult_q.h gfan.h
177
178DISTFILES=${SOURCES} ${HEADERS} ${ESOURCES} \
179        Makefile.in configure.in configure \
180        mod2.h.in testgh install-sh mkinstalldirs \
181        check_aso.pl prCopy.pl
182
183OBJS := $(CXXSOURCES:.cc=.o) $(CSOURCES:.c=.o)
184OBJS2 := $(ESOURCES:.cc=.o)
185OBJSG2 := $(ESOURCES:.cc=.og)
186OBJSP2 := $(ESOURCES:.cc=.op)
187
188P_PROCS_MODULES = FieldZp FieldIndep FieldQ FieldGeneral
189
190ifeq ($(DL_KERNEL),1)
191OBJS    := $(OBJS) $(DL_KERNEL_SOURCES:.cc=.o)
192DL_LIBS := $(P_PROCS_MODULES:%=p_Procs_%.so)
193else
194ifndef LD_STATIC
195LIBS := $(MP_LIBS) $(LIBS)
196endif
197OBJS := $(OBJS) $(STATIC_SOURCES:.cc=.o)
198DL_LIBS=
199endif
200
201#
202# Singular libraries which go into distribution
203# MAKE SURE THAT THIS IS UP_TO_DATE
204#
205SLIBS = COPYING \
206        ainvar.lib   algebra.lib   all.lib       brnoeth.lib    classify.lib \
207        deform.lib   elim.lib      equising.lib  finvar.lib     gaussman.lib \
208        general.lib  graphics.lib  groups.lib    hnoether.lib   homolog.lib  \
209        inout.lib    intprog.lib   latex.lib     linalg.lib     makedbm.lib  \
210        matrix.lib   mondromy.lib  mprimdec.lib \
211        mregular.lib normal.lib    ntsolve.lib   paramet.lib \
212        poly.lib     presolve.lib  primdec.lib   primitiv.lib   qhmoduli.lib \
213        random.lib   reesclos.lib  ring.lib      rinvar.lib     sing.lib \
214        solve.lib    spcurve.lib   spectrum.lib  standard.lib   stratify.lib \
215        surf.lib     teachstd.lib  template.lib  toric.lib      triang.lib \
216        weierst.lib  zeroset.lib   help.cnf
217
218SLIBS_FILES = $(addprefix LIB/,${SLIBS})
219
220GFTABLES = $(wildcard LIB/gftables/[1-9]*)
221
222##
223## Build Targets
224##
225.cc.o: 
226        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} -c $<
227.c.o:
228        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $<
229
230# building objects for shared libraries
231p_Procs_Lib_%.dl_o : p_Procs_Lib.cc p_Procs_Dynamic.o
232        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
233
234%.dl_o : %.cc
235        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -c $< -o $@
236
237DL_TAILG=\"sog\"
238DL_TAILP=\"sop\"
239
240
241OBJG= $(CXXSOURCES:.cc=.og) $(CSOURCES:.c=.og)
242
243ifeq ($(DL_KERNEL),1)
244OBJG    := $(OBJG) $(DL_KERNEL_SOURCES:.cc=.og)
245DL_LIBSG := $(P_PROCS_MODULES:%=p_Procs_%.sog)
246DL_LIBSP := $(P_PROCS_MODULES:%=p_Procs_%.sog)
247else
248OBJG := $(OBJG) $(STATIC_SOURCES:.cc=.og)
249DL_LIBSG=
250DL_LIBSP=
251endif
252
253all:    kversion.h libkernel.a libkernel_g.a libkernel_p.a mmalloc.o \
254        ${DL_LIBS} ${DL_LIBSG} ${OBJS2} ${DL_LIBSP}
255
256libkernel.a: ${OBJS}
257        -rm -f libkernel.a
258        ar cr $@ $^
259
260p_Procs_Lib.o: p_Procs_Lib.inc
261
262kversion.h: ${SOURCES} ${HEADERS} Makefile.in mod2.h.in \
263           configure.in
264        echo "#define feVersionId0 "  `date '+%Y%m%d%H'` >kversion.h
265
266# Hmm compiling with -fomit-frame-pointer resulted in access violation
267# under cygwin
268prCopy.o: prCopy.inc
269
270prCopy.inc : prCopyMacros.h prCopyTemplate.cc prCopy.pl
271        $(PERL) prCopy.pl > prCopy.inc
272
273# additional dependencies for p_Procs_[Static|Dynamic|Lib].cc
274p_Procs_Static.o p_Procs_Static.og p_Procs_Static.op: p_Procs_Static.inc
275p_Procs_Static.inc: p_Procs_Static.h
276p_Procs_Dynamic.o p_Procs_Lib.o p_Procs_Dynamic.og p_Procs_Lib.og\
277  p_Procs_Dynamic.op p_Procs_Lib.op: p_Procs_Dynamic.inc
278p_Procs_Dynamic.inc p_Procs_Lib.inc: p_Procs_Dynamic.h
279
280# here is how p_Procs_[Static|Dynamic].inc is generated
281p_Procs_%.inc: p_Procs_Generate.cc p_Procs_Impl.h mod2.h
282        $(CXX) -g -Dp_Procs_$* p_Procs_Generate.cc -o p_Procs_$*
283        ./p_Procs_$* > p_Procs_$*.inc
284        -rm -f p_Procs_$* p_Procs_$*.exe
285
286p_Procs_%.so: p_Procs_Lib_%.dl_o
287        $(LD) ${SLDFLAGS} -o $@ $^
288
289##
290## install targets
291##
292install-nolns: install
293
294install-libsingular:
295        ${MKINSTALLDIRS} ${includedir}/singular
296        -for file in *.h; do \
297        ${INSTALL_PROGRAM} $$file ${includedir}/singular; \
298        done
299
300install: all installbin
301
302installbin: ${DL_LIBS} ${DL_LIBSG} ${DL_LIBSP}
303        ${MKINSTALLDIRS} ${bindir}
304        - ranlib libkernel.a
305        - ranlib libkernel_g.a
306        - ranlib libkernel_p.a
307ifeq (,${DL_LIBS})
308else
309
310ifeq (,${DL_LIBSG})
311else
312        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
313        -${INSTALL_PROGRAM} ${DL_LIBS} ../Singular
314        -${INSTALL_PROGRAM} ${DL_LIBSG} ../Singular
315        -${INSTALL_PROGRAM} ${DL_LIBSP} ../Singular
316endif
317endif
318
319
320install-bindist: ${DL_LIBS} libkernel.a
321        ${MKINSTALLDIRS} ${bindir}
322ifeq (,${DL_LIBS})
323else
324        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
325endif
326
327##
328## clean targest
329##
330mostlyclean:
331        -rm -f p_Procs_*.inc
332        -rm -f *.o *.og core *.op p_Procs *.dl_o* *.so*
333
334clean: mostlyclean
335        -rm -f *.bak *.d *.dd depend
336
337distclean: clean
338        -rm -f *~ .\#* kversion.h
339        -rm -f mod2.h Makefile TAGS* tags config.status config.cache config.log
340
341srcclean:
342        @echo "This command is intended for maintainers to use;"
343        @echo "Rebuilding the deleted files requires flex"
344        @echo "bison, perl"
345
346maintainer-clean: distclean srcclean
347        @echo "This command is intended for maintainers to use;"
348        @echo "Rebuilding the deleted files requires flex"
349        @echo "bison, perl and autoconf"
350        -rm configure
351
352##
353## miscellanous targets
354##
355
356TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
357        etags ${SOURCES} ${ESOURCES} ${HEADERS}
358
359tags:   
360        ctags *.c *.h *.cc *.inc
361
362echoLIBS:
363        @echo ${SLIBS}
364
365##
366## Below here is stuff for developpers
367#################################################################
368
369
370##
371## .og files for having -O and -g object versions available at the same time
372##
373
374OBJG1 := $(CXXSOURCES:.cc=.og)
375OBJG2 := $(CSOURCES:.c=.og)
376
377##
378## compiler and linker options for debug version
379##
380
381CCG             = ${CC}
382CXXG            = ${CXX}
383CXXM            = gcc -MM -MG -DGENERATE_DEPEND
384CCM             = gcc -MM -MG -DGENERATE_DEPEND
385
386CFLAGSG         = -g ${PIPE}
387CXXFLAGSG       = -g ${PIPE}
388DEFSG           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILG)
389
390##
391## Debug Targets
392##
393
394p_Procs_%.sog: p_Procs_Lib_%.dl_og
395        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} $< -o $@
396
397p_Procs_Lib_%.dl_og : p_Procs_Lib.cc  p_Procs_Dynamic.og
398        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
399
400%.dl_og: %.cc
401        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -c $< -o $@
402
403%.og: %.cc
404        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} -c $< -o $@
405
406$(OBJG2) : %.og: %.c
407        $(CCG)  ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
408
409libkernel_g.a: ${OBJG} ${DL_LIBSG} ${OBJSG2}
410        -rm -f libkernel_g.a
411        ar cr $@ ${OBJG}
412
413##
414## .op files for profiling
415##
416
417OBJP1 := $(CXXSOURCES:.cc=.op)
418OBJP2 := $(CSOURCES:.c=.op)
419
420OBJP=$(OBJP1) $(OBJP2)
421
422ifeq ($(DL_KERNEL),1)
423OBJP    := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
424else
425OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op)
426endif
427
428##
429## compiler and linker options for profiling version
430##
431
432CCP             = ${CC}
433CXXP            = ${CXX}
434
435CFLAGSP         = -g -pg -O ${PIPE}
436CXXFLAGSP       = -g -pg -O ${PIPE}
437DEFSP           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILP)
438
439##
440## Profiling Targets
441##
442
443p_Procs_%.sop: p_Procs_Lib_%.dl_op
444        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} $< -o $@
445
446p_Procs_Lib_%.dl_op : p_Procs_Lib.cc  p_Procs_Dynamic.op
447        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
448
449%.dl_op: %.cc
450        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -c $< -o $@
451
452%.op: %.cc
453        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} -c $< -o $@
454
455$(OBJP2) : %.op: %.c
456        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
457
458libkernel_p.a: ${OBJP} ${DL_LIBSP} ${OBJSP2}
459        -rm -f libkernel_p.a
460        ar cr $@ ${OBJP}
461
462##
463## dependencies
464##
465
466%.dd: %.cc mod2.h
467        echo $(@:.dd=.og) $(@:.dd=.op) $(@:.dd=.dl_o) $(@:.dd=.dl_og) $(@:.dd=.dl_op)" " \\ > $@
468        $(CXXM) -DGENTABLE ${CPPFLAGS} ${DEFSG} $< >> $@
469
470%.d: %.c mod2.h
471        echo $(@:.d=.og) $(@:.d=.op) " " \\ > $@
472        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
473
474depend:   $(CXXSOURCES:.cc=.dd) $(ESOURCES:.cc=.dd) $(CSOURCES:.c=.d) mod2.h
475        cat *.d *.dd >depend
476
477ifeq (depend,$(wildcard depend))
478include depend
479endif
480
481
Note: See TracBrowser for help on using the repository browser.