kdb@chinet.chi.il.us (Karl Botts) (10/22/89)
In article <1989Oct12.232837.5143@tcsc3b2.tcsc.com> prs@tcsc3b2.tcsc.com (Paul Stath) writes: > >Of course with a little ingenuity, make will also handle RCS. Just use > $ make -fp < /dev/null 2>/dev/null >rules.c >to get a list of the default inference rules. Then hack out the ones that don't >have a '~' in them. Replace the ~ with a ',v' place them in a file called >rcs.rules or something and use the make include directive like this: > >include "/usr/lib/rcs.rules" > >This will effectively give you additional rules to use RCS. The only drawback >is that make only looks for {makefile, Makefile, s.makefile or s.Makefile} >(Guess not everything can be perfect.) > >This means that you have to extract a copy of the makefile before you can >run make. Which is not a problem for me because I usually need to retreive >old as well as current versions. (Old retrieves sure are _fast_ in RCS!) I use the appended ksh script as a wrapper for Make; it effectively makes Make read a couple of setup files before it reads the local makefile. With this approach you can configure Make pretty much however you like; at one point I was using it so that it invoked Make with "make -r", disabling all the internal rules, and then haveing a hacked set of rules originally produced with "make -fp" in the per-system config file. I decided that this wasn't a good idea in the long run, because it would lead me into the temptation to hack the rules so much that nobody else would be able to run my makefiles. I therefore use the config files to selectively replace a few rules and macros, so that most usenet makefiles run stock, except that the compiler used is gcc and the special Unix PC shared lib linker "shcc" is used instead of ld (and it finds GNULIB). This is also a big convenience with one-file quickies, which now compile and link with the shared lib and everything with no local makefile. My point is that you could make Make handle RCS by this approach, and it would be transparent to the local makefile. Putting "include" directives in all makefiles is an annoyance and renders them unportable. While I'm on the subject, if you run strings on /bin/make you will see, right next to the strings for the other environment variables Make uses, a string "Makeincludes". This sounded to me like an envar which lists files Make should read at startup before reading the local makefile; however, it doesn't work. It's a shame that unix Make doesn't have such a thing; most other equivalent programs on other opsys's do. This would obviate the necessity for the kludge described above. One other note; it is possible to use a ksh (or csh, I'm sure, but I haven't done it) alias to get the file appended here to run instead of puting it ahead of /bin/make in the PATH, as I do. This is more complex than would at first appear, however; if the alias is not exported then if you have a Make command in a shell script the alias won't be recognized. This may or may not be desirable. You must also consider the impact on recursive invokations of Make via $(MAKE). I decided the wrapper script was less hassle. The wrapper will now always get used unless the recursive invokation of make is explicitly /bin/make; I assume that if somebody elses makefile has /bin/make in it there may well be a reason for protecting the makefile against just such kludges as the wrapper. Such is the case, for instance, with the makefile distributed with elm. ###### cut here ######## # This shell script is essentially a preprocessor for /bin/make; it sets up # some envars and sees that make reads a per-system and a per-user makefile # before the local makefile. It is highly pragmatic. # ****** Environment ********* #if [ -n "$INC" -a -z "$INCS" ] #then #: #fi MAKEFILES="" # This file and the one mentioned at the end of this file are apparently used in # the process of building the kernel for the AT&T 3b1 and are supplied with # the development kit; without the kernel source they are of limited # usefulness. They do contain equates for such items as the files needed to # link with the shared library, and presumably all 3b1 owners who have the C # compiler have them, so they might be useful portability-wise. I have not # found them worth bothering with in day-to-day operations. # if [ -n "$MAKEINC" ] # then # if [ -r $MAKEINC/Makepre.h ] # then # MAKEFILES="$MAKEFILES -f $MAKEINC/Makepre.h" # fi # fi # As many of these as are found get read, in the order listed. for fn in ${ETC:-/etc}/makerc $HOME/.makerc do if [ -r $fn ] then MAKEFILES="$MAKEFILES -f $fn" fi done # Only the first of these found (if any) gets read. for fn in makefile Makefile s.makefile s.Makefile do if [ -r $fn ] then MAKEFILES="$MAKEFILES -f $fn" break; fi done # if [ -n "$MAKEINC" ] # then # if [ -r $MAKEINC/Makepost.h ] # then # MAKEFILES="$MAKEFILES -f $MAKEINC/Makepost.h" # fi # fi /bin/make $MAKEFILES "$@"