source: git/Singular/Makefile.in @ b0d3903

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