From: lehman@george.arc.nasa.gov (John Lehman -- GDP)
Subject: RCS and imake. Was: Re: Summary: SCCS vs RCS
Summary: Here's one way to integrate make and RCS.
Keywords: RCS, imake, make, configuration, build
Organization: RIACS, NASA Ames Research Center
Distribution: comp.software-eng
Date: Mon, 14 Sep 92 22:03:43 GMT

Hi, I just read Andersen's summary; thanks for the
information!  I got some valuable help a few months
ago from this newsgroup, integrating RCS and make.
I also had briefly weighed the merits of SCCS and RCS.
I chose RCS because it's free and comes as source, and
because almost everyone I've read or talked with prefers 
RCS over SCCS.

Incidentally UC Santa Cruz Ext. in Santa Clara, Calif. 
has or had a course in which RCS and SCCS are both 
presented (along with make, yacc, lex, and a few other 
topics).

One of my correspondents (B.E.) suggested that I look 
into "imake", and I'm glad I did.

I have revised some Makefiles so that they will access
files from RCS.  I use ordinary make, not gnu make
(gnu make knows about RCS so that would have been easy;
but it is not feasible to get all sites to run gnu make)
-- and I have not used any special features of make -- 
any solution I come up with has to run on a variety of 
Unix machines (and should be easy for my team-mates to 
understand).

To begin with, consider the RCS files; for a file
called "filename", the corresponding RCS file (in which
are stored versions of "filename") is "filename,v".
You have a choice of either storing all the RCS files
prog1.c,v prog2.c,v ...  in the same directory as
prog1.c   prog2.c   ...  or you can put the RCS files
into a subdirectory called RCS.

If the RCS files are in the "same" directory, the
directory is cluttered.

If the RCS files are in a subdirectory called RCS,
then you (or rather, "I") have a problem when writing
the Makefiles:  if you define suffix rules (for "make")
(as suggested in _Managing_Projects_With_Make_ by
Andrew Oram and Steve Talbott, Dec. '91, page 28)
telling how to make "filename" out of "filename,v",
these suffix rules only work if the "filename,v" is
in the current directory!  (Remember, this is assuming
that gnu make is not used, and that only the most
generic features of make are used (no "%" pattern 
matching is allowed)).

So I elected to write out all the rules (in the Makefiles)
explicitly (no suffix rules are used).  This makes really
long Makefiles; but that's where imake comes in.  Using
imake, you can write an Imakefile, which is shorter than
the Makefile, and use Imakefile to generate the Makefile.

Aside from Imakefiles being shorter than Makefiles,
there are a couple of other advantages to imake, stemming
from the fact that imake uses macros (it understands
multi-line cpp macros):

(1) you can define a variable (I call it USE_RCS)
    to tell imake whether to generate a Makefile
    which uses RCS or (alternatively) a Makefile
    which doesn't use RCS.  This can be handy if
    some of your customers don't use RCS (but you
    want to maintain only the one set of Imakefiles) --
    or for whatever reason you might want to do some
    work without RCS getting in the way.

(2) you can define the "RCS subdirectory" to be
    anywhere you wish -- such that all team members
    can automatically build the product in their 
    home directories using one copy of RCS files 
    which are in a central location (no "links"
    necessary).
   
I'm still working on this but so far it works fine.
I expect to post more on this sometime after Sept. 30
(end of fiscal year -- a busy time).  Imake is unnecessarily
hard to learn (not documented well enough) but that's one 
of the things I would post about (perhaps in alt.uu.future,
where they accept lesson material -- uu is usenet university)
-- if there's interest.

This work of mine deals with a master makefile with about
10 sub-makefiles.

lehman@ames.arc.nasa.gov