home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume24 / psroff3.0 / part07 / Makefile next >
Makefile  |  1991-10-09  |  13KB  |  438 lines

  1. #    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  2. #        All Rights Reserved
  3. #
  4. #    See the LICENSE file for a full description of the restrictions
  5. #    under which this software is provided.
  6. #
  7. #    This makefile requires System V compatible "make".  *Not* V7
  8. #    vanilla BSD or Ultrix or Sun.  Most modern systems will have
  9. #    a copy of the SV one somewhere (eg: .../s5bin/make).
  10. #
  11. #    Function: Upper level makefile; configuration options.
  12. #
  13. #
  14. #ident  "@(#)Makefile: 2.16 Copyright 91/04/02 17:02:22 Chris Lewis"
  15.  
  16. #    Use s5make on Ultrix!
  17. MAKE    = make
  18.  
  19. #    Only uncomment the following braindamage if your MAKE doesn't
  20. #    understand "include".
  21. #MAKE    = sed -e '/include/r ../makeincl' -e '/include/d' Makefile | make -f - $(MAKEFLAGS)
  22.  
  23. #    Set to where you want the user-interfaces to go.  /usr/lbin
  24. #    is also common.  /usr/bin if you don't have a specific place
  25. #    for non-standard programs.
  26. BINDIR    = /usr/local/bin
  27.  
  28. #    Testing type (default postscript (ps)):
  29. #    Use lj for laserjet.
  30. TTYPE    = ps
  31.  
  32. #    Libraries for Troff2 internals, created if it doesn't exist.
  33. #    This *must* be a directory all by itself with no other stuff
  34. #    in it.  This should be suitable for everybody except networked
  35. #    systems where you may want to put this on a common area (one
  36. #    per platform type (eg: Sun 3 vs. Sun 4)
  37. LIBDIR    = /usr/lib/troff2
  38.  
  39. #    Directory for Laserjet fonts.  Don't change this unless you
  40. #    really have to.
  41. LJF    = $(LIBDIR)/lib/lj
  42.  
  43. #    nroff/troff macro directory for tmac.t2.  Change this only
  44. #    if you insist on keeping /usr/lib/tmac "virginal".
  45. T2DIR    = /usr/lib/tmac
  46.  
  47. #    Where your real macros are - leave this alone unless your UNIX
  48. #    is really wierd.
  49. RTMACDIR = /usr/lib/tmac
  50.  
  51. #    upper level man directory, with subdirectories man1, man2 etc.
  52. #    Could be /usr/man/mann, /usr/man/manl, /usr/man/man1, /usr/man/l_man/man1
  53. MANDIR    = /usr/man/mann
  54. #    Desired extension for man page.  Often the last letter of MANDIR.
  55. #    or 1L, or simply 1.
  56. MANEXT    = n
  57.  
  58. #    Change this at your peril - your troff *must* support -F!
  59. #    (font width files (ft??) are placed under FONTDIR/<width>/ft??)
  60. #    (see lib/psrofflib.S).  Will NOT clash with anything already there.
  61. FONTDIR    = /usr/lib/font
  62.  
  63. #    Set this to -lc_s if you have 386/ix style shared libraries and you
  64. #    wish to use them.  Don't know about any other system's shared libraries.
  65. LIBFLAGS =
  66.  
  67. #    Bourne shell.  *All* Bourne shells with the exception of extremely
  68. #    braindamaged ones (such as Ultrix or vanilla BSD) will work fine.
  69. #    Ultrix/Dynix may need the ... s5bin/sh one.  Korn or bash
  70. #    *should* work just fine, but I've never tested 'em.
  71. #
  72. #    This is also here for make, but if you have SHELL defined in your
  73. #    *own* environment, you can't trust this to work anyways.
  74. #
  75. SHELL    =    /bin/sh
  76.  
  77. #    Try "make testbug"  If make stops, uncomment IGNORESH and
  78. #    try "make testbug" again.  If it still stops, complain to your
  79. #    vendor - your shell is BADLY broken.
  80. #IGNORESH = set +e ;
  81.  
  82. #    How to ensure that shell scripts use the *right* shell.
  83. #    "#! /bin/sh" may work for you (BSDish).  ": /bin/sh" may work
  84. #    for you (Xenix or System V).
  85. #
  86. #    Frankly, none of this crap is necessary on a sane O/S.
  87. #    (Even Xenix gets this right for crying out loud!  But *noooo*
  88. #    Not Ultrix or Sun or Dynix BSD universe....)
  89. #
  90. #    ": /usr/bin/sh5" works for Ultrix.  "#! /bin/sh" for pure BSD.
  91. #    Do not use $(SHELL) in this line because if your environment has
  92. #    SHELL defined, it may *override* the above SHELL definition.
  93. #
  94. #    System V/Xenix usually:
  95. STARTSHELL = : /bin/sh
  96. #    #! something (tr wierdness is to get "#" into it)
  97. STARTSHELL = `echo 'X! /bin/sh' | tr X '\043'`
  98.  
  99. #    Whether you need "cc -c"'d font width tables for troff.
  100. #    Don't set this non-null unless nothing else works.
  101. #    I know of no machine needing it.  See TROUBLE file.
  102. COMPILE    =
  103.  
  104. #    Compile flags needed to compile things on your machine.
  105. #    Usually just -O.  May need gcc stuff.
  106. #
  107. CCFLAGS = -O
  108.  
  109. #    If you're using gcc or something else, change this:
  110. CC    = cc
  111.  
  112. #    Do not comment any of the following out.  If you aren't going
  113. #    to use TeX PK fonts with HP Laserjet output, just NEVER execute
  114. #    makebuildljfonts.
  115. #
  116. #    If you have Rick Richardson's sfp2pk, set it's full path here:
  117. #    Only of interest for LJ/buildfonts.  If you don't have sfp2pk,
  118. #    leave this alone, the code won't try to run it.
  119. SFP2PK    = /usr4/public/bin/sfp2pk
  120. #    If you have TeX fonts onboard, list the directories that
  121. #    contain them.  Only of interest for LJ/buildfonts.
  122. #    You can always set this to "/", it'll just take a long time, but
  123. #    it will find ALL PK's on your system.
  124. PKFONTS    = /usr/lib/font/devjet /usr5/texfonts/fonts
  125. #    Where you want to build fonts, set this to the name of the
  126. #    directory where you want to make them.  Caution: this could be
  127. #    enormous...  (5000+ blocks)
  128. NEWFONTS = /tmp/newfonts
  129. #    If you are going to be working with ditroff, set this to the
  130. #    path to the makedev (DWB) or mkfont (PD via comp.sources.unix) program.
  131. #    If this doesn't point at an executable program, nothing will happen.
  132. #    A make install in the widths directory will go through the psrofflib
  133. #    file, looking for each configuration requiring ditroff, and install
  134. #    the needed widths in the proper directory.  This will NOT overwrite
  135. #    files not created by this process.
  136. MAKEDEV    = /u/clewis/src/mkfont/mkfont
  137.  
  138. #    Dinna touch from here on
  139.  
  140. .SUFFIXES: .S .S~
  141.  
  142. .S~:
  143.     @rm -f $@
  144.     $(GET) -p $(GFLAGS) $< | ./sedscript > $@
  145.     @chmod 444 $@
  146.  
  147. .S~.S:
  148.     @rm -f $@
  149.     $(GET) -p $(GFLAGS) $< > $@
  150.     @chmod 444 $@
  151.  
  152. .S:
  153.     rm -f $@
  154.     ./sedscript < $@.S > $@
  155.     @chmod 444 $@
  156.  
  157. #    Main stuff:
  158.  
  159. MAIN    = troff2.o opt.o utils.o t2conf.o cattab.o debug.o
  160.  
  161. #    Drivers:
  162.  
  163. BACKENDS = lj.o pk.o pkc.o ps.o dt.o dit.o
  164.  
  165. DEFINES    = '-DLIBDIR="$(LIBDIR)/lib"' '-DFONTDIR="$(FONTDIR)"'\
  166.     '-DLJF="$(LJF)"' $(CCFLAGS)
  167.  
  168. #    Creation of sedscript for parameterization.
  169.  
  170. SEDSCRIPT =    "sed -e 's;%%LIBDIR%%;$(LIBDIR);g' \
  171.              -e 's;%%LJF%%;$(LJF);g' \
  172.              -e 's;%%STARTSHELL%%;'\"$(STARTSHELL)\"';g' \
  173.              -e 's;%%COMPILE%%;$(COMPILE);g' \
  174.              -e 's;%%FONTDIR%%;$(FONTDIR);g' \
  175.              -e 's;%%MANDIR%%;$(MANDIR);g' \
  176.              -e 's;%%MANEXT%%;$(MANEXT);g' \
  177.              -e 's;%%CCFLAGS%%;$(CCFLAGS);' \
  178.              -e 's;%%CC%%;$(CC);' \
  179.              -e 's;%%LIBFLAGS%%;$(LIBFLAGS);' \
  180.              -e 's;%%SFP2PK%%;$(SFP2PK);' \
  181.              -e 's;%%PKFONTS%%;$(PKFONTS);' \
  182.              -e 's;%%NEWFONTS%%;$(NEWFONTS);' \
  183.              -e 's;%%T2DIR%%;$(T2DIR);' \
  184.              -e 's;%%MAKEDEV%%;$(MAKEDEV);' \
  185.              -e 's^%%IGNORESH%%^$(IGNORESH)^' \
  186.              -e 's;%%RTMACDIR%%;$(RTMACDIR);g'"
  187.  
  188. CFLAGS    = $(DEFINES)
  189.  
  190. all:    troff2ps subst.done makeincl psroff README TROUBLE LASERFONTS \
  191.     MISC DITROFF INSTALL LICENSE LJIII submakes
  192.  
  193. subst.done:    sedscript
  194.     rm -f psroff makeincl
  195.     touch subst.done
  196.  
  197. submakes:
  198.     cd adapters ; $(MAKE) all
  199.     cd lib ; $(MAKE) all
  200.     cd man ; $(MAKE) all
  201.     cd utils ; $(MAKE) all
  202.     cd widths ; $(MAKE) all
  203.     cd tests ; $(MAKE) all
  204.  
  205. psroff:    psroff.S sedscript
  206.     @echo "Extracting $@ with variable substitutions"
  207.     @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  208.  
  209. makeincl:    makeincl.S sedscript
  210.     @echo "Extracting $@ with variable substitutions"
  211.     @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  212.  
  213. audit:    audit.S sedscript
  214.     @echo "Extracting $@ with variable substitutions"
  215.     @rm -f $(@) ; ./sedscript < $@.S > T ; chmod 555 T ; mv T $@
  216.  
  217. unpackljfonts:
  218.     @ $(IGNORESH) find . -name '*.UU' -print | \
  219.     while read i ; \
  220.     do \
  221.         ft=`echo $$i | sed -e 's/.UU//'` ; \
  222.         if [ -s $$ft ] ; \
  223.         then \
  224.         echo "Removing $$i" ; \
  225.         rm -f $$i ; \
  226.         else \
  227.         rm -f $$ft ; \
  228.         echo "uudecoding $$i -> $$ft" ; \
  229.         uudecode < $$i ; \
  230.         if [ ! -s $$ft ] ; \
  231.         then \
  232.             echo "Whoops - uudecode failed on $$i - bad path?" ; \
  233.             exit 1 ; \
  234.         else \
  235.             rm $$i ; \
  236.         fi ; \
  237.         fi ; \
  238.     done
  239.  
  240. buildljfonts:    unpackljfonts
  241.     make troff2ps makeincl
  242.     cd lib ; make lj.fonts lj.lib
  243.     cd utils ; make buildfonts
  244.  
  245. installljfonts:
  246.     test -d $(LIBDIR) || mkdir $(LIBDIR)
  247.     test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  248.     test -d $(LIBDIR)/lib/lj || mkdir $(LIBDIR)/lib/lj
  249.     $(IGNORESH) files=`echo fonts.lj/*.pk` ; \
  250.     if [ "$$files" != 'fonts.lj/*.pk' ] ; \
  251.     then \
  252.         cp fonts.lj/*.pk $(LJF) ; \
  253.         chmod 644 $(LJF)/* ; \
  254.     fi
  255.     $(IGNORESH) files=`echo fonts.lj/*.sfp` ; \
  256.     if [ "$$files" != 'fonts.lj/*.sfp' ] ; \
  257.     then \
  258.         cp fonts.lj/*.sfp $(LJF) ; \
  259.         chmod 644 $(LJF)/* ; \
  260.     fi
  261.     @echo "don't panic if the next line dies"
  262.     $(IGNORESH) test -z "$(PKFONTS)" -o ! -d "$(NEWFONTS)" \
  263.         || cp $(NEWFONTS)/* $(LJF)
  264.  
  265. register:
  266.     make troff2ps makeincl
  267.     cd lib ; make lj.fonts lj.lib
  268.     cd widths ; make ljwidths widths
  269.     @echo "Now su to root and type 'make installwidths'"
  270.  
  271. installwidths:    makeincl
  272.     cd widths; $(MAKE) installwidths
  273.  
  274. install:    makeincl
  275.     test -d $(BINDIR) || mkdir $(BINDIR)
  276.     test -d $(MANDIR) || echo "No MANDIR directory.  Have you got MANDIR right?"
  277.     test -d $(LIBDIR) || mkdir $(LIBDIR)
  278.     test -d $(LIBDIR)/adapters || mkdir $(LIBDIR)/adapters
  279.     test -d $(LIBDIR)/lib || mkdir $(LIBDIR)/lib
  280.     test -d $(RTMACDIR) || mkdir $(RTMACDIR)
  281.     test -d $(FONTDIR) || mkdir $(FONTDIR)
  282.     rm -f $(BINDIR)/psroff.old
  283.     -cp $(BINDIR)/psroff $(BINDIR)/psroff.old
  284.     cp psroff $(BINDIR)/psroff
  285.     rm -f $(LIBDIR)/troff2ps.old
  286.     -cp $(LIBDIR)/troff2ps $(LIBDIR)/troff2ps.old
  287.     cp troff2ps $(LIBDIR)/troff2ps
  288.     chmod 755 $(LIBDIR)/troff2ps $(BINDIR)/psroff
  289.     cd lib ; $(MAKE) install
  290.     cd adapters ; $(MAKE) install
  291.     cd man ; $(MAKE) install
  292.     cd utils ; $(MAKE) install
  293.     cd widths; $(MAKE) install
  294.  
  295. troff2ps:    $(MAIN) $(BACKENDS)
  296.     $(CC) $(CFLAGS) -o troff2ps $(MAIN) $(BACKENDS) $(LIBFLAGS)
  297.  
  298. #    The following is commented out because make has a bug in that
  299. #    even if you don't want to make lint, it insists on making
  300. #    the .c's from the SCCS files.  Dumb stupid....
  301. #lint:    $(MAIN:.o=.c) $(BACKENDS:.o=.c)
  302. #    lint -p $(CFLAGS) $(MAIN:.o=.c) $(BACKENDS:.o=.c) > output.lint
  303.  
  304. #    Drivers include dependencies - add to this list if you're adding
  305. #    drivers.
  306. dit.o:    defs.h
  307. t2conf.o:    defs.h ps.h lj.h dt.h
  308. ps.o:    defs.h ps.h
  309. dt.o:    defs.h dt.h
  310. lj.o:    defs.h lj.h pkc.h pk.h
  311.  
  312. pk.o:    defs.h pk.h pkc.h
  313. pkc.o:    defs.h pk.h pkc.h
  314. cattab.o:    defs.h pk.h
  315. debug.o:    defs.h pk.h
  316.  
  317. troff2.o utils.o opt.o: defs.h
  318.  
  319. sedscript:    Makefile defs.h
  320.     rm -f sedscript
  321.     echo $(SEDSCRIPT) \
  322.         `sed -n -e  \
  323.         '/T2VERSION/s/^.*\(R[0-9]* PL.*\)".*/-e "s;%%T2VERSION%%;\1;"/p' \
  324.         defs.h` > T
  325.     chmod 755 T
  326.     mv T sedscript
  327.  
  328.  
  329. clean:    makeincl
  330.     rm -f core *.o troff2ps psroff diagnostics audit
  331.     rm -fr mon.out output.lint TEST* DITTEST AUDITP AUDITP.c
  332.     rm -fr FONTS
  333.     cd adapters ; $(MAKE) clean
  334.     cd man ; $(MAKE) clean
  335.     cd utils ; $(MAKE) clean
  336.     cd lib ; $(MAKE) clean
  337.     cd widths ; $(MAKE) clean
  338.     cd tests ; $(MAKE) clean
  339.     rm -f sedscript makeincl subst.done */subst.done
  340.  
  341. #    Yes, this is a little wierd, but in this way I can figure
  342. #    out what you are...
  343. TEST:    Makefile defs.h tests/testtab.m tests/exttab.m makeincl
  344.     cd lib ; make
  345.     rm -f TEST1 TEST2
  346.     PATH=.:$(LIBDIR):$$PATH \
  347.         troff2ps -V | sed -e 's/^.*- \(.*\)/.ds 2v "\1/' > TEST1
  348.     echo ".ds pt \"($(TTYPE))" >> TEST1
  349.     echo ".ds 2d \"`date`" >> TEST1
  350.     echo ".sp" > TEST2
  351.     echo ".ps 10" >> TEST2
  352.     echo ".vs 12p" >> TEST2
  353.     echo ".ad 1" >> TEST2
  354.     echo "DEFS.H DEFINITIONS:" >> TEST2
  355.     sed -n -e '/Edit no more/q' \
  356.         -e '/T2VERSION/d' \
  357.         -e '/LIBDIR/d' \
  358.         -e 's/[     ]*\/\*.*//' \
  359.         -e '/^.define[     ]*\([^     ]*\)[     ]*\(.*\)$$/s//define \1=\2;/' \
  360.         -e 's/=;/;/' \
  361.         -e 's/^define //p' \
  362.         -e '/^.undef[     ]*\([^     ]*\).*/s//!\1;/p' \
  363.         defs.h >> TEST2
  364.     #echo ".br" >> TEST2
  365.     echo "MAKEFILE DEFINITIONS:" >> TEST2
  366.     echo "LIBDIR = $(LIBDIR);" >> TEST2
  367.     echo "LJF = $(LJF);" >> TEST2
  368.     echo "STARTSHELL = $(STARTSHELL); " >> TEST2
  369.     echo "SHELL = $(SHELL); " >> TEST2
  370.     echo "COMPILE = $(COMPILE);" >> TEST2
  371.     echo "FONTDIR = $(FONTDIR);" >> TEST2
  372.     echo "MANDIR = $(MANDIR);" >> TEST2
  373.     echo "CCFLAGS = $(CCFLAGS);" >> TEST2
  374.     echo "CC = $(CC);" >> TEST2
  375.     echo "LIBFLAGS = $(LIBFLAGS);" >> TEST2
  376.     echo "RTMACDIR = $(RTMACDIR);" >> TEST2
  377.     echo "PKFONTS = $(PKFONTS);" >> TEST2
  378.     echo "NEWFONTS = $(NEWFONTS);" >> TEST2
  379.     echo "IGNORESH = $(IGNORESH);" >> TEST2
  380.     echo "SFP2PK = $(SFP2PK)." >> TEST2
  381.     echo "TTYPE = $(TTYPE)." >> TEST2
  382.     @echo "Don't worry if the uname/grep fails"
  383.     -grep '^trofftype' lib/psrofflib >> TEST2
  384.     echo "Uname results:" >> TEST2
  385.     -uname -a >> TEST2
  386.     cat TEST1 tests/testtab.m TEST2 > TEST
  387.     rm -f TEST1 TEST2
  388.  
  389. test:    TEST
  390.     tbl TEST | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
  391.  
  392. DITTEST:    TEST
  393.     echo ".bp" >> TEST2
  394.     echo ".sp |.3i" >> TEST2
  395.     cat TEST TEST2 tests/exttab.m > DITTEST
  396.  
  397. dittest:    DITTEST
  398.     eqn DITTEST | tbl | PATH=:.:$(LIBDIR):$$PATH psroff -T$(TTYPE) $(TFLAGS)
  399.  
  400. check:    audit sedscript makeincl
  401.     cd lib ; $(MAKE)
  402.     ./audit
  403.  
  404. checkinstall:    audit sedscript makeincl
  405.     cd lib ; $(MAKE)
  406.     ./audit install
  407.  
  408. #    This is how I build a release - don't even try running this...!
  409. buildrelease:    clean unpackljfonts
  410.     $(IGNORESH) t=`find . -name 'p.*' -print`; \
  411.     if [ -n "$$t" ] ; \
  412.     then \
  413.         echo "files still out: $$t" ; \
  414.         exit 1 ; \
  415.     fi
  416.     make buildfinal
  417.  
  418. buildfinal:
  419.     make clean
  420.     t/cleantree
  421.     t/mkmanifest
  422.     t/mkkits
  423.     t/cleantree
  424.  
  425. #    Impossible file, we hope....
  426. WF    = /cowsnovskibumsteinpastafazoola/bdkdkdk
  427. testbug:
  428.     @ $(IGNORESH) if [ -r $(WF) ] ; \
  429.     then \
  430.         echo "Bizarre - are you sure you have $(WF)?" ; \
  431.     else \
  432.         echo "IGNORESH set correctly" ; \
  433.     fi
  434.  
  435. fixperms:
  436.     find $(LIBDIR) -type f -exec chmod +r '{}' ';'
  437.     find $(LIBDIR) $(FONTDIR) -type d -exec chmod +rx '{}' ';'
  438.