source: git/kernel/Makefile.in @ c9208c6

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