home *** CD-ROM | disk | FTP | other *** search
/ Dream 45 / Amiga_Dream_45.iso / Amiga / Magazine / Dossier-LaTeX / AmiWeb2C.lha / source / web2c-6.1 / web2c / mp / SMakefile < prev    next >
Makefile  |  1995-04-12  |  10KB  |  356 lines

  1. # Makefile for MetaPost in its various incarnations.  It is appropriate
  2. # for the SAS/C Development System Version 6.x by SAS Institute Inc.
  3. # and was written by Andreas Scherer, April 6, 1995.
  4.  
  5. # With this SMakefile several different versions of MetaPost can be
  6. # created (one at a time!).  The standard is No20MetaPost.  It is as
  7. # close to the Web2C implementation as possible.
  8. #
  9. #     CHANGEFILE = cmp.ch
  10. #     HEADERFILE = mpd.h
  11. #     DEFS       = cpu=ANY data=FAR
  12. #     PS         = no20
  13. #     LOBJ       = lib:c.o
  14. #     LIBRARIES  = lib:scmieee.lib lib:scnb.lib
  15. #
  16. # An improved version for standard Amigas will provide a runtime
  17. # memory configuration and a resident version of IniMP.
  18. #
  19. #     CHANGEFILE = mmp.ch
  20. #     HEADERFILE = mpmemory.h
  21. #     DEFS       = cpu=ANY define=VARMEM
  22. #     PS         = no20
  23. #     LOBJ       = lib:cres.o
  24. #     LIBRARIES  = lib:scmieee.lib lib:sc.lib
  25. #
  26. # Advanced hardware configurations work with IniMP.  This uses the
  27. # runtime memory configuration as well.
  28. #
  29. CHANGEFILE = mmp_20.ch
  30. HEADERFILE = mpmemory.h
  31. DEFS       = cpu=68020 define=SPEEDUP define=VARMEM
  32. PS         =
  33. LOBJ       = lib:cres.o
  34. LIBRARIES  = lib:scmieee.lib lib:sc.lib
  35.  
  36. SED = sed
  37. SHELL=rx
  38. TIE=tie
  39. WMERGE=wmerge
  40. srcdir = .
  41. VPATH = .
  42.  
  43. # The missing `configure' mechanism requires this to be done by hand.
  44. bindir = TeXMF:bin/web2c61
  45. configdir = TeXMF:web2c61/config
  46. mppooldir = TeXMF:web2c61/pool
  47.  
  48. # This is so kpathsea will get remade automatically if you change
  49. # something in it and recompile from the package directory.
  50. kpathsea_parent = ../..
  51. kpathsea_dir = $(kpathsea_parent)/kpathsea
  52. kpathsea = $(kpathsea_dir)/kpathsea.lib
  53. kpathsea_20 = $(kpathsea_dir)/kpathsea_20.lib
  54.  
  55. # Routines used everywhere.
  56. commondefines = $(srcdir)/../lib/common.defines $(srcdir)/../lib/texmf.defines \
  57.     $(srcdir)/../lib/texmfextras.defines
  58. commonh = $(srcdir)/../lib/andyconfig.h
  59. commono = ../lib/lib.lib $(kpathsea)
  60. commono_20 = ../lib/lib_20.lib $(kpathsea_20)
  61.  
  62. # Routines used in TeX and Metafont.
  63. extrac = $(srcdir)/../lib/andytexmf.c
  64. extrah = $(srcdir)/../lib/andytexmf.h $(srcdir)/../lib/texmfmem.h $(HEADERFILE)
  65.  
  66. # Routines used in TeX, Metafont, and BibTeX.
  67. fileioc = $(srcdir)/../lib/andyopeninout.c
  68. fileioo = openinout.o
  69.  
  70. objs = $(fileioo) mp0.o mp1.o mp2.o mp3.o mp4.o mp5.o mp6.o mp7.o mp8.o \
  71.     mp9.o mp10.o
  72. iobjs = iextra.o inimp.o
  73. vobjs = vextra.o imp.o
  74.  
  75. # Where the test files are.
  76. mpsrcdir = $(srcdir)/../mp
  77. mpdistdir = $(srcdir)/../mpdist
  78. trapdir = $(mpsrcdir)/MPtrap
  79.  
  80. program = $(PS)inimp
  81. vprogram = $(PS)virmp
  82.  
  83. CC=sc
  84. CFLAGS = $(DEFS) math=IEEE code=far stackcheck noicons optimize
  85. CPPFLAGS = define=_STRICT_ANSI define=MP idir=$(srcdir)/../lib idir=../..
  86.  
  87. CCLD = slink
  88. LN = type
  89.  
  90. LDFLAGS = noicons $(XLDFLAGS)
  91. libs = $(commono) $(LIBRARIES)
  92. libs_20 = $(commono_20) $(LIBRARIES)
  93.  
  94. # This code was written by Stefan Scherer especially for
  95. # this Amiga implementation.
  96. speedup = ../mf/64bit/64bit.o
  97.  
  98. INSTALL = copy
  99. INSTALL_PROGRAM = copy
  100. INSTALL_DATA = copy
  101.  
  102. # The mems we know how to make.
  103. mems = plain.mem mfplain.mem
  104.  
  105. # And how to make them.
  106. inimp = MPPOOL=. ./$(PS)inimp -I
  107.  
  108. .SUFFIXES:
  109. .SUFFIXES: .o .c
  110. .c.o:
  111.     $(CC) $(CPPFLAGS) $(CFLAGS) $*.c
  112.  
  113. default: all
  114. all: $(program)
  115. triptrap: etrapmp
  116.  
  117. inimp: $(iobjs) $(objs) $(commono_20) $(speedup)
  118.     $(CCLD) to inimp from $(LOBJ) $(iobjs) $(objs) $(speedup) \
  119.     lib $(libs_20) $(LDFLAGS)
  120.  
  121. no20inimp: $(iobjs) $(objs) $(commono)
  122.     $(CCLD) to no20inimp from $(LOBJ) $(iobjs) $(objs) \
  123.     lib $(libs) $(LDFLAGS)
  124.  
  125. # You don't need to make virmp because the change file makes inimp behave
  126. # like virmp when not invoked with a -I switch.  The `virmp' target is provided
  127. # just in case you want a separate executable that is slightly more compact.
  128. virmp: $(vobjs) $(objs) $(commono_20) $(speedup)
  129.     $(CCLD) to virmp from $(LOBJ) $(vobjs) $(objs) $(speedup) \
  130.     lib $(libs_20) $(LDFLAGS)
  131.  
  132. no20virmp: $(vobjs) $(objs) $(commono)
  133.     $(CCLD) to no20virmp from $(LOBJ) $(vobjs) $(objs) \
  134.     lib $(libs) $(LDFLAGS)
  135.  
  136. # This target is only for testing arithmetic routines.  Run timemath with
  137. # no arguments and use the results printed on standard output to decide if
  138. # the external routines used when `FIXPT' is not defined in c-auto.h work
  139. # properly and run faster than the standard arithmetic routines.
  140. timemath: time.o cmath.o pmath.o mathtest.o
  141.     $(CC) $(CPPFLAGS) $(CFLAGS) link to timemath \
  142.     from time.o cmath.o pmath.o mathtest.o
  143.  
  144. time.o: andytime.o
  145.     copy andytime.o time.o
  146. andytime.o: andytime.c andytest_mpd.h $(extrah)
  147. andytime.c: time.c time.ch
  148.     $(WMERGE) time.c time.ch andytime.c
  149.  
  150. andytest_mpd.h: test_mpd.h test_mpd.hch
  151.     $(WMERGE) test_mpd.h test_mpd.hch andytest_mpd.h
  152.  
  153. mathtest.o: andymathtest.o
  154.     copy andymathtest.o mathtest.o
  155. andymathtest.o: andymathtest.c andytest_mpd.h $(extrah)
  156. andymathtest.c: mathtest.c mathtest.ch
  157.     $(WMERGE) mathtest.c mathtest.ch andymathtest.c
  158.  
  159. pmath.o: andypmath.o
  160.     copy andypmath.o pmath.o
  161. andypmath.o: andypmath.c andytest_mpd.h $(extrah)
  162. andypmath.c: pmath.c pmath.ch
  163.     $(WMERGE) pmath.c pmath.ch andypmath.c
  164.  
  165. cmath.o: andycmath.o
  166.     copy andycmath.o cmath.o
  167. andycmath.o: andympmath.c andytest_mpd.h $(extrah)
  168.     - delete stamp-orig stamp-trap
  169.     copy andytest_mpd.h mpd.h
  170.     copy andympmath.c andycmath.c
  171.     $(CC) $(CPPFLAGS) $(CFLAGS) andycmath.c
  172. andympmath.c: mpmath.c mpmath.ch
  173.     $(WMERGE) mpmath.c mpmath.ch andympmath.c
  174.  
  175. # trapmp is a shell script that sets environment variables and runs etrapmp
  176. #
  177. check: run-trap
  178. run-trap: $(PS)inimp trapf.tfm # etrapmp
  179.     -copy $(PS)inimp etrapmp
  180.     -execute settrapenv
  181.     -copy $(trapdir)/mtrap.mp .
  182.     -./etrapmp -I mtrap
  183.     -diff $(trapdir)/mtrap.log mtrap.log
  184.     -diff $(trapdir)/mtrap.0 mtrap.0
  185.     -diff $(trapdir)/mtrap.1 mtrap.1
  186.     -diff $(trapdir)/writeo writeo
  187.     -diff $(trapdir)/writeo.2 writeo.2
  188.     -copy $(trapdir)/trap.mp .
  189.     -copy $(trapdir)/trap.mpx .
  190.      wait # one second and then
  191.     touch trap.mpx # again.
  192.     -./etrapmp -I <$(trapdir)/trap1.in >NIL:
  193.     -copy trap.log trapin.log
  194.     -diff $(trapdir)/trapin.log trapin.log
  195.     -./etrapmp -I <$(trapdir)/trap2.in >trap.fot
  196.     -diff $(trapdir)/trap.log trap.log -l10000
  197.     -diff $(trapdir)/trap.fot trap.fot
  198.     -diff $(trapdir)/trap.5 trap.5
  199.     -diff $(trapdir)/trap.6 trap.6
  200.     -diff $(trapdir)/trap.148 trap.148
  201.     -diff $(trapdir)/trap.149 trap.149
  202.     -diff $(trapdir)/trap.150 trap.150
  203.     -diff $(trapdir)/trap.151 trap.151
  204.     -diff $(trapdir)/trap.197 trap.197
  205.     -diff $(trapdir)/trap.200 trap.200
  206.     ../fontutil/tftopl trap.tfm trap.pl
  207.     -diff $(trapdir)/trap.pl trap.pl
  208.  
  209. trapf.tfm: $(trapdir)/trapf.pl
  210.     ../fontutil/pltotf $(trapdir)/trapf.pl trapf.tfm
  211.  
  212. # Make mem files automatically.
  213. mems: $(mems)
  214.  
  215. # inimp requires mp.pool to be in one of the directories mentioned in the
  216. # MPPOOL path.  This version should work if the path includes ".".
  217. #
  218. plain.mem: $(PS)inimp
  219.     $(inimp) $(mpdistdir)/mplib/plain dump
  220.  
  221. mfplain.mem: $(PS)inimp
  222.     $(inimp) $(mpdistdir)/mplib/mfplain dump
  223.  
  224. # After changing constants, making a trapmp is just like making an inimp.
  225. etrapmp: stamp-trap $(iobjs) $(objs)
  226.     $(CCLD) to etrapmp from $(LOBJ) $(iobjs) $(objs) \
  227.     lib $(libs) $(LDFLAGS)
  228.  
  229. # Only one of stamp-trap and stamp-orig should exist at any given time.
  230. # They just keep track of whether mpd.h came from trap_mpd.h or orig_mpd.h
  231. #
  232. stamp-trap: stamp-convert
  233.     copy trap_mpd.h mpd.h
  234.     - delete stamp-orig
  235.     echo "" > stamp-trap
  236.  
  237. stamp-orig: stamp-convert
  238.     copy orig_mpd.h mpd.h
  239.     - delete stamp-trap
  240.     echo "" > stamp-orig
  241.  
  242. # tangle produces mp.p and mp.pool.
  243. mp.p mp.pool: mp.web $(CHANGEFILE)
  244.     ../web/tangle mp.web $(CHANGEFILE)
  245.  
  246. cmp.ch: $(mpsrcdir)/mp.ch $(mpsrcdir)/mp.chch
  247.     - delete cmp.ch
  248.     $(TIE) -c cmp.ch mp.web mp.ch mp.chch
  249.  
  250. mmp.ch: $(mpsrcdir)/mp.ch $(mpsrcdir)/mp.chch $(mpsrcdir)/mpmemory.ch
  251.     - delete mmp.ch
  252.     $(TIE) -c mmp.ch mp.web mp.ch mp.chch mpmemory.ch
  253.  
  254. mmp_20.ch: $(mpsrcdir)/mp.ch $(mpsrcdir)/mp.chch \
  255.     $(mpsrcdir)/mpmemory.ch $(mpsrcdir)/mp_20.ch
  256.     - delete mmp_20.ch
  257.     $(TIE) -c mmp_20.ch mp.web mp.ch mp.chch mp_20.ch mpmemory.ch
  258.  
  259. # The convert script produces the following files:
  260. #
  261. mp0.c: mp.p andycoerce.add $(commondefines)
  262.     $(SHELL) $(mpsrcdir)/convert.rexx
  263.     touch mpd.h
  264. mp1.c mp2.c mp3.c mp4.c mp5.c mp6.c mp7.c mp8.c mp9.c mp10.c \
  265. imp.c coerce.h mpd.h: mp0.c
  266.  
  267. mpmemory.h: stamp-convert
  268.  
  269. stamp-convert: mpd.h
  270.     copy mpd.h mpd.safe
  271.     $(SED) -f $(mpsrcdir)/mpmemory.sed < mpd.h > mpd.temp
  272.     copy mpd.temp mpd.h
  273.     delete mpd.temp
  274.     echo "" > stamp-convert
  275.  
  276. andycoerce.add: ../mf/coerce.add $(mpsrcdir)/coerce.add.ch
  277.     $(WMERGE) ../mf/coerce.add $(mpsrcdir)/coerce.add.ch andycoerce.add
  278.  
  279. # The (hand-coded) file $(extrac) and the (generated) file imp.c have
  280. # #ifdefs for INIMP, so we compile them differently.
  281. iextra.o: iextra.c $(commonh) $(extrah)
  282.     $(CC) $(CPPFLAGS) define=INIMP define=INI $(CFLAGS) iextra.c
  283.  
  284. inimp.o: inimp.c $(commonh) $(extrah)
  285.     $(CC) $(CPPFLAGS) define=INIMP $(CFLAGS) inimp.c
  286.  
  287. # Avoid compiling files in another directory.
  288. iextra.c: $(extrac)
  289.     - delete iextra.c
  290.     $(LN) $(extrac) >iextra.c
  291.  
  292. inimp.c: imp.c
  293.     - delete inimp.c
  294.     $(LN) imp.c > inimp.c
  295.  
  296. vextra.o: vextra.c
  297. vextra.c: $(extrac)
  298.     - delete vextra.c
  299.     $(LN) $(extrac) > vextra.c
  300.  
  301. $(fileioo): openinout.c
  302. openinout.c: $(fileioc)
  303.     - delete openinout.c
  304.     $(LN) $(fileioc) > openinout.c
  305.  
  306. $(iobjs) $(vobjs) $(objs): $(commonh) $(extrah)
  307.  
  308. mp0.o:    mp0.c
  309. mp1.o:    mp1.c
  310. mp2.o:    mp2.c
  311. mp3.o:    mp3.c
  312. mp4.o:    mp4.c
  313. mp5.o:    mp5.c
  314. mp6.o:    mp6.c
  315.     $(CC) $(CPPFLAGS) $(CFLAGS) NOOPT mp6.c # Don't try suicide!
  316. mp7.o:    mp7.c
  317. mp8.o:    mp8.c
  318. mp9.o:    mp9.c
  319.     $(CC) $(CPPFLAGS) $(CFLAGS) NOOPTPEEP mp9.c # Don't try suicide!
  320. mp10.o:    mp10.c
  321.  
  322. $(speedup): ../mf/64bit/64bit.a
  323.     asm -iINCLUDE: -m2 ../mf/64bit/64bit.a
  324.  
  325. c-sources: mpd.h
  326. .PHONY: c-sources
  327.  
  328. install: install-exec install-data
  329.  
  330. install-exec: all
  331.     $(INSTALL_PROGRAM) $(program) $(bindir)/$(program)
  332. install-data: mp.pool $(srcdir)/../config/mp.mcf
  333.     $(INSTALL_DATA) mp.pool $(mppooldir)
  334.     $(INSTALL_DATA) $(srcdir)/../config/mp.mcf $(configdir)
  335.  
  336. clean:
  337.     - delete \#?.(bak|o|lnk|log|mem) $(speedup)
  338.     - delete trap.\#? trapin.log trapf.tfm
  339.     - delete andytime.o andympmath.o andymathtest.o andypmath.o andycmath.\#?
  340.     - delete time.o mpmath.o mathtest.o timemath pmath.o cmath.\#?
  341.     - delete mtrap.\#? writeo writeo.2 mp.mcf
  342.  
  343. veryclean: clean
  344.     - delete \#?.(dvi|pool|p|safe|ckp) andy\#? ?mp.ch ?mp_20.ch
  345.     - delete mp?.c mp??.c imp.c tmp.c mpd.h coerce.h
  346.     - delete iextra.c inimp.c openinout.c
  347.     - delete orig_mpd.h trap_mpd.h
  348.  
  349. extraclean: veryclean
  350.     - delete \#?.(aux|bbl|blg|orig|pl|rej)
  351.     - delete \#?.(i|s|tfm|vf|vpl) \#?(gf|pk)
  352.     - delete CONTENTS.tex mpout.\#? patch\#? texput.\#? stamp-\#?
  353.     - delete $(program) etrapmp
  354.