[Omake] Restarting omake

Aleksey Nogin nogin at metaprl.org
Mon Sep 18 09:29:03 PDT 2006


Hi David,

On 18.09.2006 07:17, David Kågedal wrote:

>                 # Check if the module build dir exists
>                 if $(file-exists ./$m)
>                     .SUBDIR: $m
>                     # The $m/OMakefile in the module contains a rule to
>                     # build $m/module.so
>                 else
>                     .PHONY: $m/module.so
>                     $m/module.so :
>                         mkdir $m
>                         RestartOMake()
> 
> The point is that if the build directory didn't exist, an alternat
> build rule is used that creates the build directory and restarts
> omake, so that it can rescan the omakefiles and find the new module.

I am not sure if I fully understand your example, but have you 
considered that:

- You do not have to have an OMakefile in every directory. If you use 
the .SUBDIRS with a body:

.SUBDIRS: foo bar
    body

than the body will be evaluated (twice in the above example - once for 
each of the subdirectories) in place of the OMakefile. In fact, the usual

.SUBDIRS: foo bar

without a body is simply a shortcut for

.SUBDIRS: foo bar
    include OMakefile

This approach is very useful if you do not want to have a big collection 
of identical (or similar) OMakefiles.

- The directory only needs to exist when you evaluate the .SUBDIRS. The 
following should work, I believe:

if $(not $(file-exists $m/OMakefile))
    mkdir $m
    touch $m/OMakefile
.SUBDIRS: $m

- There are add-project-directories and remove-project-directories 
functions.

- When you are running omake with a -p or -P option, it will 
automatically restart if it detects that any of the OMakefiles that it 
have already read have changed.


More information about the Omake mailing list