Ticket #11645: trac_11645-singular_spkg__patches__Singular-Makefile.in

File trac_11645-singular_spkg__patches__Singular-Makefile.in, 22.6 KB (added by leif, 10 years ago)

Replaces patches/Singular-Makefile.in in the Singular spkg. (Cumulatively patched src/Singular/Makefile.in.)

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