[Omake] Files in subdirs

Jason Hickey jyh at cs.caltech.edu
Thu Jun 22 18:10:57 PDT 2006


Chris Campbell wrote:
> Hi,
> 
> How do we use files in subdirectories without using a library?
[snip...]
> I tried the following
> 
> src/tests/OMakefile:
>  OCAMLINCLUDES+=maths
> 
>  TEST_MAIN = unit-tests
> 
>  TEST_FILES = testUtils oUExt \
>     maths/testMaths $(TEST_MAIN)
> 
>  .PHONY: clean
>  clean:
>     $(CLEAN) $(TEST_MAIN)
> 
>  OCamlProgram($(TEST_MAIN), $(TEST_FILES))
>  .DEFAULT: $(TEST_MAIN)
> 
> This does not work.
[snip...]

Hi Chris,

I think the issue is that the maths (and core) directories are not part 
of your project.  OMake doesn't use implicit rules for such directories.

It should work if you include the subdirs.  You don't need to write 
OMakefiles for them if you use .SUBDIRS with an explicit body.  Add this 
rule to src/tests/OMakefile.

     .SUBDIRS: maths core
         # Fill in the body with something.  For your project,
         # you don't need anything here, so we just add a dummy.
         value $(EMPTY)

The section on "Collapsing the Hierarchy" gives a little more info on 
.SUBDIRS.

http://omake.metaprl.org/omake-build-examples.html#toc15

One minor comment, the OCamlProgram returns the target files, so we 
often write the last lines like this:

.DEFAULT: $(OCamlProgram $(TEST_MAIN), $(TEST_FILES))

Jason

-- 
Jason Hickey                  http://www.cs.caltech.edu/~jyh
Caltech Computer Science      Tel: 626-395-6568 FAX: 626-792-4257


More information about the Omake mailing list