source: git/kernel/Makefile.in @ d29df8

spielwiese
Last change on this file since d29df8 was d29df8, checked in by Hans Schönemann <hannes@…>, 15 years ago
*hannes: more dep git-svn-id: file:///usr/local/Singular/svn/trunk@11883 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 12.9 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 ratgring.cc shiftgb.cc gfan.cc
117
118# normal C source files
119CSOURCES=weight0.c fegetopt.c fereadl.c dError.c mmstd.c
120
121# C++ sources which are used if part of the kernel are dynamically linked
122ifeq ($(DL_KERNEL),1)
123DL_KERNEL_SOURCES=p_Procs_Dynamic.cc
124else
125DL_KERNEL_SOURCES=
126endif
127
128# C++ sources which are used for dynamic libraries if part of the kernel is
129# dynamically linked
130DL_LIB_SOURCES=p_Procs_Lib.cc
131
132# C++ sources which are used if no parts of the kernel are dynamically linked
133STATIC_SOURCES=p_Procs_Static.cc
134
135# special C++ source files (need extra compiling and/or linking), for which
136# dependencies should be generated
137ESOURCES=mmalloc.cc $(DL_KERNEL_SOURCES) $(DL_LIB_SOURCES) $(STATIC_SOURCES)
138
139SOURCES=${CSOURCES} ${CXXSOURCES} \
140        prCopyTemplate.cc \
141        p_Delete__T.cc p_ShallowCopyDelete__T.cc \
142        p_Copy__T.cc p_Mult_nn__T.cc  pp_Mult_nn__T.cc \
143        pp_Mult_mm__T.cc p_Mult_mm__T.cc \
144        p_Minus_mm_Mult_qq__T.cc p_Add_q__T.cc \
145        p_Neg__T.cc pp_Mult_Coeff_mm_DivSelect__T.cc \
146        pp_Mult_Coeff_mm_DivSelectMult__T.cc \
147        p_Merge_q__T.cc pp_Mult_mm_Noether__T.cc\
148        p_kBucketSetLm__T.cc \
149        kInline.cc
150
151HEADERS=hutil.h stairc.h ideals.h \
152        longalg.h structs.h intvec.h int64vec.h longrat.h \
153        numbers.h stype.h clapconv.h maps.h \
154        clapsing.h matpol.h polys.h p_polys.h syz.h \
155        ring.h timer.h dError.h fast_maps.h \
156        febase.h shortfl.h mpr_complex.h mpr_global.h \
157        summator.h ncSAMult.h ncSACache.h sca.h gring.h ncSAFormula.h \
158        walkProc.h walkMain.h walkSupport.h\
159        ffields.h khstd.h sparsmat.h gnumpfl.h gnumpc.h \
160        fglm.h kstd1.h \
161        rmodulo2m.h rmodulon.h rintegers.h modulop.h sing_dbm.h weight.h \
162        fglmgauss.h fglmvec.h \
163        kstdfac.h kmatrix.h\
164        kutil.h \
165        dbm_sl.h polys-impl.h \
166        GMPrat.h multicnt.h npolygon.h semic.h spectrum.h splist.h multicnt.h \
167        eigenval.h units.h mod_raw.h kbuckets.h sbuckets.h\
168        mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \
169        fegetopt.h distrib.h \
170        ratgring.h shiftgb.h prCopy.h prCopyMacros.h \
171        p_MemAdd.h p_MemCopy.h p_MemCmp.h p_Numbers.h \
172        pInline2.h pInline1.h pInline0.h mmalloc.h \
173        omSingularConfig.h pShallowCopyDelete.h \
174        p_Procs_Dynamic.h p_Procs_Impl.h p_Procs_Set.h \
175        p_Procs.h p_Procs_Static.h p_Mult_q.h gfan.h
176
177DISTFILES=${SOURCES} ${HEADERS} ${ESOURCES} \
178        Makefile.in configure.in configure \
179        mod2.h.in testgh install-sh mkinstalldirs \
180        check_aso.pl prCopy.pl
181
182OBJS := $(CXXSOURCES:.cc=.o) $(CSOURCES:.c=.o)
183OBJS2 := $(ESOURCES:.cc=.o)
184OBJSG2 := $(ESOURCES:.cc=.og)
185OBJSP2 := $(ESOURCES:.cc=.op)
186
187P_PROCS_MODULES = FieldZp FieldIndep FieldQ FieldGeneral
188
189ifeq ($(DL_KERNEL),1)
190OBJS    := $(OBJS) $(DL_KERNEL_SOURCES:.cc=.o)
191DL_LIBS := $(P_PROCS_MODULES:%=p_Procs_%.so)
192else
193ifndef LD_STATIC
194LIBS := $(MP_LIBS) $(LIBS)
195endif
196OBJS := $(OBJS) $(STATIC_SOURCES:.cc=.o)
197DL_LIBS=
198endif
199
200#
201# Singular libraries which go into distribution
202# MAKE SURE THAT THIS IS UP_TO_DATE
203#
204SLIBS = COPYING \
205        ainvar.lib   algebra.lib   all.lib       brnoeth.lib    classify.lib \
206        deform.lib   elim.lib      equising.lib  finvar.lib     gaussman.lib \
207        general.lib  graphics.lib  groups.lib    hnoether.lib   homolog.lib  \
208        inout.lib    intprog.lib   latex.lib     linalg.lib     makedbm.lib  \
209        matrix.lib   mondromy.lib  mprimdec.lib \
210        mregular.lib normal.lib    ntsolve.lib   paramet.lib \
211        poly.lib     presolve.lib  primdec.lib   primitiv.lib   qhmoduli.lib \
212        random.lib   reesclos.lib  ring.lib      rinvar.lib     sing.lib \
213        solve.lib    spcurve.lib   spectrum.lib  standard.lib   stratify.lib \
214        surf.lib     teachstd.lib  template.lib  toric.lib      triang.lib \
215        weierst.lib  zeroset.lib   help.cnf
216
217SLIBS_FILES = $(addprefix LIB/,${SLIBS})
218
219GFTABLES = $(wildcard LIB/gftables/[1-9]*)
220
221##
222## Build Targets
223##
224.cc.o: 
225        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} -c $<
226.c.o:
227        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $<
228
229# building objects for shared libraries
230p_Procs_Lib_%.dl_o : p_Procs_Lib.cc p_Procs_Dynamic.o
231        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
232
233%.dl_o : %.cc
234        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -c $< -o $@
235
236DL_TAILG=\"sog\"
237DL_TAILP=\"sop\"
238
239
240ifeq ($(DL_KERNEL),1)
241
242OBJG := $(OBJG) $(DL_KERNEL_SOURCES:.cc=.og)
243DL_LIBSG := $(P_PROCS_MODULES:%=p_Procs_%.sog)
244DL_LIBSP := $(P_PROCS_MODULES:%=p_Procs_%.sog)
245
246else
247
248OBJG := $(OBJG) $(STATIC_SOURCES:.cc=.og)
249DL_LIBSG=
250DL_LIBSP=
251
252endif
253
254all:    kversion.h libkernel.a libkernel_g.a libkernel_p.a mmalloc.o \
255        ${DL_LIBS} ${DL_LIBSG} ${OBJS2} ${DL_LIBSP}
256
257libkernel.a: ${OBJS}
258        -rm -f libkernel.a
259        ar cr $@ $^
260
261p_Procs_Lib.o: p_Procs_Lib.inc
262
263kversion.h: ${SOURCES} ${HEADERS} Makefile.in mod2.h.in \
264           configure.in
265        echo "#define feVersionId0 "  `date '+%Y%m%d%H'` >kversion.h
266
267# Hmm compiling with -fomit-frame-pointer resulted in access violation
268# under cygwin
269prCopy.o: prCopy.inc
270
271prCopy.inc : prCopyMacros.h prCopyTemplate.cc prCopy.pl
272        $(PERL) prCopy.pl > prCopy.inc
273
274# additional dependencies for p_Procs_[Static|Dynamic|Lib].cc
275p_Procs_Static.o p_Procs_Static.og p_Procs_Static.op: p_Procs_Static.inc
276p_Procs_Static.inc: p_Procs_Static.h
277p_Procs_Dynamic.o p_Procs_Lib.o p_Procs_Dynamic.og p_Procs_Lib.og\
278  p_Procs_Dynamic.op p_Procs_Lib.op: p_Procs_Dynamic.inc
279p_Procs_Dynamic.inc p_Procs_Lib.inc: p_Procs_Dynamic.h
280
281# here is how p_Procs_[Static|Dynamic].inc is generated
282p_Procs_%.inc: p_Procs_Generate.cc p_Procs_Impl.h mod2.h
283        $(CXX) -g -Dp_Procs_$* p_Procs_Generate.cc -o p_Procs_$*
284        ./p_Procs_$* > p_Procs_$*.inc
285        -rm -f p_Procs_$* p_Procs_$*.exe
286
287p_Procs_%.so: p_Procs_Lib_%.dl_o
288        $(LD) ${SLDFLAGS} -o $@ $^
289
290##
291## install targets
292##
293install-nolns: install
294
295install-libsingular:
296        ${MKINSTALLDIRS} ${includedir}/singular
297        -for file in *.h; do \
298        ${INSTALL_PROGRAM} $$file ${includedir}/singular; \
299        done
300
301install: all installbin
302
303installbin: ${DL_LIBS} ${DL_LIBSG} ${DL_LIBSP}
304        ${MKINSTALLDIRS} ${bindir}
305        - ranlib libkernel.a
306        - ranlib libkernel_g.a
307        - ranlib libkernel_p.a
308ifeq (,${DL_LIBS})
309else
310
311ifeq (,${DL_LIBSG})
312else
313        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
314        -${INSTALL_PROGRAM} ${DL_LIBS} ../Singular
315        -${INSTALL_PROGRAM} ${DL_LIBSG} ../Singular
316        -${INSTALL_PROGRAM} ${DL_LIBSP} ../Singular
317endif
318endif
319
320
321install-bindist: ${DL_LIBS} libkernel.a
322        ${MKINSTALLDIRS} ${bindir}
323ifeq (,${DL_LIBS})
324else
325        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
326endif
327
328##
329## clean targest
330##
331mostlyclean:
332        -rm -f p_Procs_*.inc
333        -rm -f *.o *.og core *.op p_Procs *.dl_o* *.so*
334
335clean: mostlyclean
336        -rm -f *.bak *.d *.dd depend
337
338distclean: clean
339        -rm -f *~ .\#* kversion.h
340        -rm -f mod2.h Makefile TAGS* tags config.status config.cache config.log
341
342srcclean:
343        @echo "This command is intended for maintainers to use;"
344        @echo "Rebuilding the deleted files requires flex"
345        @echo "bison, perl"
346
347maintainer-clean: distclean srcclean
348        @echo "This command is intended for maintainers to use;"
349        @echo "Rebuilding the deleted files requires flex"
350        @echo "bison, perl and autoconf"
351        -rm configure
352
353##
354## miscellanous targets
355##
356
357TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
358        etags ${SOURCES} ${ESOURCES} ${HEADERS}
359
360tags:   
361        ctags *.c *.h *.cc *.inc
362
363echoLIBS:
364        @echo ${SLIBS}
365
366##
367## Below here is stuff for developpers
368#################################################################
369
370
371##
372## .og files for having -O and -g object versions available at the same time
373##
374
375OBJG1 := $(CXXSOURCES:.cc=.og)
376OBJG2 := $(CSOURCES:.c=.og)
377
378OBJG=$(OBJG1) $(OBJG2)
379
380ifeq ($(DL_KERNEL),1)
381OBJG    := $(OBJG) $(DL_KERNEL_SOURCES:.cc=.og)
382else
383OBJG := $(OBJG) $(STATIC_SOURCES:.cc=.og)
384endif
385
386##
387## compiler and linker options for debug version
388##
389
390CCG             = ${CC}
391CXXG            = ${CXX}
392CXXM            = gcc -MM -MG -DGENERATE_DEPEND
393CCM             = gcc -MM -MG -DGENERATE_DEPEND
394
395CFLAGSG         = -g ${PIPE}
396CXXFLAGSG       = -g ${PIPE}
397DEFSG           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILG)
398
399##
400## Debug Targets
401##
402
403p_Procs_%.sog: p_Procs_Lib_%.dl_og
404        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} $< -o $@
405
406p_Procs_Lib_%.dl_og : p_Procs_Lib.cc  p_Procs_Dynamic.og
407        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
408
409%.dl_og: %.cc
410        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -c $< -o $@
411
412%.og: %.cc
413        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} -c $< -o $@
414
415$(OBJG2) : %.og: %.c
416        $(CCG)  ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
417
418libkernel_g.a: ${OBJG} ${DL_LIBSG} ${OBJSG2}
419        -rm -f libkernel_g.a
420        ar cr $@ ${OBJG}
421
422##
423## .op files for profiling
424##
425
426OBJP1 := $(CXXSOURCES:.cc=.op)
427OBJP2 := $(CSOURCES:.c=.op)
428
429OBJP=$(OBJP1) $(OBJP2)
430
431ifeq ($(DL_KERNEL),1)
432OBJP    := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
433else
434OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op)
435endif
436
437##
438## compiler and linker options for profiling version
439##
440
441CCP             = ${CC}
442CXXP            = ${CXX}
443
444CFLAGSP         = -g -pg -O ${PIPE}
445CXXFLAGSP       = -g -pg -O ${PIPE}
446DEFSP           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILP)
447
448##
449## Profiling Targets
450##
451
452p_Procs_%.sop: p_Procs_Lib_%.dl_op
453        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} $< -o $@
454
455p_Procs_Lib_%.dl_op : p_Procs_Lib.cc  p_Procs_Dynamic.op
456        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
457
458%.dl_op: %.cc
459        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -c $< -o $@
460
461%.op: %.cc
462        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} -c $< -o $@
463
464$(OBJP2) : %.op: %.c
465        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
466
467libkernel_p.a: ${OBJP} ${DL_LIBSP} ${OBJSP2}
468        -rm -f libkernel_p.a
469        ar cr $@ ${OBJP}
470
471##
472## dependencies
473##
474
475%.dd: %.cc mod2.h
476        echo $(@:.dd=.og) $(@:.dd=.op) $(@:.dd=.dl_o) $(@:.dd=.dl_og) $(@:.dd=.dl_op)" " \\ > $@
477        $(CXXM) -DGENTABLE ${CPPFLAGS} ${DEFSG} $< >> $@
478
479%.d: %.c mod2.h
480        echo $(@:.d=.og) $(@:.d=.op) " " \\ > $@
481        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
482
483depend:   $(CXXSOURCES:.cc=.dd) $(ESOURCES:.cc=.dd) $(CSOURCES:.c=.d) mod2.h
484        cat *.d *.dd >depend
485
486ifeq (depend,$(wildcard depend))
487include depend
488endif
489
490
Note: See TracBrowser for help on using the repository browser.