Dan Karron@UCBVAX.BERKELEY.EDU (03/17/91)
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 : ? Cheers! dan. +-----------------------------------------------------------------------------+ | karron@nyu.edu (E-mail alias that will always find me) | | Fax: 212 263 7190 * Dan Karron, Research Associate | | . . . . . . . . . . . . . . * New York University Medical Center | | 560 First Avenue \*\ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> <your-number-here> | | (212) 263 5210 \***\_________________________________________ | | Main machine: karron.med.nyu.edu (128.122.135.3) IRIS 85GT | +-----------------------------------------------------------------------------+
brendan@illyria.wpd.sgi.com (Brendan Eich) (03/19/91)
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
sweetmr@SCT60A.SUNYCT.EDU (michael sweet) (03/19/91)
What I do in my makefiles is something like the following: OBJS = .o files... .. depend: $(OBJS:.o=.c) makedepend -- $(CFLAGS) -- $(OBJS:.o=.c) By using the modifier on the OBJS variable, I only have to maintain a single list of object files. For automated RCS updates, I also have a list of header files which goes along with the OBJS... Also, if you do mixed-language work, you can define say FOBJS for FORTRAN stuff, and COBJS for C stuff. Oh, if you _do_ do mixed-language programming, I have a little shell script which will generate FORTRAN dependencies for you. It works in conjunction with makedepend (for any C files) to generate a new dependency list. -Mike Sweet ------------------------------------------------------------------------------ "The only TASC (315) 724-1100 (voice) truth is that 555 French Road (315) 724-2031 (fax) there are no New Hartford, NY 13413 Internet: sweetmr@sct60a.sunyct.edu truths, only beliefs." Delphi: DODGECOLT ------------------------------------------------------------------------------