[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Help with odd dependency

From: Smith, Matthew X
Subject: RE: Help with odd dependency
Date: Wed, 7 Mar 2007 08:59:20 -0800


From: address@hidden [mailto:address@hidden On Behalf Of Smith, Matthew X
Sent: Friday, March 02, 2007 9:50 AM
To: address@hidden
Subject: Help with odd dependency

First of all, I'm using Mingw32-make version 3.80.

The CodeWarrior compiler we are using has this really odd quirk when it spits out a dependency file for a precompiled header.  Their precompiled headers have a .mch extension, and yet the dependency that is generated by the compiler has a target of a .o file.  For example, in the file Math.d I have:

Math.o: Math.pch \
        foo.h \
        bar.h \

But the precompiled file generated is actually named Math_Debug.mch, Math_Release.mch, etc.

So, what I've done is a bit of hackery.  I created a rule which makes the .mch file dependent on the .o file, then I have a rule which says how to build the .o file, and then read in the above .d file to fill in the dependencies.  The final hack is to then copy the generated .mch file to .o to satisfy the rule.

Math_Debug.mch: Math.o

Math.o: %.o:
        @compile the .mch file
        @copy Math_Debug.mch Math.o

-include Math.d

Now, the theory is that when I read in the above .d file (this is done at the end of the makefile), the dependencies for the Math.o file will fill out the rule.  By and large this seems to work, but I'm wondering if there is a better way of accomplishing this?  It seems so roundabout and convoluted that I really don't trust it much.  I'm actually to the point where I'm thinking that I run a perl script to parse the generated dependency file for the precompiled header and change the Math.o to Math_Debug.mch

Any ideas?


Matt Smith

reply via email to

[Prev in Thread] Current Thread [Next in Thread]