Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!sgi!brendan@illyria.wpd.sgi.com From: brendan@illyria.wpd.sgi.com (Brendan Eich) Newsgroups: comp.sys.sgi Subject: Re: Makefile madness Message-ID: <92000@sgi.sgi.com> Date: 18 Mar 91 20:46:49 GMT References: <9103161639.AA00820@karron.med.nyu.edu> Sender: guest@sgi.sgi.com Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 38 In article <9103161639.AA00820@karron.med.nyu.edu>, Dan Karron@UCBVAX.BERKELEY.EDU writes: > > I want to make a standard make/smake/pmake rule for the depend: pseudotarget. > > Then I want to include the list of target rules generated by makedepend, but > if the file generated by makedepend is not found, make aborts. Now how > can I get around this circular problem: > > If Makedepend is not found as an include file, just run mkdepend instead of > aborting! > > Also, how can I make all of the .c or .h files a dependency for depend : ? Take a look at /usr/include/make/commonrules (and its predecessor in the same directory, commondefs). These files are used by almost all SGI makefiles. Commonrules contains a big depend rule with some gory SGI-specific multipleple-product-handling code in it, and a separate incdepend rule that relates a timestamp file to the source files (the .c and .h files you mention). We keep incdepend separate from depend so that one can re-make all dependencies without having to remove the timestamp file. Commonrules wants you to list your source files in CFILES, C++FILES, &c. It uses SGI's "sinclude" extension to make(1) (also supported by smake) to include the generated make dependencies from a separate file if it exists, and to silently proceed if the file to include can't be found. Thus, you could write a depend rule that tests for the existence and non-emptiness of this Makedepend file and run mkdepend if (despite the fact that make already performed the sinclude) no such file existed. But you would then want make to re-read the makefile and re-sinclude the new dependencies. This would suggest bailing out with a word of advice to the user, or a recursive invocation of $(MAKE). Are you using mkdepend(1), X's makedepend, a combination of these, or something else? /be