home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / MakeSccsRCS < prev    next >
Encoding:
Text File  |  1994-08-02  |  5.6 KB  |  176 lines

  1.          Makefile and SCCS/RCS on SGI Computer Systems
  2.          ---------------------------------------------
  3.  
  4. TABLE OF CONTENTS:
  5.  
  6. 1. Make(1)  and SCCS
  7. 2. Pmake(1) and SCCS
  8. 3. Make(1)  and RCS
  9. 4. Pmake(1) and RCS
  10. 5. ftp location of GNUmake
  11.  
  12. ------------------------------------------------------------------------------
  13. ------------------------------------------------------------------------------
  14. 1. Make(1) and SCCS
  15.  
  16. Some customers have found that when porting to SGI, make(1) does not work the
  17. same as they are familiar.  For example, the SVR4 make(1) that SGI ships 
  18. requires SCCS files be in the current directory even if using the macro VPATH, 
  19. unlike public domain gnumake (reportedly).  Make won't use VPATH to find 
  20. source (dependency) files where the only connection between the source and 
  21. target file is an internal make rule.
  22.  
  23. Also, according to the make(1) man page:
  24.      
  25.      If the macro VPATH is set and contains a colon separated list of 
  26.      directories, then if a dependency is not found in the current directory 
  27.      it is searched for in the specified alternate directories.  Targets are 
  28.      treated similarly.  Note that VPATH does not affect any of the internal 
  29.      macros (e.g $@, $*, etc.).  This means that VPATH is primarily useful 
  30.      when the source is in the current directory and the objects are in other 
  31.      directories.
  32.  
  33. A solution that some people use to retain the ability for make(1) to compare 
  34. the time stamp against a source file and its SCCS archive existing in a 
  35. different directory is shown below.
  36.  
  37. Create a Makefile that contains:
  38. ------------------------------
  39. # Makefile for testing make(1) and sccs(1) files in a different directory
  40.  
  41. SHELL=/bin/sh
  42.  
  43. CFILES = hello.c
  44. OBJECTS = hello.o
  45.  
  46. hello:  $(OBJECTS)
  47.         cc $(OBJECTS) -o hello
  48.  
  49. $(CFILES): SCCS/s.$$@
  50.         sccs get -s $@
  51. ------------------------------
  52.  
  53. Note that the white space before the "cc..." and "sccs get ..." above needs 
  54. to be a tab character.  Now, try the following two tests to see that the 
  55. latest revision of hello.c is always used during the make.
  56.  
  57. test1:
  58. -----
  59. echo "main() { printf ("\""Hello world.\\n"\""); }" > hello.c
  60. mkdir SCCS
  61. sccs create hello.c
  62. rm -f hello.c
  63. make
  64.  
  65.  
  66. test2:
  67. -----
  68. mv hello.c hello.c.bak
  69. sccs edit hello.c
  70. echo "/* comment */" >> hello.c
  71. sccs delta -y hello.c
  72. mv hello.c.bak hello.c    
  73. make 
  74.  
  75. In test2, use mv instead of cp to preserve time stamp of older revision.
  76.  
  77.  
  78. ------------------------------------------------------------------------------
  79. 2. Pmake(1) and SCCS
  80.  
  81. Pmake is a more powerful make utility, unfortunately as mentioned on the 
  82. pmake(1) manual page, pmake doesn't have make(1)'s tilde rules for SCCS files.
  83.  
  84.  
  85. ------------------------------------------------------------------------------
  86. 3. Make(1)  and RCS
  87.  
  88. The same reason that a source file needs to be in the same directory as its 
  89. SCCS file affects make(1) and RCS files.  Pmake is preferred in order to have 
  90. the make compare the time stamp against a source file and its RCS archive 
  91. existing in a different directory.  See the next section for an example of how
  92. to easily use pmake for this purpose.
  93.  
  94.  
  95. ------------------------------------------------------------------------------
  96. 4. Pmake(1) and RCS
  97.  
  98. With pmake it is easy to "make" the latest revision of a source file under RCS 
  99. revision control where its rcs file is in another directory. 
  100.  
  101. From the pmake(1) manual page:
  102.  
  103.      pmake also supports the notion of multiple directories in a more
  104.      flexible, easily-used manner than has been available in the past.  You
  105.      can define a list of directories in which to search for any and all files
  106.      that aren't in the current directory by giving the directories as sources
  107.      to the .PATH target. The search will only be conducted for those files
  108.      used only as sources, on the assumption that files used as targets will
  109.      be created in the current directory.
  110.  
  111.      The line
  112.         .PATH : RCS
  113.      would tell pmake to look for any files it is seeking (including ones made
  114.      up by means of transformation rules) in the RCS directory as well as the
  115.      current one. Note, however, that this searching is only done if the file
  116.      is used only as a source in the makefile; the file cannot be created by
  117.      commands in the makefile.
  118.  
  119.  
  120. To see that pmake compares the time stamps of a file under revision source 
  121. control with its rcs file in another directory, do the following.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. Create a Makefile that contains:
  132. ------------------------------
  133. #!/usr/sbin/pmake
  134. # Makefile for testing pmake(1) and rcs(1) files in a different directory.
  135.  
  136. SHELL=/bin/sh
  137. .PATH : RCS
  138.  
  139. hello:  hello.o
  140.         cc hello.o -o hello
  141.  
  142. hello.o: hello.c
  143.         cc -c hello.c
  144. ------------------------------
  145.  
  146. Note that the white space before the "cc..." above in both places needs
  147. to be a tab character.  Now, try the following two tests to see that the 
  148. latest revision of hello.c is always used during the make.
  149.  
  150. test1:
  151. -----
  152. echo "main() { printf ("\""Hello world.\\n"\""); }" > hello.c
  153. mkdir RCS
  154. echo "Testing make and rcs" | ci hello.c
  155. pmake  [or "make"; make works because of the first line in the Makefile]
  156.  
  157. test2:
  158. -----
  159. mv hello.c hello.c.bak
  160. co -l hello.c
  161. echo "/* comment */" >> hello.c
  162. ci -m"Added Comment" hello.c
  163. mv hello.c.bak hello.c
  164. pmake 
  165.  
  166. In test2, use mv instead of cp to preserve time stamp of older revision.
  167.  
  168.  
  169. ------------------------------------------------------------------------------
  170. 5. ftp location of gnumake
  171.  
  172. SGI makes no claims on the availability or quality of gnumake.  Gnumake
  173. is reported to not require the SCCS file be in the same directory as the 
  174. source in order for the gnumake to succeed.  The public domain gnumake  
  175. can be ftp-ed via anonymous ftp login from prep.ai.mit.edu:/pub/gnu.
  176.