[Omake] OMake compilation with sub-directories

Aleksey Nogin nogin at metaprl.org
Mon Jul 6 12:01:23 PDT 2009


On 06.07.2009 11:22, maksim.kneller at barclayscapital.com wrote:

> [...] it seems whenever sources from
> subdirectories are used - they are always compiled into static libraries
> first. 

Maksim,

It is *not* the case that you have to compile into static libraries, but
the default assumption is that each object file goes into the same
directory as the source file.

Below is how you'd need to rewrite the OMakefile for your project.

> CXXFLAGS = -Wall

Offtopic - you may also want to use -Werror, so that it's easier to use
OMake's -p/-k/-P options without having to scroll back to find all the
warnings.

> INCLUDES += headers src

INCLUDES is only for the header files. You need

INCLUDES += $(dir headers)
.SUBDIRS: src

(Note1 - the order of the previous two lines is important. The way I
wrote it, the src dir would get the updated INCLUDES; if you do not want
that, reorder the two.)

(Note2 - the above would expect an src/OMakefile file, even though an
empty one would do. You could write something like

.SUBDIRS: src
   return # A no-op body

to "inline" the ./src/OMakefile into the ./OMakefile)

> CXXProgram(myapp, main file1 )

Should be src/file1.

Hope this helps.

Aleksey



More information about the Omake mailing list