home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / sccs_b / part01 / Make_Templ next >
Encoding:
Text File  |  1990-09-20  |  6.9 KB  |  232 lines

  1. #  @(#)Makefile.
  2. #
  3. #    Makefile        (a Makefile template)
  4. #
  5. #    PROGRAM(s)  : 
  6. #
  7. #    LIBRARY(s)  : 
  8. #
  9. #    DATE        : 
  10. #
  11. #    AUTHOR      : W.Hatch 
  12. #
  13. #    PROJECT     : WEH Software
  14. #            
  15. #    COMPANY : Coleman Research
  16. #          14504 Greenview Drive Suite 500
  17. #          Laurel, Maryland 20708
  18. #          Phone (301)470-3839
  19. #          FAX (301)776-5461
  20. #
  21. #
  22. #    This Makefile template assumes that the following shell scripts
  23. #    are installed in one of the user's PATH directories
  24. #
  25. #        sccs_admin  arg1  arg2  ...
  26. #        sccs_get   arg1  arg2  ...
  27. #        sccs_delta arg1  arg2  ...
  28. #        sccs_edit  arg1  arg2  ...
  29. #        sccs_install arg1  arg2  ..
  30. #
  31. #    where arg1  arg2  ....  are the names of SRC, SCRIPT and HEADERS
  32. #    files on which the sccs operations will be performed.
  33. #
  34. #    These scripts are used to "hide" the differences between System V.3
  35. #    and BSD 4.3 SCCS utility interfaces.
  36. #--------------------------------------------------------------------------
  37.  
  38. #--------------------------------------------------------------------------
  39. #  1. define symbolic constants
  40. #
  41. #    root directory for this activity
  42. ROOT=/usr/local
  43. #
  44. #    relocatable library directory
  45. LIBDIR=$(ROOT)/lib
  46. #
  47. #    target directory for executables
  48. BIN=$(ROOT)/bin
  49. #
  50. #    documentation target directory
  51. MAN=$(ROOT)/man
  52. MAN1=$(MAN)/man1
  53. MAN3=$(MAN)/man3
  54. #
  55. #    target directory for header files
  56. INCLUDE=$(ROOT)/include
  57. #
  58. #    list of relocatable libraries required in link step
  59. LIBS=$(ROOT)/lib/libdbug.a \
  60.      /usr/local/lib/gcc-gnulib /lib/libm.a
  61. #
  62. #    list of header files, subject to change, on which *.o depend
  63. HEADERS=
  64. #
  65. #    list of source files to be compiled
  66. SRC= 
  67. #
  68. #    list of object files to be linked
  69. OBJ=
  70. #
  71. #    compile options
  72. CC=cc
  73. #CC=gcc
  74. AS=/bin/as
  75. #LD=/bin/ld /lib/crt0.o
  76. #LD=gcc
  77. LD=/bin/ld
  78. AR=/bin/ar
  79. GCFLAGS=-W -Wunused -Wcomment -Wshadow  -c -g -I$(INCLUDE) -B/usr/local/lib/gcc-
  80. CFLAGS=-g -I$(INCLUDE) -I./ -DM_XENIX
  81. #
  82. #    link/load flags
  83. LFLAGS=
  84. #
  85. #    executable file to be created (assume only 1)
  86. EXE=
  87. #
  88. #    list of shell script files maintained with this makefile
  89. SCRIPT=
  90. #
  91. #    list of manual pages
  92. MANPAGES=
  93. #
  94. #    list of all junk files that might occur in this directory
  95. JUNK=core a.out JOURNAL LINT paste.txt error.log dbg_jnl* CHECK CCHK CFLOW \
  96.     MCCABE KDSI *PRINT GLINT CXREF TJ *.s tr.*
  97.  
  98. #pretty_printer= *** YOUR FAVORITE PRETTY PRINTER *****
  99. #--------------------------------------------------------------------------
  100. #  2. link and load to create the executable
  101. #--------------------------------------------------------------------------
  102. $(EXE):  $(OBJ)  $(LIBS)
  103.     $(CC) -o $(EXE) $(OBJ) $(LIBS)
  104.  
  105. #--------------------------------------------------------------------------
  106. #  3. install all objects of this make
  107. #--------------------------------------------------------------------------
  108. install:  $(EXE) $(SCRIPT) 
  109.     strip $(EXE)
  110.     for i in $(EXE) $(SCRIPT); do \
  111.         chmod ugo+x $$i; \
  112.         cp $$i  $(BIN); \
  113.     done
  114.     rm $(EXE)
  115.  
  116. #--------------------------------------------------------------------------
  117. #  4. lint for syntax check on all C source, headers
  118. #--------------------------------------------------------------------------
  119. LINT:  $(SRC)  $(HEADERS)
  120.     lint  -DM_XENIX -I./ -I$(INCLUDE) $(SRC) >LINT 2>LINT2
  121.     cat LINT2 >> LINT
  122.     rm LINT2
  123.  
  124. GLINT: $(SRC) $(HEADERS)
  125.     gcc $(GCFLAGS) $(SRC) >GLINT 2>GLINT2
  126.     cat GLINT2 >> GLINT
  127.     rm -f GLINT2
  128. #--------------------------------------------------------------------------
  129. #  5. tidy up by getting rid of all junk files
  130. #--------------------------------------------------------------------------
  131. tidy:
  132.     rm -f $(JUNK)
  133.  
  134. #--------------------------------------------------------------------------
  135. #  6. clean up by removing all vestiges of previous makes
  136. #--------------------------------------------------------------------------
  137. clean:  tidy admin delta
  138.     rm -f $(EXE)
  139.     rm -f *.o *.s
  140.  
  141. #--------------------------------------------------------------------------
  142. #  7. uninstall all installed targets of this make
  143. #    (remove any installed manual pages also)
  144. #--------------------------------------------------------------------------
  145. uninstall:  clean
  146.     for i in $(EXE) $(SCRIPT); do; \
  147.         rm -f $(BIN)/$$i; \
  148.     done
  149.     for i in $(MANPAGES); do; \
  150.         rm -f $(MAN1)/$$i; \
  151.     done
  152.  
  153. #--------------------------------------------------------------------------
  154. #  8. individual dependencies for C source files as per the following 
  155. #     example:
  156. #
  157. #    foobar.c:  SCCS/s.foobar.c
  158. #        sccs_get foobar.c
  159. #
  160. #--------------------------------------------------------------------------
  161.  
  162. #--------------------------------------------------------------------------
  163. #  9.  individual dependencies for relocatable object files as per
  164. #    the following example:
  165. #
  166. #    foobar.o:  foobar.c  $(HEADERS)
  167. #        cc -O -c foobar.c
  168. #
  169. #--------------------------------------------------------------------------
  170. #.c.o:
  171. #    $(CC) $(CFLAGS) -c -S $< 
  172. #    $(AS) $*.s
  173.  
  174. $(SRC) $(HEADERS):
  175.     sccs_install $(SRC) $(HEADERS)
  176.  
  177. #--------------------------------------------------------------------------
  178. #  10. individual dependencies for shell script and on line documentation
  179. #      as per the following example:
  180. #
  181. #    textfile: SCCS/s.textfile
  182. #        sccs_get textfile
  183. #
  184. #--------------------------------------------------------------------------
  185. #--------------------------------------------------------------------------
  186. #  11. initialize SCCS administration of the source files
  187. #--------------------------------------------------------------------------
  188. admin:
  189.     sccs_admin  $(SRC) $(HEADERS) $(SCRIPT) $(MANPAGES)
  190.  
  191.  
  192. #--------------------------------------------------------------------------
  193. #  12. edit - get all of the source files ready to edit
  194. #--------------------------------------------------------------------------
  195. edit:
  196.     sccs_edit $(SRC) $(SCRIPT) $(HEADERS) $(MANPAGES)
  197.  
  198. #--------------------------------------------------------------------------
  199. #  13. get - get all of source files in read only form
  200. #--------------------------------------------------------------------------
  201. get:
  202.     sccs_get  $(SRC) $(SCRIPT) $(HEADERS) $(MANPAGES)
  203.  
  204. #--------------------------------------------------------------------------
  205. #  14. delta - SCCS delta all source
  206. #--------------------------------------------------------------------------
  207. delta:
  208.     sccs_delta  $(SRC) $(SCRIPT) $(HEADERS) $(MANPAGES)
  209.  
  210. #--------------------------------------------------------------------------
  211. # 14. print all source files
  212. #--------------------------------------------------------------------------
  213. print: $(SRC) $(HEADERS) LINT CFLOW CXREF
  214.     ${pretty_printer} CFLOW $(HEADERS) $(SRC) Makefile CXREF LINT
  215.  
  216. #--------------------------------------------------------------------------
  217. # 16. manual page installation
  218. #    copy manual pages to $(MAN1) and $(MAN3) 
  219. #--------------------------------------------------------------------------
  220. manual: $(MANPAGES)
  221.     cp $(MANPAGES) $(MAN1)
  222.  
  223. #--------------------------------------------------------------------------
  224. # 18. static analysis of code
  225. #--------------------------------------------------------------------------
  226. CFLOW: $(SRC) $(HEADERS)
  227.     cflow -I$(INCLUDE) -I./ -ix $(SRC) >CFLOW
  228.  
  229. CXREF: $(SRC) $(HEADERS)
  230.     cxref -I$(INCLUDE) -I./ -DM_XENIX $(SRC) >CXREF
  231.  
  232.