source: git/kernel/Makefile.in @ bc669c

fieker-DuValspielwiese
Last change on this file since bc669c was be6689f, checked in by Hans Schönemann <hannes@…>, 14 years ago
new target install_all to install ALL libs git-svn-id: file:///usr/local/Singular/svn/trunk@12477 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 \
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 options.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 \
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 mmalloc.o ${DL_LIBS} ${DL_LIBSG} ${OBJS2}
254
255libkernel.a: ${OBJS}
256        -rm -f libkernel.a
257        ar cr $@ $^
258
259p_Procs_Lib.o: p_Procs_Lib.inc
260
261kversion.h: ${SOURCES} ${HEADERS} Makefile.in mod2.h.in
262        echo "#define feVersionId0 "  `date '+%Y%m%d%H'` >kversion.h
263
264# Hmm compiling with -fomit-frame-pointer resulted in access violation
265# under cygwin
266prCopy.o: prCopy.inc
267
268prCopy.inc : prCopyMacros.h prCopyTemplate.cc prCopy.pl
269        $(PERL) prCopy.pl > prCopy.inc
270
271# additional dependencies for p_Procs_[Static|Dynamic|Lib].cc
272p_Procs_Static.o p_Procs_Static.og p_Procs_Static.op: p_Procs_Static.inc
273p_Procs_Static.inc: p_Procs_Static.h
274p_Procs_Dynamic.o p_Procs_Lib.o p_Procs_Dynamic.og p_Procs_Lib.og\
275  p_Procs_Dynamic.op p_Procs_Lib.op: p_Procs_Dynamic.inc
276p_Procs_Dynamic.inc p_Procs_Lib.inc: p_Procs_Dynamic.h
277
278# here is how p_Procs_[Static|Dynamic].inc is generated
279p_Procs_%.inc: p_Procs_Generate.cc p_Procs_Impl.h mod2.h
280        $(CXX) -g -Dp_Procs_$* p_Procs_Generate.cc -o p_Procs_$*
281        ./p_Procs_$* > p_Procs_$*.inc
282        -rm -f p_Procs_$* p_Procs_$*.exe
283
284p_Procs_%.so: p_Procs_Lib_%.dl_o
285        $(LD) ${SLDFLAGS} -o $@ $^
286
287##
288## install targets
289##
290install-nolns: install
291
292install-libsingular:
293        ${INSTALL_PROGRAM} kInline.cc ${includedir}/singular
294        -for file in *.h; do ${INSTALL_PROGRAM} $$file ${includedir}/singular; done
295
296install: all installbin
297
298install_all: install libkernel_p.a ${DL_LIBSP}
299        - ranlib libkernel_p.a
300ifeq (,${DL_LIBS})
301else
302ifeq (,${DL_LIBSG})
303else
304        -for file in ${DL_LIBSP}; do ${INSTALL_PROGRAM} $$file ../Singular; done
305endif
306endif
307
308
309installbin: ${DL_LIBS} ${DL_LIBSG}
310        ${MKINSTALLDIRS} ${bindir}
311        - ranlib libkernel.a
312        - ranlib libkernel_g.a
313ifeq (,${DL_LIBS})
314else
315        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
316ifeq (,${DL_LIBSG})
317else
318        -for file in ${DL_LIBS} ${DL_LIBSG}; do ${INSTALL_PROGRAM} $$file ../Singular; done
319endif
320endif
321
322
323install-bindist: ${DL_LIBS} libkernel.a
324        ${MKINSTALLDIRS} ${bindir}
325ifeq (,${DL_LIBS})
326else
327        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
328endif
329
330##
331## clean targest
332##
333mostlyclean:
334        -rm -f p_Procs_*.inc
335        -rm -f *.o *.og core *.op p_Procs *.dl_o*
336
337clean: mostlyclean
338        -rm -f *.bak *.d *.dd depend *.a *.so*
339
340distclean: clean
341        -rm -f *~ .\#* kversion.h
342        -rm -f mod2.h Makefile TAGS* tags config.status config.cache config.log
343
344srcclean:
345        @echo "This command is intended for maintainers to use;"
346        @echo "Rebuilding the deleted files requires flex"
347        @echo "bison, perl"
348
349maintainer-clean: distclean srcclean
350        @echo "This command is intended for maintainers to use;"
351        @echo "Rebuilding the deleted files requires flex"
352        @echo "bison, perl and autoconf"
353
354##
355## miscellanous targets
356##
357
358TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
359        etags ${SOURCES} ${ESOURCES} ${HEADERS}
360
361tags:   
362        ctags *.c *.h *.cc *.inc
363
364echoLIBS:
365        @echo ${SLIBS}
366
367##
368## Below here is stuff for developpers
369#################################################################
370
371
372##
373## .og files for having -O and -g object versions available at the same time
374##
375
376OBJG1 := $(CXXSOURCES:.cc=.og)
377OBJG2 := $(CSOURCES:.c=.og)
378
379##
380## compiler and linker options for debug version
381##
382
383CCG             = ${CC}
384CXXG            = ${CXX}
385CXXM            = gcc -MM -MG -DGENERATE_DEPEND
386CCM             = gcc -MM -MG -DGENERATE_DEPEND
387
388CFLAGSG         = -g ${PIPE}
389CXXFLAGSG       = -g ${PIPE}
390DEFSG           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILG)
391
392##
393## Debug Targets
394##
395
396p_Procs_%.sog: p_Procs_Lib_%.dl_og
397        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} $< -o $@
398
399p_Procs_Lib_%.dl_og : p_Procs_Lib.cc  p_Procs_Dynamic.og
400        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
401
402%.dl_og: %.cc
403        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -c $< -o $@
404
405%.og: %.cc
406        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} -c $< -o $@
407
408$(OBJG2) : %.og: %.c
409        $(CCG)  ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
410
411libkernel_g.a: ${OBJG} ${DL_LIBSG} ${OBJSG2}
412        -rm -f libkernel_g.a
413        ar cr $@ ${OBJG}
414
415##
416## .op files for profiling
417##
418
419OBJP1 := $(CXXSOURCES:.cc=.op)
420OBJP2 := $(CSOURCES:.c=.op)
421
422OBJP=$(OBJP1) $(OBJP2)
423
424ifeq ($(DL_KERNEL),1)
425OBJP    := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
426else
427OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op)
428endif
429
430##
431## compiler and linker options for profiling version
432##
433
434CCP             = ${CC}
435CXXP            = ${CXX}
436
437CFLAGSP         = -g -pg -O ${PIPE}
438CXXFLAGSP       = -g -pg -O ${PIPE}
439DEFSP           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILP)
440
441##
442## Profiling Targets
443##
444
445p_Procs_%.sop: p_Procs_Lib_%.dl_op
446        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} $< -o $@
447
448p_Procs_Lib_%.dl_op : p_Procs_Lib.cc  p_Procs_Dynamic.op
449        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
450
451%.dl_op: %.cc
452        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -c $< -o $@
453
454%.op: %.cc
455        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} -c $< -o $@
456
457$(OBJP2) : %.op: %.c
458        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
459
460libkernel_p.a: ${OBJP} ${DL_LIBSP} ${OBJSP2}
461        -rm -f libkernel_p.a
462        ar cr $@ ${OBJP}
463
464##
465## dependencies
466##
467
468%.dd: %.cc mod2.h
469        echo $(@:.dd=.og) $(@:.dd=.op) $(@:.dd=.dl_o) $(@:.dd=.dl_og) $(@:.dd=.dl_op)" " \\ > $@
470        $(CXXM) -DGENTABLE ${CPPFLAGS} ${DEFSG} $< >> $@
471
472%.d: %.c mod2.h
473        echo $(@:.d=.og) $(@:.d=.op) " " \\ > $@
474        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
475
476depend:   $(CXXSOURCES:.cc=.dd) $(ESOURCES:.cc=.dd) $(CSOURCES:.c=.d) mod2.h
477        cat *.d *.dd >depend
478
479ifeq (depend,$(wildcard depend))
480include depend
481endif
482
483
Note: See TracBrowser for help on using the repository browser.