source: git/factory/GNUmakefile.in @ b809a8

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