home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume24 / mkid2 / part03 / Makefile < prev    next >
Encoding:
Makefile  |  1991-10-09  |  7.3 KB  |  234 lines

  1. #!/bin/make -f
  2.  
  3. # Copyright (c) 1986, Greg McGary
  4. # @(#)makefile    1.3 86/11/06
  5.  
  6. # --------------------------------------------------------------------
  7. # System Dependent Configuration:
  8. #   Choose a pre-packaged set of options below, or roll your own.
  9. #   The relevant options are as follows:
  10. #
  11. # * If you have the `PW' library which includes the regular-expression
  12. #   funcions regcmp(3) and regex(3), then use `-DREGEX' in DEFS, and
  13. #   `-lPW' in LIBS.  If you have the regular-expression functions
  14. #   re_comp(3) and re_exec(3), use `-DRE_EXEC' in DEFS.  If you don't
  15. #   have any regular-expression functions, don't add either to DEFS.
  16. #
  17. # * If you do not have the 4.2 directory access libraries, add `-lndir'
  18. #   to LIBS, and define `-DNDIR' in DEFS. 
  19. #
  20. # * If your string libraries have index(3) and rindex(3) instead of
  21. #   strchr(3) and strrchr(3), use `-DRINDEX' in DEFS.
  22. #
  23. # * If your compiler chokes on pointers to functions returning void,
  24. #   use `-Dvoid=int' in DEFS.
  25. #
  26. # * If you have setlinebuf(3) in your stdio to set line-buffering on
  27. #   a stream, use `-DERRLINEBUF' in DEFS.
  28. #
  29. # * If you have a System-III/V terminal driver, define `TERMIO' in DEFS.
  30. #
  31. # * If you have ranlib(1), define `RANLIB' as such.  If you don't have
  32. #   it, set `RANLIB' to something harmless like `@:', or `echo'
  33. #
  34. # * If you want lists of file names compressed with csh {} notation by
  35. #   default, set -DCRUNCH_DEFAULT=1. If you want files printed with no
  36. #   "crunching", set -DCRUNCH_DEFAULT=0. (The -k and -g options allow
  37. #   runtime control regardless of the builtin default).
  38. #
  39. # * If your system supports the alloca() function for allocating space
  40. #   on the stack, defined -DUSE_ALLOCA
  41. # --------------------------------------------------------------------
  42.  
  43. DEFS    =    -Dvoid=int -DREGEX -DTERMIO    # typical System-V defs
  44. # DEFS    =    -DREGEX -DNDIR -DTERMIO    # typical System-V defs
  45. # DEFS    =    -Dvoid=int -DRINDEX -DRE_EXEC -DNDIR    # typical V7 defs
  46. # DEFS    =    -Dvoid=int -DRINDEX -DRE_EXEC -DERRLINEBUF    # BSD defs
  47.  
  48. LIBS    =    -lc -lPW    # typical System-V libs
  49. # LIBS    =    -lndir -lPW    # typical System-V libs
  50. # LIBS    =    -lndir    # typical V7 libs
  51. # LIBS    =    # typical BSD libs (none)
  52.  
  53. RANLIB    =    @:    # system doesn't have ranlib (Sys-V)
  54. # RANLIB    =    ranlib    # system has ranlib (typically V7 & BSD)
  55.  
  56. CRUNCH  =       -DCRUNCH_DEFAULT=1      # Original default - crunch file names
  57. #CRUNCH =       -DCRUNCH_DEFAULT=0      # Don't crunch names by default
  58.  
  59. ALLOCA  =       -DUSE_ALLOCA            # alloca support exists on system
  60. #ALLOCA =                               # system has no alloca() function
  61.  
  62. # --------------------------------------------------------------------
  63. # Compilation / Loading options:
  64. #   Choose options to generate a system as an installed product,
  65. #   for debugging, or for performance profiling.
  66. # --------------------------------------------------------------------
  67.  
  68. # CCFLG    =    -g -DDEBUG     # debugging
  69. # CCFLG    =    -p    # profiling
  70. CCFLG    =    -O3 -g    # production
  71.  
  72. # LDFLG    =    -g    # debugging
  73. # LDFLG    =    -p    # profiling
  74. LDFLG    =    # production
  75.  
  76. CC    =    hc
  77.  
  78. # --------------------------------------------------------------------
  79.  
  80. SHELL =        /bin/ksh
  81. TARGETS =    libid.a $(PROGS)
  82. PROGS =        mkid lid idx fid iid $(LIDLINKS)
  83. DESTINATION_DIR = /usr/local
  84. MANDIR =        /usr/catman/local_man/man1
  85.  
  86. LIDLINKS =     gid aid eid pid
  87. CFLAGS =    $(CCFLG) -I. $(DEFS) $(CRUNCH) $(ALLOCA)
  88. LDFLAGS =    $(LDFLG) libid.a $(LIBS)
  89.  
  90. OFILES =    init.o getscan.o scan-c.o scan-asm.o bsearch.o hash.o \
  91.         bitops.o basename.o gets0.o getsFF.o paths.o opensrc.o \
  92.         stoi.o uerror.o document.o bitcount.o wmatch.o bitsvec.o \
  93.         tty.o bzero.o scan-text.o cannoname.o kshgetwd.o unsymlink.o
  94.  
  95. TEXJUNK=id.aux id.cp id.cps id.dvi id.fn id.fns id.ky id.kys id.log id.pg \
  96.     id.pgs id.toc id.tp id.tps id.vr id.vrs id-info
  97.  
  98. # --------------------------------------------------------------------
  99.  
  100. all:        $(TARGETS)
  101.  
  102. libid.a:    $(OFILES)
  103.         ar rv $@ $?
  104.         $(RANLIB) $@
  105.  
  106. mkid:        mkid.o libid.a
  107.         $(CC) -o $@ $@.o $(LDFLAGS)
  108.  
  109. fid:        fid.o libid.a
  110.         $(CC) -o $@ $@.o $(LDFLAGS)
  111.  
  112. lid:        lid.o libid.a
  113.         $(CC) -o $@ $@.o $(LDFLAGS)
  114.  
  115. idx:        idx.o libid.a
  116.         $(CC) -o $@ $@.o $(LDFLAGS)
  117.  
  118. iid:        iid.o iidfun.o
  119.         $(CC) -o iid iid.o iidfun.o $(LDFLG) $(LIBS)
  120.  
  121. iid.c:        iid.y
  122.         rm -f iid.c
  123.         yacc iid.y
  124.         mv y.tab.c iid.c
  125.  
  126. iidfun.o:    iidfun.c iiddef.h
  127.  
  128. iid.o:        iid.c iiddef.h
  129.         $(CC) $(CFLAGS) -DDEF -c iid.c
  130.  
  131. $(LIDLINKS): lid
  132.         -/bin/rm -f $@
  133.         ln lid $@
  134.  
  135. install: installbin installman
  136.  
  137. installman:    fid.1 iid.1 lid.1 mkid.1
  138.         cp fid.1 iid.1 lid.1 mkid.1 $(MANDIR)
  139.         cd $(MANDIR) ; rm -f fid.1.z iid.1.z lid.1.z mkid.1.z aid.1.z \
  140.                              gid.1.z eid.1.z
  141.         cd $(MANDIR) ; chmod 666 fid.1 iid.1 lid.1 mkid.1
  142.         cd $(MANDIR) ; mantocatman fid.1
  143.         cd $(MANDIR) ; mantocatman iid.1
  144.         cd $(MANDIR) ; mantocatman lid.1
  145.         cd $(MANDIR) ; mantocatman mkid.1
  146.         cd $(MANDIR) ; rm -f fid.1 iid.1 lid.1 mkid.1
  147.  
  148. installbin: $(PROGS)
  149.         chmod 777 $(PROGS)
  150.         -mv $(DESTINATION_DIR)/mkid $(DESTINATION_DIR)/OLDmkid
  151.         -mv $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/OLDlid
  152.         -mv $(DESTINATION_DIR)/idx $(DESTINATION_DIR)/OLDidx
  153.         -mv $(DESTINATION_DIR)/fid $(DESTINATION_DIR)/OLDfid
  154.         -mv $(DESTINATION_DIR)/gid $(DESTINATION_DIR)/OLDgid
  155.         -mv $(DESTINATION_DIR)/aid $(DESTINATION_DIR)/OLDaid
  156.         -mv $(DESTINATION_DIR)/eid $(DESTINATION_DIR)/OLDeid
  157.         -mv $(DESTINATION_DIR)/pid $(DESTINATION_DIR)/OLDpid
  158.         -mv $(DESTINATION_DIR)/iid $(DESTINATION_DIR)/OLDiid
  159.         -rm -f $(DESTINATION_DIR)/iid.help
  160.         cp mkid $(DESTINATION_DIR)/mkid
  161.         cp lid $(DESTINATION_DIR)/lid
  162.         cp idx $(DESTINATION_DIR)/idx
  163.         cp fid $(DESTINATION_DIR)/fid
  164.         cp iid $(DESTINATION_DIR)/iid
  165.         cp iid.help $(DESTINATION_DIR)/iid.help
  166.         chmod 444 $(DESTINATION_DIR)/iid.help
  167.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/gid
  168.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/aid
  169.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/eid
  170.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/pid
  171.  
  172. clean:
  173.         rm -f $(TARGETS) *.o iid.c core a.out $(TEXJUNK)
  174.  
  175. id.tar:
  176.         cd ..; tar cvbf 20 id/id.tar id/*.[ch1-8] id/makefile id/TODO id/TUTORIAL
  177.  
  178. id.tar.Z:    id.tar
  179.         compress -b 14 <id.tar >id.tar.Z
  180.  
  181. id.shar:    id.shar-1 id.shar-2 id.shar-3
  182.  
  183. id.shar-1:
  184.         shar $(SHARFLAGS) TUTORIAL TODO makefile *.h *.[1-8] >$@
  185.  
  186. id.shar-2:
  187.         shar $(SHARFLAGS) [a-l]*.c >$@
  188.  
  189. id.shar-3:
  190.         shar $(SHARFLAGS) [m-z]*.c >$@
  191.  
  192. debug:
  193.     make CCFLG='-g -DDEBUG' LDFLG='-g'
  194.  
  195. ID::
  196.     /bin/rm -f ID
  197.     mkid *.[chy]
  198.  
  199. TAGS::
  200.     /bin/rm -f TAGS
  201.     etags -tw *.[chy]
  202.  
  203. # TeX stuff - these actions count on several things being installed on
  204. # your system:
  205. #
  206. # tex - the document processor
  207. # texinfo.tex - the texinfo macro package used to format the document
  208. # texindex - the index sorting program used to generate the index
  209. # makeinfo - the program to turn texinfo files into online documentation
  210. #
  211. # A tex distribution tape can be obtained from the University of Washington.
  212. # send email to: elisabet@max.u.washington.edu for more info.
  213. #
  214. # The other texinfo tools are part of the Gnuemacs distribution and can
  215. # be obtained via FTP from prep.ai.mit.edu
  216.  
  217. # Make the online info file by running makeinfo - texinfo-format-buffer from
  218. # within emacs probably will not work very well.
  219. id-info: id.texinfo
  220.     makeinfo id.texinfo
  221.  
  222. # If you are running TeX from a clean directory, need to run once to get
  223. # the initial .aux file with the cross reference info in it.
  224. id.aux: id.texinfo
  225.     tex id.texinfo
  226.     texindex id.??
  227.  
  228. # Running TeX twice here is probably overkill, but it makes absolutely sure
  229. # the index agrees with the actual location of text.
  230. id.dvi: id.aux
  231.     tex id.texinfo
  232.     texindex id.??
  233.     tex id.texinfo
  234.