Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site enea.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!mcvax!enea!kim From: kim@enea.UUCP (Kim Walden) Newsgroups: net.lang.c,net.unix,net.unix-wizards Subject: Re: make depend Message-ID: <853@enea.UUCP> Date: Wed, 10-Apr-85 09:11:51 EST Article-I.D.: enea.853 Posted: Wed Apr 10 09:11:51 1985 Date-Received: Sat, 13-Apr-85 05:14:36 EST Reply-To: kim@enea.UUCP (Kim Walden) Distribution: net Organization: ENEA DATA, Sweden Lines: 59 Xref: watmath net.lang.c:4994 net.unix:4227 net.unix-wizards:12793 In article <9201@rtp47.UUCP> throop@rtp47.UUCP (Wayne Throop) writes: >> ... >> The solution is to use ONLY source files as a basis for >> dependency generation. >> ... >> Kim Walden > Kim's solution seems quite good given the way make works. If you are > willing to change make's model of the world, another solution becomes > available. In particular, if a make-like tool allowed dependencies to > be specified dynamically, the problem of intermediate files being needed > before make is invoked (to allow dependencies to be discovered) becomes > a non-problem. > > There are many ways for make to be modified to allow for dynamic inputs, > but suppose a syntax something like > > foo.o: foo.c (foo.c; find_includes foo.c) > cc -c foo.c > foo.c: foo.x > make_c_from_x foo.x > > The parenthesized text specifies a list of inputs to the "command" > at the end of the list. The output of the command will be a list of > include files, and the effect is as though that list of files had been > supplied instead of the parenthesized text. What make would do for > this makefile fragment would be to invoke make_c_from_x, then invoke > find_includes (discovering any include file dependencies of foo.c), > and then cc foo.c, producing foo.o. > > ... I do not agree with your proposal, because: 1. Very few people really understand the implications of make's basic model as it is, so the least thing we would want to do is to complicate it further. 2. It would not solve the problem anyway. In the example, make itself forces the generated file foo.c up-to-date before invoking a command to extract include lines from it. But an extraction command will have to deal with nested includes, and when an INCLUDED file is a generated file, the command cannot force it up-to-date, and hence cannot proceed to search the file for more include lines. The hen-and-egg syndrome is still there, and cannot be circumvented. -- Kim Walden ENEA DATA Sweden UUCP: {seismo,decvax,philabs}!{mcvax,ukc,unido}!enea!kim ARPA: decvax!mcvax!enea!kim@berkeley.arpa mcvax!enea!kim@seismo.arpa