[Omake] Recursive invocation of omake

Benjamin Pierce bcpierce at cis.upenn.edu
Wed Jun 7 17:34:36 PDT 2006


Many thanks for that, Aleksey -- what you wrote about how phony  
targets work is precisely what I was missing!

Would be great if this stuff got into the documentation someplace...

     - Benjamin


On Jun 7, 2006, at 2:24 PM, Aleksey Nogin wrote:

> On 07.06.2006 07:34, Benjamin Pierce wrote:
>
>> Looking at the OMakefiles for OMake itself, I discovered that if  
>> both  the root OMakefile and some subdirectory's OMakefile contain  
>> clean:  targets, then
>>    1) doing 'make clean' in the root dir will execute them both  
>> (in  the appropriate directories)
>>    2) doing 'make clean' in the subdirectory will execute just  
>> its  local one.
>> This is exactly the behavior I wanted, so that problem is solved.
>> However, this makes me realize that there is still quite a bit I   
>> don't understand about OMake's view of a multi-directory project  
>> -- I  don't have a model that would have allowed me to predict  
>> both (1) and  (2).  Can someone explain?
>
> Let me first quickly explain the semantics for the non-phony  
> targets. There, running "omake foo" asks OMake to build the file  
> foo in context of the _whole_ project. Therefore, if bar/baz is a  
> regular file, then running "omake bar/baz" and running "(cd bar;  
> omake baz)" are equivalent (unless bar/OMakeroot exists,  
> designating bar as a completely separate project, which should not  
> normally happen).
>
> Now on to phony targets. When the the "root" OMakefile has a  
> directive ".PHONY: clean", it creates a "clean" phony target  
> relative to the project root - let's call it ".PHONY/clean". All  
> the "clean: ..." rules in the "root" OMakefile following this  
> ".PHONY: clean" declaration would be interpreted as rules for the  
> ".PHONY/clean" target.
>
> Now when OMake then comes across the ".SUBDIRS: doc" directive  
> (when it is in scope of the above ".PHONY: clean" declaration), it  
> does the following:
>
> a) Creates the ".PHONY/doc/clean" phony target
>
> b) Creates the rule
> .PHONY/clean: .PHONY/doc/clean
>
> c) Reads the doc/OMakefile file, interpreting its instructions  
> relative to the doc directory. In particular, all the "clean: ..."  
> rules in the doc/OMakefile will be taken to apply to ".PHONY/doc/ 
> clean".
>
> Now when you run "omake clean" in the root directory of the  
> project, it is interpreted as "omake .PHONY/clean", so both the  
> rules for ".PHONY/clean" are executed and the rule for its  
> dependency ".PHONY/doc/clean". Running "(cd doc; omake clean)" is,  
> as for normal targets, equivalent to running "omake .PHONY/doc/ 
> clean" and only those rules that apply to ".PHONY/doc/clean" will  
> be executed.
>
> Hope this helps.
>
> -- 
> Aleksey Nogin
>
> Home Page: http://nogin.org/
> E-Mail: nogin at cs.caltech.edu (office), aleksey at nogin.org (personal)
> Office: Moore 04, tel: (626) 395-2200
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake



More information about the Omake mailing list