[Omake] Changing OCAMLPACKS in a section fails

Renald Buter buter at cwts.leidenuniv.nl
Wed Feb 14 12:55:12 PST 2007


On 10:01 Wed 14 Feb     , Aleksey Nogin wrote:
> On 14.02.2007 02:55, Renald Buter wrote:
> 
 
> I could not reproduce this problem, using a slightly different OMakefile:
> 
> --------
> USE_OCAMLFIND = true
> 
> section
>         PROGRAM=main_target
>         FILES=main_target
>         OCAMLPACKS=expat
>         .DEFAULT: $(OCamlProgram $(PROGRAM),$(FILES))
> 
> section
>         PROGRAM=main_target_test
>         FILES=main_target main_target_test
>         OCAMLPACKS=oUnit
>         .DEFAULT: $(OCamlProgram $(PROGRAM),$(FILES))
> ---------
> 
> Aleksey
> 

Thanks Alekey!

Unfortunately, I'm still not getting it...

Here is (the slightly changed, since I really didn't need expat)
OMakefile, now copied directly from you suggestion above:

---
NATIVE_ENABLED = true
USE_OCAMLFIND = true

section
	PROGRAM = main_target
	FILES = main_target
	OCAMLPACKS = str
	.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES))

section
	PROGRAM = main_target_test
	FILES = main_target main_target_test
	OCAMLPACKS = oUnit
	.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES))
---

Building the main_target goes according to plan:

---
*** omake: changing directory to
/home/buter/projects/lib/experiment
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.0 sec)
- build lines-grouper main_target.o
+ ocamlfind ocamlopt -warn-error A -I . -c main_target.ml
- build lines-grouper main_target.opt
+ ocamlfind ocamlopt -package "str" -warn-error A -I . -o
main_target.opt main_target.cmx -linkpkg
- build lines-grouper main_target
+ ln -sf main_target.opt main_target
*** omake: done (0.7 sec, 0/1 scans, 3/5 rules, 6/44 digests)
---

(Please note that the 'lines-grouper' is the subproject directory I was
 working it while getting into this OMakefile troubles...)

Now, building the main_target_test, I get:

---
*** omake: changing directory to
/home/buter/projects/lib/experiment
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.0 sec)
- build lines-grouper main_target_test.cmx
+ ocamlfind ocamlopt -warn-error A -I . -c main_target_test.ml
File "main_target_test.ml", line 1, characters 0-10:
Unbound module OUnit
*** omake: 17/22 targets are up to date
*** omake: failed (0.1 sec, 0/2 scans, 1/4 rules, 0/41 digests)
*** omake: targets were not rebuilt because of errors:
   lines-grouper/main_target_test.cmx
      depends on: lines-grouper/main_target_test.ml
   lines-grouper/main_target_test.cmi
      depends on: lines-grouper/main_target_test.ml
   lines-grouper/main_target_test.o
      depends on: lines-grouper/main_target_test.ml
---

To be complete, here are the .ml files:

---main_target.ml
let rex s = Str.regexp s

let gsub re v = 
  Str.global_replace re v 
---

---main_target_test.ml
open OUnit
open Main_target

let main_target_suite =
  "main_target_test" >::: [
    "gsub_a" >:: ( fun _ ->
      assert_equal "abc"  (gsub "f" "a" "fbc")
    )
  ]

let _ = run_test_tt_main main_target_suite
---

Now, I am probably missing something very, very obvious...

With kind regards,

Renald


More information about the Omake mailing list