[Omake] Re: Building in subdirectories and variant builds revisited

Aleksey Nogin anogin at hrl.com
Tue Jun 19 09:27:41 PDT 2007


On 18.06.2007 22:16, Jesper Eskilson wrote:

>> The problem is that some ill-behaved programs are hard to specify.
>> Here are some example behaviors of ill-behaved programs.
>>
>>     - The target and source file must be in the same directory (like
>> "cc -c" without a -o option),
>>
>>     - Programs where the sources can't be specified in the rule.
>> ocamldep is an example.
>>
>>     - Programs where the set of targets is not known ahead of time.
>> For example, texinfo generates a bunch of files xxx-1.info,
>> xxx-2.info, ... but you can't predict how many files it will generate.
>>
>> In all these cases, the build rules are necessarily imprecise; they
>> miss some dependencies, or some targets, or they might have
>> unintended side-effects.
> 
> The simplest way to solve this in terms of variant builds is simply to
> always run the build command in the build directory; that way all the
> outpus (including the "unknown" ones) are placed in the build
> directory (where it rightly belongs), and not in the source directory
> (where it would "contaminate" other variant builds).

This only addresses the third problem Jason have mentioned - the 
"unknown targets". However, this would only amplify the other two - 
especially the "unknown sources" one! If your rules run in the build 
directory and looks for source files in the current directory, you are 
toast.

Also there is the issue of a tool like ocamldep, which simply assumes 
that the binary files will be created in the same place as the source 
files! (Basically, when it finds a src/foo.mli source file, it will 
output the dependency on src/foo.cmi binary!).

> IMO, the impreciseness of the build rules are really orthogonal to the
> issue of variant builds.
> 
IMO, the issue of variant builds is orthogonal to out-of-src builds. 
OMake is really good with variant builds - as long as you do not mind 
building one variant at a time. As OMake knows to rebuild targets when 
the command line flags change, you can always switch from one variant to 
another and OMake will know how to rebuild all the files that differ 
between the variants.

Aleksey

-- 
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA


More information about the Omake mailing list