source: git/factory/GNUmakefile.in @ 773c9e

spielwiese
Last change on this file since 773c9e was a99e31, checked in by Hans Schönemann <hannes@…>, 22 years ago
*hannes: NTL -inactive git-svn-id: file:///usr/local/Singular/svn/trunk@5981 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 16.2 KB
Line 
1# @configure_input@
2# $Id: GNUmakefile.in,v 1.42 2002-03-08 10:31:44 Singular Exp $
3
4#
5# GNUmakefile.in - used by `configure' to create `GNUmakefile', the
6#   top level makefile for Factory.
7#
8# In general, you should let `configure' guess the correct values
9# for the variables below.  But if something seriously goes wrong
10# in configuring, please inform the authors and feel free to
11# edit the marked section.
12#
13# See the `INSTALL' file for information on how to build Factory.
14#
15# Note: Use GNU `make' (`gmake') to make with this makefile.
16#
17
18############### START OF CONFIGURABLE SECTION ###############
19
20SHELL =         /bin/sh
21
22#
23# - versions.  Do not change version here !!!
24#
25version =       @factory_version@
26distname =      factory-$(version)
27
28#
29# - paths.
30#
31prefix =        @prefix@
32exec_prefix =   @exec_prefix@
33libdir =        @libdir@
34datadir =       @datadir@
35gftabledir =    @gftabledir@
36includedir =    @includedir@
37templatedir =   @templatedir@
38
39srcdir =        @srcdir@
40VPATH =         @srcdir@
41
42#
43# - the name of the game.
44#
45libfactory =    @libfactory@
46
47#
48# - programs.
49#
50CC =            @CC@
51CXX =           @CXX@
52# seems configure sometimes finds non-BSD install, so we better
53# hardcode path to our install-sh
54INSTALL =       $(srcdir)/bin/install-sh -c
55INSTALL_DATA =  @INSTALL_DATA@
56INSTALL_PROGRAM=@INSTALL_PROGRAM@
57RANLIB =        @RANLIB@
58
59LN_S =          @LN_S@
60AR =            @AR@
61BISON =         @BISON@
62MKINSTALLDIRS = @FACTORY_MKINSTALLDIRS@
63MAKEHEADER =    @FACTORY_MAKEHEADER@
64
65#
66# - flags.
67#
68CFLAGS =        @CFLAGS@
69CPPFLAGS =      @CPPFLAGS@
70CXXFLAGS =      @CXXFLAGS@
71DEFS =          @DEFS@
72LDFLAGS =       @LDFLAGS@
73LIBS =          @LIBS@
74
75ARFLAGS =       @ARFLAGS@
76MAKEHEADERFLAGS=@MAKEHEADERFLAGS@
77
78#
79# - some other variables.
80#
81factorysrc =    @factorysrc@
82factoryincl =   @factoryincl@
83memmansrc =     @memmansrc@
84memmanincl =    @memmanincl@
85
86alltargets =    @alltargets@
87installtargets =@installtargets@
88uninstalltargets=@uninstalltargets@
89
90############### END OF CONFIGURABLE SECTION ###############
91
92#
93# - compiler flags.
94#
95WARNFLAGS =     -w
96
97# flags to translate library c files
98LIBCFLAGS =     $(WARNFLAGS) \
99                -I$(includedir) -I. -I$(srcdir) \
100                $(DEFS) $(CPPFLAGS) $(CFLAGS)
101
102# flags to translate library c++ files
103LIBCXXFLAGS =   $(WARNFLAGS) -fno-implicit-templates \
104                -I$(includedir) -I. -I$(srcdir) \
105                $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
106
107# flags to translate ftmpl_inst.cc
108TMPLCXXFLAGS =  $(LIBCXXFLAGS)
109
110# flags to link test programs
111TESTCXXFLAGS =  $(LIBCXXFLAGS)
112
113# flags to link test programs
114TESTLDFLAGS =   $(LIBS) $(LDFLAGS)
115
116# flags to create dependency lists
117DEPCXXFLAGS =   -I$(includedir) -I. -I$(srcdir) \
118                $(DEFS) $(CPPFLAGS)
119
120#
121# - source files.
122#
123
124# factory source files
125basefactorysrc := \
126                canonicalform.cc \
127                cf_algorithm.cc \
128                cf_binom.cc \
129                cf_char.cc \
130                cf_chinese.cc \
131                cf_eval.cc \
132                cf_factor.cc \
133                cf_factory.cc \
134                cf_gcd.cc \
135                cf_generator.cc \
136                cf_globals.cc \
137                cf_inline.cc \
138                cf_irred.cc \
139                cf_iter.cc \
140                cf_iter_inline.cc \
141                cf_linsys.cc \
142                cf_map.cc \
143                cf_ops.cc \
144                cf_primes.cc \
145                cf_random.cc \
146                cf_resultant.cc \
147                cf_reval.cc \
148                cf_switches.cc \
149                cf_util.cc \
150                debug.cc \
151                fac_berlekamp.cc \
152                fac_cantzass.cc \
153                fac_distrib.cc \
154                fac_ezgcd.cc \
155                fac_iterfor.cc \
156                fac_multihensel.cc \
157                fac_multivar.cc \
158                fac_sqrfree.cc \
159                fac_univar.cc \
160                fac_util.cc \
161                ffops.cc \
162                gf_tabutil.cc \
163                gfops.cc \
164                imm.cc \
165                initgmp.cc \
166                int_cf.cc \
167                int_int.cc \
168                int_intdiv.cc \
169                int_poly.cc \
170                int_pp.cc \
171                int_rat.cc \
172                sm_sparsemod.cc \
173                sm_util.cc \
174                variable.cc \
175                NTLconvert.cc
176
177singfactorysrc := \
178                singext.cc
179useiofactorysrc := \
180                parseutil.cc \
181                readcf.y
182distfactorysrc := \
183                $(basefactorysrc) \
184                $(singfactorysrc) \
185                $(useiofactorysrc)
186doxysrc :=      \
187                $(basefactorysrc) \
188                parseutil.cc
189
190# factory object files and dependencies
191factoryobj :=   $(factorysrc:.cc=.o)
192factoryobj :=   $(factoryobj:.y=.o)
193factorydep :=   $(factorysrc:.cc=.d)
194factorydep :=   $(factorydep:.y=.d)
195
196# factory header files
197basefactoryincl := \
198                assert.h \
199                canonicalform.h \
200                cf_algorithm.h \
201                cf_binom.h \
202                cf_defs.h \
203                cf_eval.h \
204                cf_factory.h \
205                cf_generator.h \
206                cf_globals.h \
207                cf_gmp.h \
208                cf_irred.h \
209                cf_iter.h \
210                cf_map.h \
211                cf_primes.h \
212                cf_primetab.h \
213                cf_random.h \
214                cf_reval.h \
215                cf_switches.h \
216                cf_util.h \
217                debug.h \
218                fac_berlekamp.h \
219                fac_cantzass.h \
220                fac_distrib.h \
221                fac_iterfor.h \
222                fac_multivar.h \
223                fac_sqrfree.h \
224                fac_univar.h \
225                fac_util.h \
226                ffops.h \
227                ftmpl_array.h \
228                ftmpl_factor.h \
229                ftmpl_functions.h \
230                ftmpl_list.h \
231                ftmpl_matrix.h \
232                gf_tabutil.h \
233                gfops.h \
234                gmpext.h \
235                imm.h \
236                int_cf.h \
237                int_int.h \
238                int_poly.h \
239                int_pp.h \
240                int_rat.h \
241                sm_sparsemod.h \
242                sm_util.h \
243                timing.h \
244                variable.h \
245                NTLconvert.h
246
247singfactoryincl := \
248                singext.h
249useiofactoryincl := \
250                parseutil.h
251distfactoryincl := \
252                $(basefactoryincl) \
253                $(singfactoryincl) \
254                $(useiofactoryincl)
255doxyincl :=     \
256                $(basefactoryincl) \
257                parseutil.h
258
259# memory manager source files
260basememmansrc := \
261                newdelete.cc
262newmemmansrc := \
263                mmalloc.c \
264                mmallocb.c \
265                mmallocs.c \
266                mmblock.c \
267                mmheap.c \
268                mminit.c \
269                mmspec.c \
270                mmutil.c
271oldmemmansrc := \
272                memutil.c
273distmemmansrc := \
274                $(basememmansrc) \
275                $(newmemmansrc) \
276                $(oldmemmansrc)
277
278# memory manager object files and dependencies
279memmanobj :=    $(memmansrc:.cc=.o)
280memmanobj :=    $(memmanobj:.c=.o)
281memmandep :=    $(memmansrc:.cc=.d)
282memmandep :=    $(memmandep:.c=.d)
283
284# memory manager header files
285newmemmanincl := \
286                mmprivate.h \
287                memman.h
288oldmemmanincl := \
289                memutil.h
290distmemmanincl := \
291                $(newmemmanincl) \
292                $(oldmemmanincl)
293
294# factory template files
295templatesrc :=  \
296                ftmpl_array.cc \
297                ftmpl_factor.cc \
298                ftmpl_functions.h \
299                ftmpl_list.cc \
300                ftmpl_matrix.cc
301templateincl := \
302                ftmpl_array.h \
303                ftmpl_factor.h \
304                ftmpl_list.h \
305                ftmpl_matrix.h
306
307# header templates
308hdrtemplsrc := \
309                factoryconf.template \
310                factory.template
311hdrtempldep :=  $(hdrtemplsrc:.template=.d)
312
313# FTE source files
314ftestsrc :=     \
315                ftest_io.cc \
316                ftest_util.cc \
317                ntl_util.cc
318
319# FTE header files
320ftestincl :=    \
321                ftest_io.h \
322                ftest_util.h \
323                ntl_util.h
324
325# FTE m4 source files (exported for `GNUmakefile' in `ftest/').
326# The variable `$(ftestm4develsrc)' may be already initialized
327# from the development `GNUmakefile'.
328ftestm4src :=   $(ftestm4develsrc) \
329                commonden.m4 \
330                degree.m4 \
331                deriv.m4 \
332                divides.m4 \
333                divrem.m4 \
334                extgcd.m4 \
335                factorize.m4 \
336                fbinops.m4 \
337                feval.m4 \
338                gcd.m4 \
339                gcd.ntl.m4 \
340                insert.m4 \
341                norm.m4 \
342                resultant.m4 \
343                revert.m4 \
344                sqrfree.m4 \
345                size.m4 \
346                totaldegree.m4
347export ftestm4src
348
349# other files from the FTE
350ftestdistfiles := \
351                ChangeLog \
352                GNUmakefile.in \
353                ftest_util.m4
354
355# FTE executables
356ftestexec :=    $(ftestm4src:.m4=)
357
358# all the C/C++ source files in the distribution
359distsrc :=      \
360                $(distfactorysrc) $(distmemmansrc) \
361                $(addprefix templates/,$(templatesrc)) \
362                $(addprefix ftest/,$(ftestsrc)) \
363                readcf.cc ftmpl_inst.cc \
364                gengftables.cc test_install.cc
365
366# all the C/C++ include files in the distribution
367distincl :=     \
368                $(distfactoryincl) $(distmemmanincl) \
369                $(addprefix templates/,$(templateincl)) \
370                $(addprefix ftest/,$(ftestincl))
371
372# all files for the Windows NT environment
373distntfiles :=  \
374                config.h nt.mak \
375                factory.h factoryconf.h \
376                INSTALL.nt
377
378# all files in the distribution
379distfiles :=    \
380                $(distsrc) $(distincl) $(hdrtemplsrc) \
381                $(addprefix ftest/,$(ftestm4src)) \
382                $(addprefix ftest/,$(ftestdistfiles)) \
383                GNUmakefile.in configure.in config.h.in configure \
384                ChangeLog README NEWS INSTALL \
385                factory.cfg \
386                $(addprefix winnt/,$(distntfiles)) \
387                examples/GNUmakefile examples/application.cc \
388                examples/factorize.cc examples/gcd.cc \
389                bin/folding.el bin/fold-docu.el \
390                bin/install-sh bin/mkinstalldirs \
391                bin/makeheader bin/makeheader.pl
392
393#
394# - phony targets.
395#
396.PHONY:         all cf mem dist depend \
397                clean mostlyclean distclean maintainer-clean \
398                install installcf installmem installgftables installtest \
399                uninstall uninstallcf uninstallmem uninstallgftables \
400                ftestall ftestclean ftestdistclean \
401                doxy doxyclean
402
403# we make these targets phony to make sure that they are
404# up to date when a new distribution is built
405.PHONY:         $(srcdir)/winnt/factory.h $(srcdir)/winnt/factoryconf.h
406
407#
408# - pattern rules.
409#
410
411# how to create library objets
412%.o: %.cc config.h
413        $(CXX) -c $< $(LIBCXXFLAGS) -o $@
414%.o: %.c config.h
415        $(CC) -c $< $(LIBCFLAGS) -o $@
416
417# how to create dependency files.  To avoid broken dependency files
418# (which in turn break this GNUmakefile) we first generate them in
419# a temporary file which we then move to the destination file.
420%.d: %.cc factoryconf.h config.h
421        echo $@ "\\" > $@tmp
422        $(CXX) -MM $< $(DEPCXXFLAGS) >> $@tmp
423        mv $@tmp $@
424%.d: %.c factoryconf.h config.h
425        echo $@ "\\" > $@tmp
426        $(CXX) -MM $< $(DEPCXXFLAGS) >> $@tmp
427        mv $@tmp $@
428%.d: %.template
429        echo $@ $(@:.d=.h) : "\\" > $@tmp
430        sed -n '/^\/\*MAKEHEADER/!d; n; s/^#include "//; s/"//; p;' $< | tr '\012' ' ' >> $@tmp
431        echo >> $@tmp
432        mv $@tmp $@
433
434# how to create header files from header templates
435%.h: %.template
436        $(MAKEHEADER) $(MAKEHEADERFLAGS) $< $@
437
438#
439# - building factory.
440#
441all:            $(alltargets)
442
443cf:             factoryconf.h factory.h $(libfactory)
444
445mem:            libcfmem.a
446
447#
448# - explicit targets.
449#
450$(libfactory):  $(factoryobj)
451                $(AR) $(ARFLAGS) $@ $^
452                $(RANLIB) $@
453
454libcfmem.a:     $(memmanobj)
455                $(AR) $(ARFLAGS) $@ $^
456                $(RANLIB) $@
457
458ftmpl_inst.o:   ftmpl_inst.cc factoryconf.h factory.h \
459                $(addprefix templates/,$(templatesrc)) \
460                $(addprefix templates/,$(templateincl))
461                $(CXX) -c $< $(TMPLCXXFLAGS) -o $@
462
463# note that this is a non-source file which is distributed!
464$(srcdir)/readcf.cc: readcf.y
465                $(BISON) $< -o $@
466
467# note that these are non-source file which are distributed!
468# We do not specify any dependencies except the most important ones.
469$(srcdir)/winnt/factory.h: factory.template
470                $(MAKEHEADER) $(MAKEHEADERFLAGS) $< $@
471$(srcdir)/winnt/factoryconf.h: factoryconf.template winnt/config.h
472                $(MAKEHEADER) -I$(srcdir)/winnt $(MAKEHEADERFLAGS) $< $@
473
474# specify dependency in case user does not 'make depend'
475factoryconf.h:  config.h
476
477TAGS:
478                etags $(addprefix $(srcdir)/, $(distsrc) $(distincl))
479
480# check configuration before building executables
481conftest:
482                @if test -z "$(filter mem,$(alltargets))" \
483                  || test -z "$(filter readcf.y,$(factorysrc))" \
484                  || test -n "$(filter singext.cc,$(factorysrc))"; then \
485                  echo "To make this target you have to configure"; \
486                  echo "\`--without-Singular --with-memman --enable-streamio'."; \
487                  exit 1; \
488                fi
489
490#
491# - doxygen.
492#
493
494# files and environment variables to export for doxygen
495doxyfiles :=    $(addprefix $(srcdir)/,$(doxysrc) $(doxyincl))
496
497export version srcdir doxyfiles
498
499# doxygen targets
500doxy:           factory.cfg $(doxysrc) $(doxyincl)
501                doxygen $<
502
503doxyclean:
504                rm -rf doxygen
505
506#
507# - Factory Test Environment.
508#
509$(ftestexec):   conftest factoryconf.h factory.h libcf.a libcfmem.a ftmpl_inst.o
510                cd ftest && $(MAKE) $@
511                @if test -r "$@"; then \
512                  :; \
513                else \
514                  echo "$(LN_S) ftest/$@ $@"; \
515                  $(LN_S) ftest/$@ $@; \
516                fi
517
518ftestall:       $(ftestexec)
519
520ftestclean:
521                -cd ftest && $(MAKE) clean
522
523ftestdistclean:
524                -cd ftest && $(MAKE) distclean
525                -rmdir ftest
526
527#
528# - GF(q) table generation.
529#
530
531# these are not all dependencies, but the most important ones
532gengftables.o:  gengftables.cc conftest factory.h gf_tabutil.h
533                $(CXX) -c $< $(TESTCXXFLAGS) -o $@
534
535gengftables:    gengftables.o libcf.a libcfmem.a ftmpl_inst.o
536                $(CXX) $^ $(TESTLDFLAGS) -o $@
537
538gftables:       gengftables
539                @echo "This command will take quite a long time to execute;"
540                @echo "maybe you want to get the tables directly via ftp (see"
541                @echo "the INSTALL file)."
542                $(MKINSTALLDIRS) gftables
543                ./gengftables
544
545#
546# - installation test program.
547#
548
549# compile installation test program.  do not look up
550# header files in current directory or in $(srcdir), but use
551# the header files from the directory where they should be
552# after installation.
553test_install.o: test_install.cc
554                $(CXX) -c $< $(TESTCXXFLAGS) -I- -I$(includedir) -o $@
555
556# the same we do for ftmpl_inst.o which for this reason is named
557# iftmpl_inst.o
558iftmpl_inst.o:
559                $(CXX) -c $(templatedir)/ftmpl_inst.cc $(TMPLCXXFLAGS) -I- -I$(includedir) -o $@
560
561# link installation test program
562test_install:   test_install.o iftmpl_inst.o
563                $(CXX) $^ -L$(libdir) -lcf -lcfmem $(TESTLDFLAGS) -o $@
564
565installtest:    test_install
566                @-if ./test_install; then \
567                  echo "Installation seems ok."; \
568                else \
569                  echo "Please check path of your GF(q) tables in config.h."; \
570                fi
571
572#
573# - install targets.
574#
575install:        $(installtargets)
576
577installcf:      cf
578                $(MKINSTALLDIRS) $(libdir)
579                $(MKINSTALLDIRS) $(includedir)
580                $(MKINSTALLDIRS) $(templatedir)
581                $(INSTALL_DATA) $(libfactory) $(libdir)/$(libfactory)
582                $(INSTALL_DATA) factory.h $(includedir)/factory.h
583                $(INSTALL_DATA) factoryconf.h $(includedir)/factoryconf.h
584                $(INSTALL_DATA) $(srcdir)/ftmpl_inst.cc $(templatedir)/ftmpl_inst.cc
585                for file in $(templatesrc) $(templateincl); do \
586                  $(INSTALL_DATA) $(srcdir)/templates/$$file $(templatedir)/$$file; \
587                done
588# we run `ranlib' another time for SUN machines
589                $(RANLIB) $(libdir)/$(libfactory)
590
591installmem:     mem
592                $(MKINSTALLDIRS) $(libdir)
593                $(INSTALL_DATA) libcfmem.a $(libdir)/libcfmem.a
594# once again: another run for SUN
595                $(RANLIB) $(libdir)/libcfmem.a
596
597# to a pity, this cannot be done automatically ...
598installgftables:
599                @echo "Copying GF(q) tables ..."
600                @if test -d gftables; then \
601                  $(MKINSTALLDIRS) $(gftabledir); \
602                  for file in gftables/gftable.*.*; do \
603                    $(INSTALL_DATA) $$file $(gftabledir); \
604                  done \
605                elif test -d "$(srcdir)"/gftables; then \
606                  $(MKINSTALLDIRS) $(gftabledir); \
607                  for file in "$(srcdir)"/gftables/gftable.*.*; do \
608                    $(INSTALL_DATA) $$file $(gftabledir); \
609                  done \
610                else \
611                  echo "Run 'make gftables' before installing them"; \
612                  exit 1; \
613                fi
614
615#
616# - uninstall targets.
617#
618uninstall:      $(uninstalltargets)
619
620uninstallcf:
621                -for file in $(templatesrc) $(templateincl); do \
622                  rm -f $(templatedir)/$$file; \
623                done
624                -rm -f $(templatedir)/ftmpl_inst.cc
625                -rm -f $(includedir)/factoryconf.h
626                -rm -f $(includedir)/factory.h
627                -rm -f $(libdir)/$(libfactory)
628                -rmdir $(templatedir)
629                -rmdir $(includedir)
630                -rmdir $(libdir)
631
632uninstallmem:
633                -rm -f $(libdir)/libcfmem.a
634                -rmdir $(libdir)
635
636uninstallgftables:
637                -rm -f $(gftabledir)/gftable.*.*
638                -rmdir $(gftabledir)
639
640#
641# - building a distribution.
642#
643dist:           $(srcdir)/readcf.cc $(srcdir)/configure \
644                $(srcdir)/winnt/factory.h $(srcdir)/winnt/factoryconf.h
645                rm -f $(distname).tgz
646                rm -rf $(distname)
647                $(MKINSTALLDIRS) $(distname)/bin
648                $(MKINSTALLDIRS) $(distname)/examples
649                $(MKINSTALLDIRS) $(distname)/ftest
650                $(MKINSTALLDIRS) $(distname)/winnt
651                $(MKINSTALLDIRS) $(distname)/templates
652                @echo "Copying files to distribution directory ..."
653                @for file in $(distfiles); do \
654                  ln $(srcdir)/$$file $(distname)/$$file; \
655                done
656                tar cf $(distname).tar $(distname)
657                gzip $(distname).tar
658                mv $(distname).tar.gz $(distname).tgz
659
660#
661# - cleaning up.
662#
663clean:          ftestclean
664                -rm -f $(libfactory) libcfmem.a \
665                  $(ftestexec) gengftables test_install \
666                  factoryconf.h factory.h *.o *.d *.dtmp
667
668# remove gftables only if we built them
669mostlyclean:    clean doxyclean
670                -rm -f TAGS
671                -if test ! -f gftables/README; then \
672                  rm -rf gftables; \
673                fi
674
675distclean:      ftestdistclean mostlyclean
676                -rm -f $(distname).tgz GNUmakefile stamp-h \
677                  config.cache config.log config.status config.h
678                -rm -rf $(distname)
679
680maintainer-clean: distclean
681                @echo "This command is intended for maintainers to use;"
682                @echo "it deletes files that require bison to rebuild."
683                -rm -f $(srcdir)/readcf.cc
684
685#
686# - dependencies.
687#
688# Do not generate them automatically if there are not any
689# dependencies at all.  this trick saves some time when you do
690# not want to compile but do some maintenance which do not
691# require the dependencies.  say 'make depend' to create the
692# dependencies explicitly.
693#
694depend:         $(factorydep) $(memmandep) $(hdrtempldep)
695
696ifneq ($(wildcard *.d),)
697  include $(factorydep) $(memmandep) $(hdrtempldep)
698endif
699
700#
701# - configure stuff.
702#
703$(srcdir)/configure: configure.in
704                -cd $(srcdir) && autoconf
705
706# seems gmake needs at least a trivial command.  otherwise all
707# files which depend on config.h will be remade even if congig.h
708# did not change.
709config.h:       stamp-h
710                @:
711
712stamp-h:        config.h.in config.status
713                CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
714                echo timestamp > stamp-h
715
716GNUmakefile:    GNUmakefile.in config.status
717                CONFIG_FILES=GNUmakefile CONFIG_HEADERS= ./config.status
718
719ftest/GNUmakefile: ftest/GNUmakefile.in config.status
720                CONFIG_FILES=ftest/GNUmakefile CONFIG_HEADERS= ./config.status
721
722config.status:  configure
723                ./config.status --recheck
Note: See TracBrowser for help on using the repository browser.