help-make
[Top][All Lists]
Advanced

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

Re: Different processing to achive same end result ? Can it be done.


From: Paul Smith
Subject: Re: Different processing to achive same end result ? Can it be done.
Date: Fri, 22 Aug 2008 12:39:46 -0400

On Fri, 2008-08-22 at 11:17 -0500, EXT-Pennington, Dale K wrote:
> Class 1 needs no editing, and is handled by the implicit rule :
> 
> %C.h %S.h %C.C %S.C : %.idl
>         <invoke idl compiler>
> 
> Class 2 needs the editing and the proceesing is more like
> 
> %C_gen.h %S.h %C.C %S.C : %.idl
>         <invoke idl compiler with option to produce alternate name for
> C.h file>
> 
> Run comparison script on the %C_gen.h to produce the %C.h file or
> generate an error.

> The question is, can I set up one make file to handle both styles of
> processing ? Or should I create make subfiles and just invoke them
> from the main makefile when one of the IDL files needs updating ?

I think it might be easier, if possible, to do it the other way: have
the IDL compiler always generate the the %C.h file, then have a separate
rule that converts the %C.h file to %C_gen.h, and include the %C_gen.h
file in your source code.  Then, if you have automated dependency
tracking, this will just work magically (unless I'm forgetting
something) and you won't need two different rules for generating IDL.

If you really need to have the code include the original %C.h file, then
the way you can do this depends on what your other rules look like:
mainly on what the prerequisites look like.  The problem is that make
ALWAYS chooses (a) the first matching pattern, and (b) the simpler
matching pattern (that is, if there is a rule that directly creates the
files you want it will always choose that rather than using one that
requires an intermediate step).

That means that your second pattern will never be invoked, because a
target with prerequisites on %C.h will always choose the first (simpler)
rule rather than the second (requires two steps) rules.

The only way to do this is to use static pattern rules for those targets
that require hand-editing, to _force_ them to use the _gen version...
but IIRC static pattern rules cannot have multiple targets so that means
you're back to using a sentinel file to combine them.

It can be done but you'll run into a lot of obstacles.  If you can get
your code to include the %C_gen.h versions your life will be a LOT
simpler.





reply via email to

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