Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!mts.rpi.edu!Garance_Drosehn From: Garance_Drosehn@mts.rpi.edu (Garance Drosehn) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW Make file weirdness Message-ID: Date: 3 Dec 90 20:51:47 GMT References: <11406@goofy.Apple.COM> Distribution: na Organization: Rensselaer Polytechnic Inst. Lines: 43 Nntp-Posting-Host: gilead.its.rpi.edu In article <11406@goofy.Apple.COM> mdtaylor@Apple.COM (Mark Taylor) writes: > But then it occurs to me that, say, file2.h itself #includes a basic > header file, called, say, basic.h. I would like my makefile to reflect > this dependency. So I create one dependency rule in my makefile that > says, simply: > > file2.h basic.h > > This doesn't work as I expect. After the first make using this new > makefile, then no matter what I do (or don't do), all the .c files > that include file2.h are always recompiled. Even if I start a second > make immediately after the first, without changing anything, all > my .c files that include file2.h are recompiled! What that rule basically says is "make file2.h if it has not changed since basic.h has changed". However, you do nothing to file2.h when doing this, so the last-modified time of it does not change. Thus, the next time you make it, it will still be true that file2.h has not changed since basic.h has changed. You can either do something with Setfile to change the last-modified time of file2.h, or use a different tactic. My preference is to use a different tactic, because strictly speaking the file file2.h does *not* depend on basic.h, it's just that other files which depend on file2.h may also depend on basic.h. You'll end up with a file2.h that is constantly "changing", even though you may never change any of the text actually in it. The different tactic I would use is to add a variable in your processing. Eg: FILE2.Hs = File2.h Basic.h And then, in whatever dependencies where you currently use "file2.h" change that to "{FILE2.Hs}". Effectively this is the same as what you did by adding Basic.h to each dependency, except that it makes it clearer *why* it's being added to them. It's also easier to change (in case you change File2.h to include some other files). Garance_Drosehn@mts.rpi.edu ITS Systems Programmer Rensselaer Polytechnic Institute; Troy, NY. USA