Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unnecessary rebuild for some rules #5653

Closed
vicuna opened this issue Jun 18, 2012 · 3 comments
Closed

unnecessary rebuild for some rules #5653

vicuna opened this issue Jun 18, 2012 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Jun 18, 2012

Original bug ID: 5653
Reporter: @bobzhang
Assigned to: meyer
Status: closed (set by @xavierleroy on 2015-12-11T18:19:38Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: @gasche @hcarty gildor

Bug description

This rule will rebuld cmxs everytime, as along as I don't have .so
rule "ocaml: mldylib & cmx* & o* -> cmxs & so"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"; x_dll]
~dep:"%.mldylib"
(Ocaml_compiler.native_shared_library_link_mldylib "%.mldylib" "%.cmxs");;

This also applies this rule, when I only need build .cmx, it will rebuild .cmo
everytime since I need it to build cmi.
rule "ocaml: ml -> cmo & cmi"
~tags:["ocaml"]
~prods:["%.cmo"; "%.cmi"]
~deps:["%.ml"; "%.ml.depends"]
(Ocaml_compiler.byte_compile_ocaml_implem "%.ml" "%.cmo");;
Since I switched to ocamlbuild, I found the performance degraded a lot.
It works, but it is really slow. It is possible to make the rules more customizable without introducing a big database with a lot of reduandance?

@vicuna
Copy link
Author

vicuna commented Jun 18, 2012

Comment author: @bobzhang

Just remove x_dll works, how do I tell ocamlbuild which rule is used first?
rule "ocaml: mldylib & cmx* & o* -> cmxs"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"]
~dep:"%.mldylib"
(Ocaml_compiler.native_shared_library_link_mldylib "%.mldylib" "%.cmxs");;

Many thanks

@vicuna
Copy link
Author

vicuna commented Jun 18, 2012

Comment author: gildor

oasis 0.3 switches to always produce .cmxs and I see that rebuilding .cmxs is done everytime. This is quite annoying.

tip: set "./configure --override is_native false" to avoid that

@vicuna
Copy link
Author

vicuna commented Jan 18, 2013

Comment author: meyer

Use ~insert optional argument for rule to insert at given place the rule.

In your case:

rule "ocaml: mldylib & cmx* & o* -> cmxs"
  ~insert:`top
  ~tags:["ocaml"; "native"; "shared"; "library"]
  ~prods:["%.cmxs"]
  ~dep:"%.mldylib"
  (Ocaml_compiler.native_shared_library_link_mldylib "%.mldylib" "%.cmxs");;

should be enough to get your desired effect.

Another way of doing that would be to use Before_rules dispatch entry point.

Closing this PR, with a note that documentation should be updated reflecting this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant