source: git/factory/GNUmakefile.in @ 74221c

spielwiese
Last change on this file since 74221c was 74221c, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* GNUmakefile.in (distfiles, dist): `examples/' and `examples/*' added to distribution git-svn-id: file:///usr/local/Singular/svn/trunk@856 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 12.8 KB
Line 
1# @configure_input@
2# $Id: GNUmakefile.in,v 1.19 1997-10-28 14:43:10 schmidt 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
59AR =            @AR@
60BISON =         @BISON@
61MKINSTALLDIRS = @MKINSTALLDIRS@
62MAKEHEADER =    @MAKEHEADER@
63
64#
65# - flags.
66#
67CFLAGS =        @CFLAGS@
68CPPFLAGS =      @CPPFLAGS@
69CXXFLAGS =      @CXXFLAGS@
70DEFS =          @DEFS@
71LDFLAGS =       @LDFLAGS@
72LIBS =          @LIBS@
73
74ARFLAGS =       @ARFLAGS@
75MAKEHEADERFLAGS=@MAKEHEADERFLAGS@
76
77#
78# - some other variables.
79#
80factorysrc =    @factorysrc@
81factoryincl =   @factoryincl@
82memmansrc =     @memmansrc@
83memmanincl =    @memmanincl@
84
85alltargets =    @alltargets@
86installtargets =@installtargets@
87uninstalltargets=@uninstalltargets@
88
89############### END OF CONFIGURABLE SECTION ###############
90
91#
92# - compiler flags.
93#
94WARNFLAGS =     -w
95
96# flags to translate library c files
97LIBCFLAGS =     $(WARNFLAGS) \
98                -I. -I$(srcdir) \
99                $(DEFS) $(CPPFLAGS) $(CFLAGS)
100
101# flags to translate library c++ files
102LIBCXXFLAGS =   $(WARNFLAGS) -fno-implicit-templates \
103                -I. -I$(srcdir) \
104                $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
105
106# flags to translate ftmpl_inst.cc
107TMPLCXXFLAGS =  $(LIBCXXFLAGS)
108
109# flags to link test programs
110TESTCXXFLAGS =  $(LIBCXXFLAGS)
111
112# flags to link test programs
113TESTLDFLAGS =   $(LIBS) $(LDFLAGS)
114
115# flags to create dependency lists
116DEPCXXFLAGS =   -I. -I$(srcdir) \
117                $(DEFS) $(CPPFLAGS)
118
119#
120# - source files.
121#
122
123# factory source files
124basefactorysrc := \
125                canonicalform.cc \
126                cf_algorithm.cc \
127                cf_binom.cc \
128                cf_char.cc \
129                cf_chinese.cc \
130                cf_eval.cc \
131                cf_factor.cc \
132                cf_factory.cc \
133                cf_gcd.cc \
134                cf_generator.cc \
135                cf_globals.cc \
136                cf_irred.cc \
137                cf_iter.cc \
138                cf_linsys.cc \
139                cf_map.cc \
140                cf_ops.cc \
141                cf_primes.cc \
142                cf_random.cc \
143                cf_resultant.cc \
144                cf_reval.cc \
145                cf_switches.cc \
146                cf_util.cc \
147                debug.cc \
148                fac_berlekamp.cc \
149                fac_cantzass.cc \
150                fac_distrib.cc \
151                fac_ezgcd.cc \
152                fac_iterfor.cc \
153                fac_multihensel.cc \
154                fac_multivar.cc \
155                fac_sqrfree.cc \
156                fac_univar.cc \
157                fac_util.cc \
158                ffops.cc \
159                gf_tabutil.cc \
160                gfops.cc \
161                initgmp.cc \
162                int_cf.cc \
163                int_int.cc \
164                int_poly.cc \
165                int_pp.cc \
166                int_rat.cc \
167                sm_sparsemod.cc \
168                sm_util.cc \
169                variable.cc
170singfactorysrc := \
171                singext.cc
172useiofactorysrc := \
173                parseutil.cc \
174                readcf.y
175distfactorysrc := \
176                $(basefactorysrc) \
177                $(singfactorysrc) \
178                $(useiofactorysrc)
179
180# factory object files and dependencies
181factoryobj :=   $(factorysrc:.cc=.o)
182factoryobj :=   $(factoryobj:.y=.o)
183factorydep :=   $(factorysrc:.cc=.d)
184factorydep :=   $(factorydep:.y=.d)
185
186# factory header files
187basefactoryincl := \
188                assert.h \
189                canonicalform.h \
190                cf_algorithm.h \
191                cf_binom.h \
192                cf_defs.h \
193                cf_eval.h \
194                cf_factory.h \
195                cf_generator.h \
196                cf_globals.h \
197                cf_gmp.h \
198                cf_irred.h \
199                cf_iter.h \
200                cf_map.h \
201                cf_primes.h \
202                cf_primetab.h \
203                cf_random.h \
204                cf_reval.h \
205                cf_switches.h \
206                cf_util.h \
207                debug.h \
208                fac_berlekamp.h \
209                fac_cantzass.h \
210                fac_distrib.h \
211                fac_iterfor.h \
212                fac_multivar.h \
213                fac_sqrfree.h \
214                fac_univar.h \
215                fac_util.h \
216                ffops.h \
217                gf_tabutil.h \
218                gfops.h \
219                gmpext.h \
220                imm.h \
221                int_cf.h \
222                int_int.h \
223                int_poly.h \
224                int_pp.h \
225                int_rat.h \
226                sm_sparsemod.h \
227                sm_util.h \
228                timing.h \
229                variable.h
230singfactoryincl := \
231                singext.h
232useiofactoryincl := \
233                parseutil.h
234distfactoryincl := \
235                $(basefactoryincl) \
236                $(singfactoryincl) \
237                $(useiofactoryincl)
238
239# memory manager source files
240basememmansrc := \
241                newdelete.cc
242newmemmansrc := \
243                mmalloc.c \
244                mmallocb.c \
245                mmallocs.c \
246                mmblock.c \
247                mmheap.c \
248                mminit.c \
249                mmspec.c \
250                mmutil.c
251oldmemmansrc := \
252                memutil.c
253distmemmansrc := \
254                $(basememmansrc) \
255                $(newmemmansrc) \
256                $(oldmemmansrc)
257
258# memory manager object files and dependencies
259memmanobj :=    $(memmansrc:.cc=.o)
260memmanobj :=    $(memmanobj:.c=.o)
261memmandep :=    $(memmansrc:.cc=.d)
262memmandep :=    $(memmandep:.c=.d)
263
264# memory manager header files
265newmemmanincl := \
266                mmprivate.h \
267                memman.h
268oldmemmanincl := \
269                memutil.h
270distmemmanincl := \
271                $(newmemmanincl) \
272                $(oldmemmanincl)
273
274# factory template files
275templatesrc :=  \
276                ftmpl_array.cc \
277                ftmpl_factor.cc \
278                ftmpl_functions.h \
279                ftmpl_list.cc \
280                ftmpl_matrix.cc
281templateincl := \
282                ftmpl_array.h \
283                ftmpl_factor.h \
284                ftmpl_list.h \
285                ftmpl_matrix.h
286
287# header templates
288hdrtemplsrc := \
289                factoryconf.template \
290                factory.template
291hdrtempldep :=  $(hdrtemplsrc:.template=.d)
292
293# all the C/C++ source files in the distribution
294distsrc :=      \
295                $(distfactorysrc) $(distmemmansrc) \
296                $(addprefix templates/,$(templatesrc)) \
297                readcf.cc ftmpl_inst.cc \
298                gengftables.cc test_install.cc
299
300# all the C/C++ include files in the distribution
301distincl :=     \
302                $(distfactoryincl) $(distmemmanincl) \
303                $(addprefix templates/,$(templateincl))
304
305# all files in the distribution
306distfiles :=    \
307                $(distsrc) $(distincl) $(hdrtemplsrc) \
308                GNUmakefile.in configure.in config.h.in configure \
309                ChangeLog README NEWS INSTALL \
310                examples/GNUmakefile examples/application.cc \
311                examples/factorize.cc examples/gcd.cc \
312                bin/folding.el bin/fold-docu.el \
313                bin/install-sh bin/makeheader bin/mkinstalldirs
314
315#
316# - phony targets.
317#
318.PHONY:         all cf mem dist depend \
319                clean mostlyclean distclean maintainer-clean \
320                install installcf installmem installgftables installtest \
321                uninstall uninstallcf uninstallmem uninstallgftables
322
323#
324# - pattern rules.
325#
326
327# how to create library objets
328%.o: %.cc config.h
329        $(CXX) -c $< $(LIBCXXFLAGS) -o $@
330%.o: %.c config.h
331        $(CC) -c $< $(LIBCFLAGS) -o $@
332
333# how to create dependency files
334%.d: %.cc factoryconf.h config.h
335        echo $@ "\\" > $@
336        $(CXX) -MM $< $(DEPCXXFLAGS) >> $@
337%.d: %.c factoryconf.h config.h
338        echo $@ "\\" > $@
339        $(CXX) -MM $< $(DEPCXXFLAGS) >> $@
340%.d: %.template
341        echo $@ $(@:.d=.h) : "\\" > $@
342        sed -n '/^\/\*MAKEHEADER/!d; n; s/^#include "//; s/"//; p;' $< | tr '\012' ' ' >> $@
343        echo >> $@
344
345# how to create header files from header templates
346%.h: %.template
347        $(MAKEHEADER) $(MAKEHEADERFLAGS) $< $@
348
349#
350# - building factory.
351#
352all:            $(alltargets)
353
354cf:             factoryconf.h factory.h $(libfactory)
355
356mem:            libcfmem.a
357
358#
359# - explicit targets.
360#
361$(libfactory):  $(factoryobj)
362                $(AR) $(ARFLAGS) $@ $^
363                $(RANLIB) $@
364
365libcfmem.a:     $(memmanobj)
366                $(AR) $(ARFLAGS) $@ $^
367                $(RANLIB) $@
368
369$(srcdir)/readcf.cc: readcf.y
370                $(BISON) $< -o $@
371
372ftmpl_inst.o:   ftmpl_inst.cc factoryconf.h factory.h \
373                $(addprefix templates/,$(templatesrc)) \
374                $(addprefix templates/,$(templateincl))
375                $(CXX) -c $< $(TMPLCXXFLAGS) -o $@
376
377# specify dependency in case user does not 'make depend'
378factoryconf.h:  config.h
379
380TAGS:
381                etags $(addprefix $(srcdir)/, $(distsrc) $(distincl))
382
383#
384# - GF(q) table generation.
385#
386
387# these are not all dependencies, but the most important ones
388gengftables.o:  gengftables.cc factory.h gf_tabutil.h \
389                factoryconf.h config.h
390                @if test -z "$(filter mem,$(alltargets))" \
391                  || test -z "$(filter readcf.y,$(factorysrc))"; then \
392                  echo "You have to configure --with-memman --enable-streamio"; \
393                  echo "to make gengftables."; \
394                  exit 1; \
395                fi
396                $(CXX) -c $< $(TESTCXXFLAGS) -o $@
397
398gengftables:    gengftables.o ftmpl_inst.o $(libfactory) libcfmem.a
399                $(CXX) $< ftmpl_inst.o -L. -lcf -lcfmem $(TESTLDFLAGS) -o $@
400
401gftables:       gengftables
402                @echo "This command will take quite a long time to execute;"
403                @echo "maybe you want to get the tables directly via ftp (see"
404                @echo "the INSTALL file)."
405                $(MKINSTALLDIRS) gftables
406                ./gengftables
407
408#
409# - installation test program.
410#
411
412# compile installation test program.  do not look up
413# header files in current directory or in $(srcdir), but use
414# the header files from the directory where they should be
415# after installation.
416test_install.o: test_install.cc
417                $(CXX) -c $< $(TESTCXXFLAGS) -I- -I$(includedir) -o $@
418
419# the same we do for ftmpl_inst.o which for this reason is named
420# iftmpl_inst.o
421iftmpl_inst.o:
422                $(CXX) -c $(templatedir)/ftmpl_inst.cc $(TMPLCXXFLAGS) -I- -I$(includedir) -o $@
423
424# link installation test program
425test_install:   test_install.o iftmpl_inst.o
426                $(CXX) $^ -L$(libdir) -lcf -lcfmem $(TESTLDFLAGS) -o $@
427
428installtest:    test_install
429                @-if ./test_install; then \
430                  echo "Installation seems ok."; \
431                else \
432                  echo "Please check path of your GF(q) tables in config.h."; \
433                fi
434
435#
436# - install targets.
437#
438install:        $(installtargets)
439
440installcf:      cf
441                $(MKINSTALLDIRS) $(libdir)
442                $(MKINSTALLDIRS) $(includedir)
443                $(MKINSTALLDIRS) $(templatedir)
444                $(INSTALL_DATA) $(libfactory) $(libdir)/$(libfactory)
445                $(INSTALL_DATA) factory.h $(includedir)/factory.h
446                $(INSTALL_DATA) factoryconf.h $(includedir)/factoryconf.h
447                $(INSTALL_DATA) $(srcdir)/ftmpl_inst.cc $(templatedir)/ftmpl_inst.cc
448                for file in $(templatesrc) $(templateincl); do \
449                  $(INSTALL_DATA) $(srcdir)/templates/$$file $(templatedir)/$$file; \
450                done
451
452installmem:     mem
453                $(MKINSTALLDIRS) $(libdir)
454                $(INSTALL_DATA) libcfmem.a $(libdir)/libcfmem.a
455
456# to a pity, this cannot be done automatically ...
457installgftables:
458                @echo "Copying GF(q) tables ..."
459                @if test -d gftables; then \
460                  $(MKINSTALLDIRS) $(gftabledir); \
461                  for file in gftables/gftable.*.*; do \
462                    $(INSTALL_DATA) $$file $(gftabledir); \
463                  done \
464                elif test -d "$(srcdir)"/gftables; then \
465                  $(MKINSTALLDIRS) $(gftabledir); \
466                  for file in "$(srcdir)"/gftables/gftable.*.*; do \
467                    $(INSTALL_DATA) $$file $(gftabledir); \
468                  done \
469                else \
470                  echo "Run 'make gftables' before installing them"; \
471                  exit 1; \
472                fi
473
474#
475# - uninstall targets.
476#
477uninstall:      $(uninstalltargets)
478
479uninstallcf:
480                -for file in $(templatesrc) $(templateincl); do \
481                  rm -f $(templatedir)/$$file; \
482                done
483                -rm -f $(templatedir)/ftmpl_inst.cc
484                -rm -f $(includedir)/factoryconf.h
485                -rm -f $(includedir)/factory.h
486                -rm -f $(libdir)/$(libfactory)
487                -rmdir $(templatedir)
488                -rmdir $(includedir)
489                -rmdir $(libdir)
490
491uninstallmem:
492                -rm -f $(libdir)/libcfmem.a
493                -rmdir $(libdir)
494
495uninstallgftables:
496                -rm -f $(gftabledir)/gftable.*.*
497                -rmdir $(gftabledir)
498
499#
500# - building a distribution.
501#
502dist:           $(srcdir)/readcf.cc $(srcdir)/configure
503                rm -f $(distname).tgz
504                rm -rf $(distname)
505                $(MKINSTALLDIRS) $(distname)/bin
506                $(MKINSTALLDIRS) $(distname)/examples
507                $(MKINSTALLDIRS) $(distname)/templates
508                @echo "Copying files to distribution directory ..."
509                @for file in $(distfiles); do \
510                  ln $(srcdir)/$$file $(distname)/$$file; \
511                done
512                tar cf $(distname).tar $(distname)
513                gzip $(distname).tar
514                mv $(distname).tar.gz $(distname).tgz
515
516#
517# - cleaning up.
518#
519clean:         
520                -rm -f $(libfactory) libcfmem.a \
521                  gengftables test_install \
522                  factoryconf.h factory.h *.o *.d
523
524# remove gftables only if we built them
525mostlyclean:    clean
526                -rm -f TAGS
527                -if test ! -f gftables/README; then \
528                  rm -rf gftables; \
529                fi
530
531distclean:      mostlyclean
532                -rm -f $(distname).tgz GNUmakefile stamp-h \
533                  config.cache config.log config.status config.h
534                -rm -rf $(distname)
535
536maintainer-clean: distclean
537                @echo "This command is intended for maintainers to use;"
538                @echo "it deletes files that require bison to rebuild."
539                -rm -f $(srcdir)/readcf.cc
540
541#
542# - dependencies.
543#
544# Do not generate them automatically if there are not any
545# dependencies at all.  this trick saves some time when you do
546# not want to compile but do some maintenance which do not
547# require the dependencies.  say 'make depend' to create the
548# dependencies explicitly.
549#
550depend:         $(factorydep) $(memmandep) $(hdrtempldep)
551
552ifneq ($(wildcard *.d),)
553  include $(factorydep) $(memmandep) $(hdrtempldep)
554endif
555
556#
557# - configure stuff.
558#
559$(srcdir)/configure: configure.in
560                -cd $(srcdir) && autoconf
561
562# seems gmake needs at least a trivial command.  otherwise all
563# files which depend on config.h will be remade even if congig.h
564# did not change.
565config.h:       stamp-h
566                @:
567
568stamp-h:        config.h.in config.status
569                CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
570                echo timestamp > stamp-h
571
572GNUmakefile:    GNUmakefile.in config.status
573                CONFIG_FILES=GNUmakefile CONFIG_HEADERS= ./config.status
574
575config.status:  configure
576                ./config.status --recheck
577
578#
579# - some extra targets inserted by configure.
580#
581@timingtargets@
582@debouttargets@
583@debtimingtargets@
Note: See TracBrowser for help on using the repository browser.