source: git/kernel/Makefile.in @ a5b80a

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