source: git/Singular/Makefile.in @ a35d14f

spielwiese
Last change on this file since a35d14f was a35d14f, checked in by Frank Seelisch <seelisch@…>, 13 years ago
comment lines for fans & cones on how to change Makefile git-svn-id: file:///usr/local/Singular/svn/trunk@13667 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 22.7 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@
15EXEC_EXT                = @EXEC_EXT@
16HAVE_PLURAL             = @PLURAL@
17##
18## various paths
19##
20top_srcdir      = @top_srcdir@
21srcdir          = @srcdir@
22prefix          = @prefix@
23exec_prefix     = @exec_prefix@
24libdir          = @libdir@
25# program executable goes here
26bindir          = @bindir@
27# includes are taken from here
28includedir      = @includedir@
29slibdir         = ${prefix}/LIB
30install_bindir  = ${install_prefix}/${SINGUNAME}
31install_slibdir = ${install_prefix}/LIB
32
33##
34## various programs
35##
36@SET_MAKE@
37CC              = @CC@
38LD              = @LD@
39CXX             = @CXX@
40LEX             = sh flexer.sh
41
42PERL            = @PERL@
43BISON           = bison
44INSTALL         = @INSTALL@
45INSTALL_PROGRAM = @INSTALL_PROGRAM@
46INSTALL_DATA    = @INSTALL_DATA@
47MKINSTALLDIRS   = ./mkinstalldirs
48LN_S            = @LN_S@
49
50##
51## compiler and linker options
52##
53PIPE            = @PIPE@
54CFLAGS          = @CFLAGS@ ${PIPE}
55CXXFLAGS        = @CXXFLAGS@ -I.. -I@prefix@ ${PIPE}
56CXXTEMPLFLAGS   = @CXXTEMPLFLAGS@ -I.. -I@prefix@
57ifneq ($(SINGUNAME),ix86-Win)
58CPPFLAGS        = -I${srcdir} -I.. -I@prefix@ @CPPFLAGS@
59else
60## Dirs after @CPPFLAGS@ are for PySingular
61CPPFLAGS        = -I${srcdir} -I.. -I@prefix@ @CPPFLAGS@
62## -I/usr/include/python2.4 -I/usr/local/include -I../modules/python
63endif
64DEFS            = -DNDEBUG -DOM_NDEBUG -D@SING_UNAME@ @DEFS@
65LDFLAGS2        = @LDFLAGS@
66ifneq ($(SINGUNAME),ix86-Win)
67LDFLAGS         = -L@prefix@/kernel -L../kernel -lkernel @LDFLAGS@
68LDFLAGSG        = -L@prefix@/kernel -L../kernel -lkernel_g @LDFLAGS@
69LDFLAGSP        = -L@prefix@/kernel -L../kernel -lkernel_p @LDFLAGS@
70else
71## -L/usr/local/lib -L@prefix@/modules/python --> PySingular
72LDFLAGS         = -L@prefix@/kernel -L/bin -lkernel @LDFLAGS@ -L/usr/local/lib -L../modules/python
73LDFLAGSG        = -L@prefix@/kernel -L/bin -lkernel_g @LDFLAGS@
74LDFLAGSP        = -L@prefix@/kernel -L/bin -lkernel_p @LDFLAGS@
75endif
76LD_DYN_FLAGS    = @LD_DYN_FLAGS@
77SFLAGS          = @SFLAGS@
78SLDFLAGS        = @SLDFLAGS@
79
80## For PYSingular
81ifneq ($(SINGUNAME),ix86-Win)
82WIN_LIBS        =
83else
84WIN_LIBS        =
85##../modules/python/libpython_module.a
86endif
87
88LD_LIBC         = -lc
89STATIC_LDFLAGS  = @STATIC_LDFLAGS@
90# under cygwin, do not explicitly link against -lm, for it is the cygwin
91# lib -- if you really want to do this, use -lm as the _last_ thing on the
92# arguments to link
93ifneq ($(SINGUNAME),ix86-Win)
94## for cones & fans if not under Win OS:
95## put "-lgfan -lcddgmp " behind "-lncurses" in next three lines
96LIBS            = -lm @NEED_LIBS@
97LIBSG           = -lm @NEED_LIBSG@
98LIBSP           = -lm @NEED_LIBSG@
99else
100## for cones & fans if under Win OS:
101## put "-lgfan -lcddgmp " before "-Xlinker" in definition of LIBS and LIBSG
102LIBS            = -lsingfac -lsingcf -lntl  -static -lreadline -lhtmlhelp -Xlinker -Bdynamic -lgmp -lomalloc_ndebug -lncurses
103## -lpython_module -lpython2.4 /usr/local/lib/libboost_python-gcc-d-1_32.dll
104LIBSG           = -lsingfac -lsingcf -lntl  -static -lreadline -lhtmlhelp -Xlinker -Bdynamic -lgmp -lncurses
105## with cdd and gfan: LIBSG             = -lsingfac -lsingcf -lntl  -static -lreadline -lhtmlhelp -lgfan -lcddgmp -Xlinker -Bdynamic -lgmp -lncurses
106endif
107MP_LIBS         = @MP_LIBS@
108HAVE_MPSR       = @HAVE_MPSR@
109
110#
111# Handle libSINGULAR stuff
112#
113LIBSINGULAR_LIBS =-lsingfac -lsingcf -lntl -lreadline -lgmp -lomalloc
114
115SO_SUFFIX = so
116#LIBSINGULAR_FLAGS = -export-dynamic
117LIBSINGULAR_LD = $(CXX)
118
119# correct suffix for dynamic linking
120ifeq ($(SINGUNAME),ix86Mac-darwin)
121SO_SUFFIX        = dylib
122LIBSINGULAR_FLAGS = -single_module
123LIBSINGULAR_LD = $(LD)
124endif
125
126ifeq ($(SINGUNAME),ppcMac-darwin)
127MACOSX_DEPLOYMENT_TARGET=10.4
128SO_SUFFIX        = dylib
129LIBSINGULAR_FLAGS = -single_module
130LIBSINGULAR_LD = $(LD)
131endif
132
133ifeq ($(SINGUNAME),ix86-Win)
134SO_SUFFIX = dll
135LIBSINGULAR_FLAGS = -shared
136LIBSINGULAR_LIBS = -lsingfac -lsingcf -lntl -lreadline -lgmp -lomalloc  -lhtmlhelp
137endif
138
139ifeq ($(SINGUNAME),ix86-SunOS)
140SO_SUFFIX  = so
141LIBSINGULAR_FLAGS = -shared
142LIBSINGULAR_LIBS = -lsingfac -lsingcf -lntl -lreadline -lgmp -lomalloc
143endif
144
145#
146# End libSINGULAR
147#
148
149ifdef LD_STATIC
150LDFLAGS  := ${STATIC_LDFLAGS} ${LDFLAGS}
151SING_EXEC = Singular-static
152LIBS := ${MP_LIBS} ${LIBS}
153LIBSG := ${MP_LIBS} ${LIBSG}
154DL_KERNEL =
155GLIBC_DYN_FIX=
156else
157LDFLAGS  := ${LD_DYN_FLAGS} ${LDFLAGS}
158SING_EXEC = Singular
159DL_KERNEL       = @DL_KERNEL@
160GLIBC_DYN_FIX= @GLIBC_DYN_FIX@
161endif
162
163# CXXFLAGS =  -g -Wall -Wno-unused
164# CFLAGS =  -g -Wall -Wno-unused
165##
166## End configuration dependend stuff
167#################################################################
168
169###
170### file sets
171###
172
173# normal C++ source files
174CXXSOURCES=grammar.cc scanner.cc attrib.cc \
175    eigenval_ip.cc\
176    extra.cc fehelp.cc feOpt.cc \
177    ipassign.cc ipconv.cc ipid.cc iplib.cc \
178    ipprint.cc ipshell.cc \
179    lists.cc \
180    sdb.cc \
181    fglm.cc interpolation.cc\
182    silink.cc ssiLink.cc \
183    subexpr.cc \
184    janet.cc wrapper.cc\
185    libparse.cc sing_win.cc\
186    gms.cc pcv.cc maps_ip.cc\
187    walk.cc walk_ip.cc \
188    cntrlc.cc misc_ip.cc \
189    calcSVD.cc pipeLink.cc \
190    Minor.cc \
191    MinorProcessor.cc \
192    MinorInterface.cc
193
194# stuff for MP
195MPSR_SOURCES = mpsr_Put.cc mpsr_PutPoly.cc mpsr_GetPoly.cc mpsr_sl.cc\
196        mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \
197
198
199# stuff for dbm
200DBMSR_SOURCES =  ndbm.cc sing_dbm.cc
201
202# normal C source files
203CSOURCES=
204
205# C++ sources which are used if part of the kernel are dynamically linked
206DL_KERNEL_SOURCES=slInit_Dynamic.cc
207
208# C++ sources which are used for dynamic libraries if part of the kernel is
209# dynamically linked
210DL_LIB_SOURCES=
211
212# C++ sources which are used if no parts of the kernel are dynamically linked
213STATIC_SOURCES=slInit_Static.cc
214
215# C++ sources for which both, shared and static object files are needed
216COMMON_SOURCES = $(MPSR_SOURCES) $(DBMSR_SOURCES)
217
218# special C++ source files (need extra compiling and/or linking), for which
219# dependencies should be generated
220ESOURCES=iparith.cc $(COMMON_SOURCES) \
221        $(DL_KERNEL_SOURCES) $(DL_LIB_SOURCES) $(STATIC_SOURCES)
222
223SOURCES=${CSOURCES} ${CXXSOURCES} \
224        grammar.y scanner.l libparse.l \
225        utils.cc utils.h \
226        tesths.cc mpsr_Tok.cc claptmpl.cc
227
228HEADERS=lists.h attrib.h \
229        mpsr_Tok.h \
230        ipconv.h \
231        subexpr.h ipid.h \
232        cntrlc.h ipprint.h sdb.h \
233        ipshell.h tok.h \
234        silink.h ssiLink.h \
235        sing_dbm.h maps_ip.h interpolation.h \
236        mpsr.h mpsr_sl.h\
237        mpsr_Get.h janet.h\
238        mpsr_Put.h walk.h\
239        dbm_sl.h libparse.h pipeLink.h \
240        gms.h pcv.h eigenval_ip.h \
241        distrib.h walk.h \
242        static.h \
243        omSingularConfig.h
244
245DISTFILES=${SOURCES} ${HEADERS} ${ESOURCES} \
246        Makefile.in configure.in configure \
247        mod2.h.in grammar.h testgh install-sh mkinstalldirs \
248        check_aso.pl
249
250OBJS := $(CXXSOURCES:.cc=.o) $(CSOURCES:.c=.o)
251
252ifeq ($(SINGUNAME),ix86-Win)
253OBJS := $(OBJS) Singular_res.o
254endif
255
256P_PROCS_MODULES = FieldZp FieldIndep FieldQ FieldGeneral
257
258ifeq ($(DL_KERNEL),1)
259OBJS    := $(OBJS) $(DL_KERNEL_SOURCES:.cc=.o)
260DBMSR_SO= dbmsr.so
261DL_LIBS := $(DBMSR_SO)
262ifeq ($(HAVE_MPSR), 1)
263MPSR_SO =       mpsr.so
264DL_LIBS :=      $(DL_LIBS) $(MPSR_SO)
265endif
266else
267ifndef LD_STATIC
268ifeq ($(HAVE_MPSR), 1)
269LIBS := $(MP_LIBS) $(LIBS)
270LIBSG := $(MP_LIBS) $(LIBSG)
271endif
272endif
273OBJS := $(OBJS) $(STATIC_SOURCES:.cc=.o) $(COMMON_SOURCES:.cc=.o)
274OBJSG := $(OBJSG) $(STATIC_SOURCES:.cc=.og) $(COMMON_SOURCES:.cc=.og)
275DL_LIBS=
276endif
277
278
279#
280# Singular libraries which go into distribution
281# MAKE SURE THAT THIS IS UP_TO_DATE
282#
283include singular-libs
284
285ifdef HAVE_PLURAL
286SLIBS = COPYING ${SLIB0} ${SLIB1} ${PLIBS} all.lib help.cnf
287else
288SLIBS = COPYING ${SLIB0} ${SLIB1} all.lib help.cnf
289endif
290
291SLIBS_FILES = $(addprefix LIB/,${SLIBS})
292
293GFTABLES = $(wildcard LIB/gftables/[1-9]*)
294
295##
296## Build Targets
297##
298.l.cc:
299        @if test -r scanner.cc; then \
300                touch scanner.cc ;\
301        elif test "x${LEX}" = x; then \
302                echo Error: no lex given, could not rebuilt scanner.cc;\
303                exit 1; \
304        fi
305        ${LEX} -s -I -t $< > scanner.cc.lmp
306        cp scanner.cc.lmp scanner.cc
307
308.y.cc:
309        @if test -r grammar.cc; then \
310                touch grammar.cc ;\
311        else \
312        if test "x${BISON}" = x; then \
313                echo Error: no bison given, could not rebuilt grammar.cc;\
314                exit 1; \
315        fi;\
316        ${BISON} -d -t -o grammar.cc $<;\
317        chmod +x testgh;\
318        ./testgh;\
319        fi
320
321.cc.o: 
322        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} -c $<
323.c.o:
324        ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $<
325
326%.dl_o : %.cc
327        ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -c $< -o $@
328
329all:    $(SING_EXEC)
330
331Singular-static: version.h
332        sleep 1
333        echo "#define HAVE_STATIC" > static.h
334        (cd ../kernel;rm -f mod_raw.o;${MAKE} LD_STATIC=1 depend install-bindist;cd ../Singular)
335        ${MAKE} LD_STATIC=1 S_EXT="-static" depend Singular-static
336        echo "#undef HAVE_STATIC" > static.h
337
338Singular${S_EXT}: mod2.h Makefile version.h $(WIN_LIBS) scanner.cc  ${OBJS} \
339          iparith.o tesths.cc libparse.cc claptmpl.o mpsr_Tok.o $(DL_LIBS)
340        ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} \
341          -o Singular${S_EXT} \
342          tesths.cc iparith.o mpsr_Tok.o claptmpl.o\
343          ${OBJS} ${LDFLAGS} ${LIBS} ../kernel/mmalloc.o
344
345libsingular: mod2.h Makefile version.h $(WIN_LIBS) scanner.cc  ${OBJS} \
346         iparith.o libparse.cc claptmpl.o mpsr_Tok.o $(DL_LIBS)
347        $(LIBSINGULAR_LD) ${SLDFLAGS} ${LIBSINGULAR_FLAGS} -o libsingular.${SO_SUFFIX} \
348        iparith.o mpsr_Tok.o claptmpl.o \
349        ${OBJS} -lkernel -L../kernel -L../factory -L../libfac -L${libdir} ${LIBSINGULAR_LIBS}
350
351libsingular.a: mod2.h Makefile version.h $(WIN_LIBS) scanner.cc  ${OBJS} \
352         iparith.o libparse.cc claptmpl.o mpsr_Tok.o
353        mkdir libsingular.tmp
354        (cd  libsingular.tmp; \
355        ar x ../../kernel/libkernel.a; \
356        ar x ../../$(SINGUNAME)/lib/libsingfac.a; \
357        ar x ../../$(SINGUNAME)/lib/libsingcf.a; \
358        ar x ../../$(SINGUNAME)/lib/libntl.a; \
359        ar x ../../$(SINGUNAME)/lib/libomalloc_ndebug.a; \
360        cd ..)
361        ar cr libsingular.a \
362        iparith.o mpsr_Tok.o claptmpl.o \
363        ${OBJS} libsingular.tmp/*
364        rm -rf libsingular.tmp
365
366../modules/python/libpython_module.a:
367        cd ../modules/python; scons
368
369%.static: version.h
370        ${MAKE} DL_KERNEL=0 S_EXT=".static" $@
371
372iparith.o mpsr_Tok.o : iparith.inc mpsr_Tok.inc
373
374cntrlc.o cntrlc.og : feOptES.inc feOptTS.inc feOpt.inc version.h
375
376misc_ip.o emacs.o tesths.o: version.h
377
378claptmpl.o: claptmpl.cc mod2.h
379        ${CXX} ${CXXFLAGS}  ${CPPFLAGS} ${DEFS} -c $<
380
381iparith.inc: gentable.cc grammar.h tok.h table.h mod2.h
382         ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} gentable.cc \
383             -o gentable1
384        ./gentable1
385        /bin/rm -f gentable1 gentable1.exe
386
387mpsr_Tok.inc: gentable2.cc grammar.h tok.h table.h mod2.h
388        ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXTEMPLFLAGS} ${DEFS} gentable2.cc \
389             -o gentable2
390        ./gentable2
391        /bin/rm -f gentable2 gentable2.exe
392
393
394svnver:
395        svnversion >svnver
396
397version.h: ${SOURCES} ${HEADERS} Makefile.in mod2.h.in \
398           configure.in svnver
399        echo "#define feVersionId \""  `cat svnver` "\"" >version.h
400        echo "#define CC \"" ${CC} ${CFLAGS} ${DEFS}"\"" >>version.h
401        echo "#define CXX \"" ${CXX} ${CXXFLAGS} ${DEFS} "\"" >>version.h
402
403libparse: libparse_main.o utils.o
404        ${CXX}  ${CPPFLAGS} -DSTANDALONE_PARSER -o libparse libparse_main.o utils.o ../kernel/fegetopt.o ${LDFLAGS2} -lomalloc
405
406libparse_main.o: libparse.cc
407        ${CXX} ${CPPFLAGS} -c -o libparse_main.o libparse.cc  -DSTANDALONE_PARSER
408
409utils.o: utils.cc
410        ${CXX} ${CPPFLAGS} -c -o utils.o utils.cc  -DSTANDALONE_PARSER
411
412libparse.cc: libparse.l
413        @if test "x${LEX}" = x; then \
414                echo Error: no lex given, could not rebuilt libparse.cc;\
415                exit 1; \
416        fi
417        ${LEX} -I -Pyylp -t libparse.l >libparse.cc.lmp
418        cp libparse.cc.lmp libparse.cc
419
420# Hmm compiling with -fomit-frame-pointer resulted in access violation
421# under cygwin
422ESingular: mod2.h feOpt.cc version.h emacs.cc \
423           feOptES.inc
424        ${CXX} -O2 ${CPPFLAGS} ${DEFS} -DESINGULAR -DPROTO -o ESingular emacs.cc ../kernel/fegetopt.o \
425        ${LDFLAGS} ${LIBS} ../kernel/mmalloc.o
426
427TSingular: mod2.h feOpt.cc version.h emacs.cc \
428           feOptTS.inc
429        ${CXX} -O2 ${CPPFLAGS} ${DEFS} -DTSINGULAR -DPROTO -o TSingular emacs.cc ../kernel/fegetopt.o \
430        ${LDFLAGS} ${LIBS} ../kernel/mmalloc.o
431
432feOpt.o: feOpt.inc feOptES.inc feOptTS.inc
433extra.o: feOpt.inc
434
435feOpt.inc: feOpt.cc mod2.h
436        $(CXX) $(CXXFLAGS) -DGENERATE_OPTION_INDEX ${CPPFLAGS} feOpt.cc -o feOpt
437        ./feOpt
438        /bin/rm -f feOpt feOpt.exe
439
440feOptES.inc: feOpt.cc mod2.h
441        $(CXX) $(CXXFLAGS) -DGENERATE_OPTION_INDEX  -DESINGULAR -I../kernel feOpt.cc -o feOptES
442        ./feOptES
443        rm -f feOptES feOptES.exe
444
445feOptTS.inc: feOpt.cc mod2.h
446        $(CXX) $(CXXFLAGS) -DGENERATE_OPTION_INDEX  -DTSINGULAR -I../kernel feOpt.cc -o feOptTS
447        ./feOptTS
448        rm -f feOptTS feOptTS.exe
449
450mpsr.so: $(MPSR_SOURCES:.cc=.dl_o)
451        $(LD) ${SLDFLAGS} -o $@ $^ -L${libdir} ${MP_LIBS} ${GLIBC_DYN_FIX}
452
453dbmsr.so: $(DBMSR_SOURCES:.cc=.dl_o)
454        $(LD) ${SLDFLAGS} -o $@ $^ ${GLIBC_DYN_FIX}
455
456src: scanner.cc grammar.h grammar.cc libparse.cc
457
458mod2.h: stamp-h
459
460stamp-h : config.status mod2.h.in
461        CONFIG_FILES= CONFIG_HEADERS="mod2.h" ./config.status
462
463Makefile: Makefile.in config.status
464        CONFIG_FILES="Makefile" CONFIG_HEADERS= ./config.status
465
466config.status: configure
467        ./config.status --recheck
468
469configure: configure.in
470        @echo "WARNING: You need to rerun autoconf. I am proceeding, for now."
471        @touch configure
472#       autoconf
473
474ifeq ($(SINGUNAME),ix86-Win)
475##
476## windows only targets
477##
478
479## resources
480Singular.rc: Singular.rc.in config.status
481        CONFIG_FILES="Singular.rc" CONFIG_HEADERS= ./config.status
482
483ESingular_res.o: Singular.rc
484        windres -DESINGULAR -i Singular.rc -o ESingular_res.o
485
486TSingular_res.o: Singular.rc
487        windres -DTSINGULAR -i Singular.rc -o TSingular_res.o
488
489Singular_res.o: Singular.rc
490        windres -DSINGULAR -i Singular.rc -o Singular_res.o
491
492## run
493run.o: run.c run.h
494        gcc -c -I. -O2 run.c -o run.o
495
496runTSingular : run.o TSingular_res.o
497        gcc -mwindows run.o TSingular_res.o -o runTSingular.exe
498#       gcc -mwindows -e _mainCRTStartup run.o TSingular_res.o -o runTSingular.exe
499
500runESingular : run.o ESingular_res.o
501        gcc -mwindows run.o ESingular_res.o -o runESingular.exe
502#       gcc -mwindows -e _mainCRTStartup run.o ESingular_res.o -o runESingular.exe
503
504RUN_SINGULARS=runESingular runTSingular
505
506endif
507
508##
509## install targets
510##
511install: all installbin installslib
512
513install_all: install
514
515install-nolns: all installbin-nolns installslib-nolns
516
517installbin: ${SING_EXEC} libparse ESingular TSingular ${RUN_SINGULARS}
518        ${MKINSTALLDIRS} ${bindir}
519        ${INSTALL_PROGRAM} ${SING_EXEC} ${SINGULAR}
520        -for file in *.so; do \
521          ${INSTALL_PROGRAM} $$file ${bindir}; \
522        done
523        ${INSTALL_PROGRAM} libparse ${RUN_SINGULARS} ${bindir}
524        ${INSTALL_PROGRAM} ESingular TSingular ${bindir}
525        ${INSTALL_PROGRAM} surfex ${bindir}
526        chmod a+x ${SINGULAR}
527        rm -f ${bindir}/${SING_EXEC}${EXEC_EXT}
528        cd ${bindir}; ${LN_S} ${SINGULAR} Singular${EXEC_EXT};
529
530installbin-nolns: ${SING_EXEC} libparse ESingular TSingular ${RUN_SINGULARS}
531        ${MKINSTALLDIRS} ${bindir}
532        ${INSTALL_PROGRAM} ${SING_EXEC} ${SINGULAR}
533        -for file in *.so; do \
534          ${INSTALL_PROGRAM} $$file ${bindir}; \
535        done
536        ${INSTALL_PROGRAM} libparse ${RUN_SINGULARS} ${bindir}
537        ${INSTALL_PROGRAM} ESingular TSingular ${DL_LIBS} ${bindir}
538        chmod a+x ${SINGULAR}
539        rm -f ${bindir}/${SING_EXEC}${EXEC_EXT}
540        ${INSTALL_PROGRAM} ${SINGULAR} ${bindir}/Singular${EXEC_EXT};
541
542installslib: LIB
543        test -r ${slibdir} || ${LN_S} `pwd`/LIB ${slibdir}
544
545installslib-nolns: LIB
546        ${MKINSTALLDIRS} ${slibdir}
547        for file in `pwd`/LIB/*.lib; do \
548          ${INSTALL_DATA}  $$file ${slibdir}; \
549        done
550        ${MKINSTALLDIRS} ${slibdir}/gftables
551        ${INSTALL_DATA} `pwd`/LIB/gftables/* ${slibdir}/gftables/
552
553install-libsingular: libsingular
554        ${MKINSTALLDIRS} ${includedir}/singular
555        for file in *.$(SO_SUFFIX); do \
556          ${INSTALL_PROGRAM}  $$file ${libdir}; \
557        done
558        ${INSTALL_PROGRAM} libsingular.h ${includedir}
559        ${INSTALL_PROGRAM} subexpr.h ${includedir}/singular
560        ${INSTALL_PROGRAM} tok.h ${includedir}/singular
561        ${INSTALL_PROGRAM} grammar.h ${includedir}/singular
562        ${INSTALL_PROGRAM} ipid.h ${includedir}/singular
563        ${INSTALL_PROGRAM} ipshell.h ${includedir}/singular
564        ${INSTALL_PROGRAM} lists.h ${includedir}/singular
565        ${INSTALL_PROGRAM} attrib.h ${includedir}/singular
566
567uninstall: uninstallbin
568
569uninstallbin:
570        rm -f ${bindir}/Singular${EXEC_EXT}
571        rm -f ${SINGULAR}
572        -rmdir ${bindir}
573
574##
575## clean targest
576##
577mostlyclean:
578        -rm -f Singular Singular-static Singularg Singularp libparse feOpt*.inc
579        -rm -f *.o *.og core *.op *.so* *.dl_o*
580        -rm -f ESingular* TSingular*
581
582clean: mostlyclean
583        -rm -f *.bak *.d *.dd depend
584        -rm -f ${slibdir}
585
586distclean: clean
587        -rm -f iparith.inc mpsr_Tok.inc stamp.h
588        -rm -f Singular* *.gprof *.bprof *~ .\#* version.h
589        rm -f plural_cmd.inc
590        -rm -f mod2.h Makefile TAGS* tags config.status config.cache config.log
591
592srcclean:
593        @echo "This command is intended for maintainers to use;"
594        @echo "Rebuilding the deleted files requires flex"
595        @echo "bison, perl"
596        -rm -f scanner.cc grammar.h grammar.cc libparse.cc
597
598maintainer-clean: distclean srcclean
599        @echo "This command is intended for maintainers to use;"
600        @echo "Rebuilding the deleted files requires flex"
601        @echo "bison, perl and autoconf"
602        -rm configure
603
604##
605## miscellanous targets
606##
607fehelp.o fehelp.og fehelp.op: feOpt.inc
608
609LIB/all.lib:    LIB/all.lib.tmpl
610        ./make_alllib.sh LIB/all.lib.tmpl ${SLIB0} ${PLIBS}
611
612install-bindist: $(HEADERS) $(SOURCES) Makefile depend
613        echo "#define MAKE_DISTRIBUTION " > distrib.h
614        sleep 1
615        ${MAKE} ${SING_EXEC} ESingular TSingular libparse ${RUN_SINGULARS}
616        ${MKINSTALLDIRS} ${install_bindir}
617        ${INSTALL_PROGRAM} ${SING_EXEC} ${install_bindir}/Singular
618        -${INSTALL_PROGRAM} *.so ${install_bindir}
619        ${INSTALL_PROGRAM} -s  libparse ${RUN_SINGULARS} ESingular TSingular ${install_bindir}
620        ${INSTALL_PROGRAM} surfex ${install_bindir}
621        echo "#undef MAKE_DISTRIBUTION " > distrib.h
622
623install-sharedist: ${SLIBS_FILES} LIB/gftables
624        ${MKINSTALLDIRS} ${install_slibdir}
625        cp ${SLIBS_FILES} ${install_slibdir}
626        ${MKINSTALLDIRS} ${install_slibdir}/gftables
627        cp ${GFTABLES} ${install_slibdir}/gftables
628        ${MKINSTALLDIRS} ${install_slibdir}/surfex
629        cp LIB/surfex/surfex.jar ${install_slibdir}/surfex
630        chmod -R +rX ${install_slibdir}/*
631
632tar:
633        tar cf Singular-${SINGULAR_VERSION}-src.tar ${DISTFILES}
634        gzip -f Singular-${SINGULAR_VERSION}-src.tar
635
636backup: tar
637        mcopy -o Singular-${SINGULAR_VERSION}-src.tar.gz a:
638
639TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
640        etags ${SOURCES} ${ESOURCES} ${HEADERS} ../kernel/*.[ch] ../kernel/*.cc ../kernel/*.inc
641
642
643tags:   
644        ctags *.y *.[lch] *.cc *.inc ../kernel/*.[ch] ../kernel/*.cc ../kernel/*.inc
645
646echoLIBS:
647        @echo ${SLIBS}
648
649##
650## Below here is stuff for developpers
651#################################################################
652
653
654##
655## .og files for having -O and -g object versions available at the same time
656##
657
658OBJG1 := $(CXXSOURCES:.cc=.og)
659OBJG2 := $(CSOURCES:.c=.og)
660
661OBJG=$(OBJG1) $(OBJG2)
662
663DL_TAILG=\"sog\"
664
665
666ifeq ($(DL_KERNEL),1)
667
668OBJG := $(OBJG) $(DL_KERNEL_SOURCES:.cc=.og)
669DL_LIBSG := $(MPSR_SO:%.so=%.sog) $(DBMSR_SO:%.so=%.sog)
670
671else
672
673OBJG := $(OBJG) $(STATIC_SOURCES:.cc=.og) $(COMMON_SOURCES:.cc=.og)
674DL_LIBSG=
675
676endif
677
678
679##
680## compiler and linker options for debug version
681##
682
683CCG             = ${CC}
684CXXG            = ${CXX}
685CXXM            = gcc -MM -MG -DGENERATE_DEPEND
686CCM             = gcc -MM -MG -DGENERATE_DEPEND
687
688CFLAGSG         = -g -Wall -Wno-unused ${PIPE}
689CXXFLAGSG       = -g -Wall -Wno-unused ${PIPE}
690CXXTEMPLFLAGSG  = -fno-implicit-templates
691DEFSG           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILG)
692
693##
694## Debug Targets
695##
696
697%.dl_og: %.cc
698        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGSG} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -c $< -o $@
699
700mpsr.sog: $(MPSR_SOURCES:.cc=.dl_og)
701        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} ${LDFLAGS} -o $@ $^ ${MP_LIBS} ${GLIBC_DYN_FIX}
702
703dbmsr.sog: $(DBMSR_SOURCES:.cc=.dl_og)
704        ${CXXG} ${CXXFLAGSG} ${SFLAGS} ${SLDFLAGS} ${LDFLAGS} -o $@ $^ ${MP_LIBS}
705
706claptmpl.og: claptmpl.cc mod2.h
707        $(CXXG)  ${CXXFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
708
709%.og: %.cc
710        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
711
712$(OBJG2) : %.og: %.c
713        $(CCG)  ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@
714
715Singularg${S_EXT}: scanner.cc  $(OBJG)  $(DL_LIBSG)\
716           iparith.og mpsr_Tok.og claptmpl.og tesths.cc version.h
717        $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGSG} ${CPPFLAGS} ${DEFSG} -o Singularg${S_EXT} \
718        tesths.cc iparith.og mpsr_Tok.og claptmpl.og $(OBJG) ${LDFLAGSG} ${LIBSG} -lomalloc ../kernel/mmalloc.og \
719        ${LD_DYN_FLAGS} ${LD_LIBC}
720
721iparith.og: iparith.inc iparith.cc
722        $(CXXG)  ${CXXFLAGSG} ${CXXTEMPLFLAGSG} ${CPPFLAGS} ${DEFSG} -c iparith.cc -o iparith.og
723
724mpsr_Tok.og: iparith.inc mpsr_Tok.cc
725        $(CXXG) ${CXXFLAGSG} ${CPPFLAGS} ${CXXTEMPLFLAGSG} ${DEFSG} -c mpsr_Tok.cc -o mpsr_Tok.og
726
727installg: Singularg
728        ${MKINSTALLDIRS} ${bindir}
729        ${INSTALL_PROGRAM} Singularg ${bindir} 
730
731ESingularg: mod2.h feOpt.cc version.h emacs.cc \
732           feOptES.inc
733        ${CXXG} ${CXXFLAGSG} ${CPPFLAGS} -DESINGULAR -g ${DEFSG} -o ESingularg emacs.cc ../kernel/fegetopt.og ${LDFLAGS} ${LIBS} -lomalloc ../kernel/mmalloc.og
734
735##
736## .op files for having -O and -g pg object versions available at the same time
737##
738
739OBJP1 := $(CXXSOURCES:.cc=.op)
740OBJP2 := $(CSOURCES:.c=.op)
741
742OBJP=$(OBJP1) $(OBJP2)
743
744DL_TAILP=\"sop\"
745
746
747ifeq ($(DL_KERNEL),1)
748
749OBJP := $(OBJP) $(DL_KERNEL_SOURCES:.cc=.op)
750DL_LIBSP := $(MPSR_SO:%.so=%.sop) $(DBMSR_SO:%.so=%.sop)
751
752else
753
754OBJP := $(OBJP) $(STATIC_SOURCES:.cc=.op) $(COMMON_SOURCES:.cc=.op)
755DL_LIBSP=
756
757endif
758
759
760##
761## compiler and linker options for profiling version
762##
763
764CCP             = ${CC}
765CXXP            = ${CXX}
766
767CFLAGSP         = -g -pg -O -Wall -Wno-unused ${PIPE}
768CXXFLAGSP       = -g -pg -O -Wall -Wno-unused ${PIPE}
769CXXTEMPLFLAGSP  = -fno-implicit-templates
770DEFSP           = -D@SING_UNAME@ @DEFS@ -DDL_TAIL=$(DL_TAILP)
771
772##
773## Profiling Targets
774##
775
776%.dl_op: %.cc
777        ${CXXP} ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSP} ${SFLAGS} -c $< -o $@
778
779mpsr.sop: $(MPSR_SOURCES:.cc=.dl_op)
780        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} ${LDFLAGS} -o $@ $^ ${MP_LIBS} ${GLIBC_DYN_FIX}
781
782dbmsr.sop: $(DBMSR_SOURCES:.cc=.dl_op)
783        ${CXXP} ${CXXFLAGSP} ${SFLAGS} ${SLDFLAGS} ${LDFLAGS} -o $@ $^ ${MP_LIBS}
784
785claptmpl.op: claptmpl.cc mod2.h
786        $(CXXP)  ${CXXFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
787
788%.op: %.cc
789        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
790
791$(OBJP2) : %.op: %.c
792        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
793
794Singularp${S_EXT}: scanner.cc  $(OBJP)  $(DL_LIBSP)\
795           iparith.op mpsr_Tok.op claptmpl.op tesths.cc version.h
796        (cd ../kernel;make libkernel_p.a;make install;cd ../Singular)
797        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSP} -o Singularp${S_EXT} \
798        tesths.cc iparith.op mpsr_Tok.op claptmpl.op $(OBJP) ${LDFLAGSP} ${LIBSP} -lomalloc ../kernel/mmalloc.op \
799        ${LD_DYN_FLAGS} ${LD_LIBC}
800
801iparith.op: iparith.inc iparith.cc
802        $(CXXP)  ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSP} -c iparith.cc -o iparith.op
803
804mpsr_Tok.op: iparith.inc mpsr_Tok.cc
805        $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${CXXTEMPLFLAGSP} ${DEFSP} -c mpsr_Tok.cc -o mpsr_Tok.op
806
807installp: Singularp
808        ${MKINSTALLDIRS} ${bindir}
809        ${INSTALL_PROGRAM} Singularp ${bindir} 
810
811##
812## dependencies
813##
814
815%.dd: %.cc mod2.h
816        echo $(@:.dd=.og) $(@:.dd=.op) $(@:.dd=.dl_o) $(@:.dd=.dl_og)  $(@:.dd=.dl_op)" " \\ > $@
817        $(CXXM) ${CPPFLAGS} ${DEFSG} $< >> $@
818
819%.d: %.c mod2.h
820        echo $(@:.d=.og) $(@:.d=.op)" " \\ > $@
821        $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@
822
823depend:   $(CXXSOURCES:.cc=.dd) $(ESOURCES:.cc=.dd) $(CSOURCES:.c=.d) mod2.h claptmpl.dd
824        -cat *.dd >depend
825
826ifeq (depend,$(wildcard depend))
827include depend
828endif
829
830
Note: See TracBrowser for help on using the repository browser.