home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2278 / Makefile < prev    next >
Encoding:
Makefile  |  1990-12-28  |  5.6 KB  |  189 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.  
  35. DEFS    =    -Dvoid=int -DREGEX -DTERMIO    # typical System-V defs
  36. # DEFS    =    -DREGEX -DNDIR -DTERMIO    # typical System-V defs
  37. # DEFS    =    -Dvoid=int -DRINDEX -DRE_EXEC -DNDIR    # typical V7 defs
  38. # DEFS    =    -Dvoid=int -DRINDEX -DRE_EXEC -DERRLINEBUF    # BSD defs
  39.  
  40. LIBS    =    -lc -lPW    # typical System-V libs
  41. # LIBS    =    -lndir -lPW    # typical System-V libs
  42. # LIBS    =    -lndir    # typical V7 libs
  43. # LIBS    =    # typical BSD libs (none)
  44.  
  45. RANLIB    =    @:    # system doesn't have ranlib (Sys-V)
  46. # RANLIB    =    ranlib    # system has ranlib (typically V7 & BSD)
  47.  
  48. # --------------------------------------------------------------------
  49. # Compilation / Loading options:
  50. #   Choose options to generate a system as an installed product,
  51. #   for debugging, or for performance profiling.
  52. # --------------------------------------------------------------------
  53.  
  54. # CCFLG    =    -g -DDEBUG     # debugging
  55. # CCFLG    =    -p    # profiling
  56. CCFLG    =    -O3 -g    # production
  57.  
  58. # LDFLG    =    -g    # debugging
  59. # LDFLG    =    -p    # profiling
  60. LDFLG    =    # production
  61.  
  62. CC    =    hc
  63.  
  64. # --------------------------------------------------------------------
  65.  
  66. SHELL =        /bin/ksh
  67. TARGETS =    libid.a $(PROGS)
  68. PROGS =        mkid lid idx fid iid $(LIDLINKS)
  69. DESTINATION_DIR = /usr/local
  70. MANDIR =        /usr/catman/local_man/man1
  71.  
  72. LIDLINKS =     gid aid eid pid
  73. CFLAGS =    $(CCFLG) -I. $(DEFS)
  74. LDFLAGS =    $(LDFLG) libid.a $(LIBS)
  75.  
  76. OFILES =    init.o getscan.o scan-c.o scan-asm.o bsearch.o hash.o \
  77.         bitops.o basename.o gets0.o getsFF.o paths.o opensrc.o \
  78.         stoi.o uerror.o document.o bitcount.o wmatch.o bitsvec.o \
  79.         tty.o bzero.o scan-text.o cannoname.o kshgetwd.o unsymlink.o
  80.  
  81. # --------------------------------------------------------------------
  82.  
  83. all:        $(TARGETS)
  84.  
  85. libid.a:    $(OFILES)
  86.         ar rv $@ $?
  87.         $(RANLIB) $@
  88.  
  89. mkid:        mkid.o libid.a
  90.         $(CC) -o $@ $@.o $(LDFLAGS)
  91.  
  92. fid:        fid.o libid.a
  93.         $(CC) -o $@ $@.o $(LDFLAGS)
  94.  
  95. lid:        lid.o libid.a
  96.         $(CC) -o $@ $@.o $(LDFLAGS)
  97.  
  98. idx:        idx.o libid.a
  99.         $(CC) -o $@ $@.o $(LDFLAGS)
  100.  
  101. iid:        iid.o iidfun.o
  102.         $(CC) -o iid iid.o iidfun.o $(LDFLG) $(LIBS)
  103.  
  104. iid.c:        iid.y
  105.         rm -f iid.c
  106.         yacc iid.y
  107.         mv y.tab.c iid.c
  108.  
  109. iidfun.o:    iidfun.c iiddef.h
  110.  
  111. iid.o:        iid.c iiddef.h
  112.         $(CC) $(CFLAGS) -DDEF -c iid.c
  113.  
  114. $(LIDLINKS): lid
  115.         -/bin/rm -f $@
  116.         ln lid $@
  117.  
  118. install: installbin installman
  119.  
  120. installman:    fid.1 iid.1 lid.1 mkid.1
  121.         cp fid.1 iid.1 lid.1 mkid.1 $(MANDIR)
  122.         cd $(MANDIR) ; rm -f fid.1.z iid.1.z lid.1.z mkid.1.z aid.1.z \
  123.                              gid.1.z eid.1.z
  124.         cd $(MANDIR) ; chmod 666 fid.1 iid.1 lid.1 mkid.1
  125.         cd $(MANDIR) ; mantocatman fid.1
  126.         cd $(MANDIR) ; mantocatman iid.1
  127.         cd $(MANDIR) ; mantocatman lid.1
  128.         cd $(MANDIR) ; mantocatman mkid.1
  129.         cd $(MANDIR) ; rm -f fid.1 iid.1 lid.1 mkid.1
  130.  
  131. installbin: $(PROGS)
  132.         chmod 777 $(PROGS)
  133.         -mv $(DESTINATION_DIR)/mkid $(DESTINATION_DIR)/OLDmkid
  134.         -mv $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/OLDlid
  135.         -mv $(DESTINATION_DIR)/idx $(DESTINATION_DIR)/OLDidx
  136.         -mv $(DESTINATION_DIR)/fid $(DESTINATION_DIR)/OLDfid
  137.         -mv $(DESTINATION_DIR)/gid $(DESTINATION_DIR)/OLDgid
  138.         -mv $(DESTINATION_DIR)/aid $(DESTINATION_DIR)/OLDaid
  139.         -mv $(DESTINATION_DIR)/eid $(DESTINATION_DIR)/OLDeid
  140.         -mv $(DESTINATION_DIR)/pid $(DESTINATION_DIR)/OLDpid
  141.         -mv $(DESTINATION_DIR)/iid $(DESTINATION_DIR)/OLDiid
  142.         -rm -f $(DESTINATION_DIR)/iid.help
  143.         cp mkid $(DESTINATION_DIR)/mkid
  144.         cp lid $(DESTINATION_DIR)/lid
  145.         cp idx $(DESTINATION_DIR)/idx
  146.         cp fid $(DESTINATION_DIR)/fid
  147.         cp iid $(DESTINATION_DIR)/iid
  148.         cp iid.help $(DESTINATION_DIR)/iid.help
  149.         chmod 444 $(DESTINATION_DIR)/iid.help
  150.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/gid
  151.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/aid
  152.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/eid
  153.         ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/pid
  154.  
  155. clean:
  156.         rm -f $(TARGETS) *.o iid.c core a.out
  157.  
  158. id.tar:
  159.         cd ..; tar cvbf 20 id/id.tar id/*.[ch1-8] id/makefile id/TODO id/TUTORIAL
  160.  
  161. id.tar.Z:    id.tar
  162.         compress -b 14 <id.tar >id.tar.Z
  163.  
  164. id.shar:    id.shar-1 id.shar-2 id.shar-3
  165.  
  166. id.shar-1:
  167.         shar $(SHARFLAGS) TUTORIAL TODO makefile *.h *.[1-8] >$@
  168.  
  169. id.shar-2:
  170.         shar $(SHARFLAGS) [a-l]*.c >$@
  171.  
  172. id.shar-3:
  173.         shar $(SHARFLAGS) [m-z]*.c >$@
  174.  
  175. debug:
  176.     make CCFLG='-g -DDEBUG' LDFLG='-g'
  177.  
  178. ID:
  179.     rm -f ../TOOLS/ID ../EXEC/ID ../SRC/ID
  180.     cd ../TOOLS ; find ../SRC -name '*.[ch]' -print | mkid -v -
  181.     ln ../TOOLS/ID ../EXEC/ID
  182.     ln ../TOOLS/ID ../SRC/ID
  183.  
  184. TAGS:
  185.     rm -f ../TOOLS/TAGS ../EXEC/TAGS ../SRC/TAGS
  186.     cd ../TOOLS ; find ../SRC -name '*.[ch]' -print | etags -twS
  187.     ln ../TOOLS/TAGS ../EXEC/TAGS
  188.     ln ../TOOLS/TAGS ../SRC/TAGS
  189.