source: git/factory/GNUmakefile.in @ 2711ab

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