source: git/kernel/Makefile.in @ 9a310a

fieker-DuValspielwiese
Last change on this file since 9a310a was 9a310a, checked in by Hans Schoenemann <hannes@…>, 14 years ago
omSingularConfig.h removed git-svn-id: file:///usr/local/Singular/svn/trunk@12758 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 11.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 \
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 idrec.h stairc.h ideals.h \
153        longalg.h structs.h intvec.h int64vec.h longrat.h \
154        numbers.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 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 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        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## Build Targets
203##
204.cc.o: 
205        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} -c $<
206.c.o:
207        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $<
208
209# building objects for shared libraries
210p_Procs_Lib_%.dl_o : p_Procs_Lib.cc p_Procs_Dynamic.o
211        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
212
213%.dl_o : %.cc
214        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -c $< -o $@
215
216DL_TAILG=\"sog\"
217DL_TAILP=\"sop\"
218
219
220OBJG= $(CXXSOURCES:.cc=.og) $(CSOURCES:.c=.og)
221
222ifeq ($(DL_KERNEL),1)
223OBJG    := $(OBJG) $(DL_KERNEL_SOURCES:.cc=.og)
224OBJP    := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
225DL_LIBSG := $(P_PROCS_MODULES:%=p_Procs_%.sog)
226DL_LIBSP := $(P_PROCS_MODULES:%=p_Procs_%.sop)
227else
228OBJG := $(OBJG) $(STATIC_SOURCES:.cc=.og)
229OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op)
230DL_LIBSG=
231DL_LIBSP=
232endif
233
234all:    kversion.h libkernel.a libkernel_g.a mmalloc.o ${DL_LIBS} ${DL_LIBSG} ${OBJS2}
235
236libkernel.a: ${OBJS}
237        -rm -f libkernel.a
238        ar cr $@ $^
239
240p_Procs_Lib.o: p_Procs_Lib.inc
241
242kversion.h: ${SOURCES} ${HEADERS} Makefile.in mod2.h.in
243        echo "#define feVersionId0 "  `date '+%Y%m%d%H'` >kversion.h
244
245# Hmm compiling with -fomit-frame-pointer resulted in access violation
246# under cygwin
247prCopy.o: prCopy.inc
248
249prCopy.inc : prCopyMacros.h prCopyTemplate.cc prCopy.pl
250        $(PERL) prCopy.pl > prCopy.inc
251
252# additional dependencies for p_Procs_[Static|Dynamic|Lib].cc
253p_Procs_Static.o p_Procs_Static.og p_Procs_Static.op: p_Procs_Static.inc
254p_Procs_Static.inc: p_Procs_Static.h
255p_Procs_Dynamic.o p_Procs_Lib.o p_Procs_Dynamic.og p_Procs_Lib.og\
256  p_Procs_Dynamic.op p_Procs_Lib.op: p_Procs_Dynamic.inc
257p_Procs_Dynamic.inc p_Procs_Lib.inc: p_Procs_Dynamic.h
258
259# here is how p_Procs_[Static|Dynamic].inc is generated
260p_Procs_%.inc: p_Procs_Generate.cc p_Procs_Impl.h mod2.h
261        $(CXX) -g -Dp_Procs_$* p_Procs_Generate.cc -o p_Procs_$*
262        ./p_Procs_$* > p_Procs_$*.inc
263        -rm -f p_Procs_$* p_Procs_$*.exe
264
265p_Procs_%.so: p_Procs_Lib_%.dl_o
266        $(LD) ${SLDFLAGS} -o $@ $^
267
268##
269## install targets
270##
271install-nolns: install
272
273install-libsingular:
274        ${INSTALL_PROGRAM} kInline.cc ${includedir}/singular
275        -for file in *.h; do ${INSTALL_PROGRAM} $$file ${includedir}/singular; done
276
277install: all installbin
278
279install_all: install libkernel_p.a ${DL_LIBSP}
280        - ranlib libkernel_p.a
281ifeq (,${DL_LIBS})
282else
283ifeq (,${DL_LIBSP})
284else
285        -for file in ${DL_LIBSP}; do ${INSTALL_PROGRAM} $$file ../Singular; done
286endif
287endif
288
289
290installbin: ${DL_LIBS} ${DL_LIBSG}
291        ${MKINSTALLDIRS} ${bindir}
292        - ranlib libkernel.a
293        - ranlib libkernel_g.a
294ifeq (,${DL_LIBS})
295else
296        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
297ifeq (,${DL_LIBSG})
298else
299        -for file in ${DL_LIBS} ${DL_LIBSG}; do ${INSTALL_PROGRAM} $$file ../Singular; done
300endif
301endif
302
303
304install-bindist: ${DL_LIBS} libkernel.a
305        ${MKINSTALLDIRS} ${bindir}
306ifeq (,${DL_LIBS})
307else
308        -${INSTALL_PROGRAM} ${DL_LIBS} ${bindir}
309endif
310
311##
312## clean targest
313##
314mostlyclean:
315        -rm -f p_Procs_*.inc
316        -rm -f *.o *.og core *.op p_Procs *.dl_o*
317
318clean: mostlyclean
319        -rm -f *.bak *.d *.dd depend *.a *.so*
320
321distclean: clean
322        -rm -f *~ .\#* kversion.h
323        -rm -f mod2.h Makefile TAGS* tags config.status config.cache config.log
324
325srcclean:
326        @echo "This command is intended for maintainers to use;"
327        @echo "Rebuilding the deleted files requires flex"
328        @echo "bison, perl"
329
330maintainer-clean: distclean srcclean
331        @echo "This command is intended for maintainers to use;"
332        @echo "Rebuilding the deleted files requires flex"
333        @echo "bison, perl and autoconf"
334
335##
336## miscellanous targets
337##
338
339TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
340        etags ${SOURCES} ${ESOURCES} ${HEADERS}
341
342tags:   
343        ctags *.c *.h *.cc *.inc
344
345##
346## Below here is stuff for developpers
347#################################################################
348
349
350##
351## .og files for having -O and -g object versions available at the same time
352##
353
354OBJG1 := $(CXXSOURCES:.cc=.og)
355OBJG2 := $(CSOURCES:.c=.og)
356
357##
358## compiler and linker options for debug version
359##
360
361CCG             = ${CC}
362CXXG            = ${CXX}
363CXXM            = gcc -MM -MG -DGENERATE_DEPEND
364CCM             = gcc -MM -MG -DGENERATE_DEPEND
365
366CFLAGSG         = -g ${PIPE}
367CXXFLAGSG       = -g ${PIPE}
368DEFSG           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILG)
369
370##
371## Debug Targets
372##
373
374p_Procs_%.sog: p_Procs_Lib_%.dl_og
375        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} $< -o $@
376
377p_Procs_Lib_%.dl_og : p_Procs_Lib.cc  p_Procs_Dynamic.og
378        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
379
380%.dl_og: %.cc
381        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -c $< -o $@
382
383%.og: %.cc
384        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} -c $< -o $@
385
386$(OBJG2) : %.og: %.c
387        $(CCG)  ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
388
389libkernel_g.a: ${OBJG} ${DL_LIBSG} ${OBJSG2}
390        -rm -f libkernel_g.a
391        ar cr $@ ${OBJG}
392
393##
394## .op files for profiling
395##
396
397OBJP1 := $(CXXSOURCES:.cc=.op)
398OBJP2 := $(CSOURCES:.c=.op)
399
400OBJP=$(OBJP1) $(OBJP2)
401
402ifeq ($(DL_KERNEL),1)
403OBJP    := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
404else
405OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op)
406endif
407
408##
409## compiler and linker options for profiling version
410##
411
412CCP             = ${CC}
413CXXP            = ${CXX}
414
415CFLAGSP         = -g -pg -O ${PIPE}
416CXXFLAGSP       = -g -pg -O ${PIPE}
417DEFSP           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILP)
418
419##
420## Profiling Targets
421##
422
423p_Procs_%.sop: p_Procs_Lib_%.dl_op
424        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} $< -o $@
425
426p_Procs_Lib_%.dl_op : p_Procs_Lib.cc  p_Procs_Dynamic.op
427        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
428
429%.dl_op: %.cc
430        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -c $< -o $@
431
432%.op: %.cc
433        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSP} -c $< -o $@
434
435$(OBJP2) : %.op: %.c
436        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
437
438libkernel_p.a: ${OBJP} ${DL_LIBSP} ${OBJSP2}
439        -rm -f libkernel_p.a
440        ar cr $@ ${OBJP}
441
442##
443## dependencies
444##
445
446%.dd: %.cc mod2.h
447        echo $(@:.dd=.og) $(@:.dd=.op) $(@:.dd=.dl_o) $(@:.dd=.dl_og) $(@:.dd=.dl_op)" " \\ > $@
448        $(CXXM) -DGENTABLE ${CPPFLAGS} ${DEFSG} $< >> $@
449
450%.d: %.c mod2.h
451        echo $(@:.d=.og) $(@:.d=.op) " " \\ > $@
452        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
453
454depend:   $(CXXSOURCES:.cc=.dd) $(ESOURCES:.cc=.dd) $(CSOURCES:.c=.d) mod2.h
455        cat *.d *.dd >depend
456
457ifeq (depend,$(wildcard depend))
458include depend
459endif
460
461
Note: See TracBrowser for help on using the repository browser.