rdh@sun.uucp (Robert Hartman) (03/04/88)
In article <570003@hpsemc.HP.COM> bd@hpsemc.HP.COM (bob desinger) writes: >Rit Chiang (chiang@m2c.ORG) writes: >> 1) Since SCCS would not let you do hierarchy, is there anything out >> there that can traverse the tree structure of SCCS directories. I have >> implemented a recursive csh script that would take any SCCS commands >> and traverse down the tree. However, I have noticed the performance >> is awful. > >The csh may be dragging you down ... Another approach is to use make in a recursive fashion, in conjunction with SCCS. A very simplistic example would be a program that depends on a library which is maintained in a separate subdirectory. Perhaps that library, in turn, also depends on objects from a lower-level library. The topmost makefile, ./Makefile, would invoke a make command to (re)build the library, say `liba.a', but in the `liba' directory. That nested make command would be run in liba, and use the makefile there to build the library. The liba makefile would also contain a nested make command, to build the lower-level library, say `libb.a', in liba/libb. Finally, the makefile in liba/libb would contain instructions for building libb.a. Each makefile would also contain a rule for building .c files from the corresponding s.file. Since .o files can be built using suffix rules, there is no need to specify rules for them. -bob. ========== ./Makefile ============ prog: prog.o liba.a cc -o prog x.o liba.a prog.o: prog.c # show that prog.o depends on prog.c, so prog.c gets built prog.c: SCCS/s.prog.c -sccs get -s prog.c liba.a: liba/liba.a -ln liba/liba.a liba.a liba/liba.a: FORCE -cd liba ; make liba.a FORCE: # hack to force the nested make to run, even though liba/liba.a exists # if it's up to date wrt its sources in liba, the nested make will # simply return. ========== liba/Makefile ============ liba.a: x.o y.o z.o libb.a -mkdir tmp -cd tmp ; ar xv ..libb.a # extract objects from libb.a in tmp -cp x.o y.o z.o tmp # copy local objects to tmp -cd tmp ; ar rv liba.a ; mv liba.a .. # collate all objects into liba.a -rm -rf tmp x.o y.o z.o: $$(@:.o=.c) # fancy footwork to show that ?.o depends on ?.c x.c y.c z.c: SCCS/s.$$@ # fancy footwork to show ?.c depends on SCCS/s.?.c -sccs get -s $@ libb.a: libb/libb.a -ln liba/liba.a liba.a libb/libb.a: FORCE -cd libb ; make libb.a FORCE: ======================================