@@ -334,7 +334,7 @@ rule "ocaml: mllib & cmx* & o* -> cmxa & a"
334334        as the .cma rule above. Note that whereas bytecode .cma can \ 
335335        be used both for static and dynamic linking, .cmxa only support \ 
336336        static linking. For an archive usable with Dynlink, \ 
337-         see the rule  producing a .cmxs from a .mldylib."  
337+         see the rules  producing a .cmxs from a .mllib or  a .mldylib."  
338338  (Ocaml_compiler. native_library_link_mllib " %.mllib" " %.cmxa" 
339339
340340rule " ocaml: p.cmx & p.o -> p.cmxa & p.a" 
@@ -363,6 +363,19 @@ rule "ocaml: mldylib & cmx* & o* -> cmxs & so"
363363        the modules listed in the corresponding .mldylib file."  
364364  (Ocaml_compiler. native_shared_library_link_mldylib " %.mldylib" " %.cmxs" 
365365
366+ rule " ocaml: mllib & p.cmx* & p.o* -> p.cmxs & p.so" 
367+   ~prods: [" %.cmxs" 
368+   ~dep: " %.mllib" 
369+   (Ocaml_compiler. native_profile_shared_library_link_mldylib " %.mllib" " %.cmxs" 
370+ 
371+ rule " ocaml: mllib & cmx* & o* -> cmxs & so" 
372+   ~prods: [" %.cmxs" 
373+   ~dep: " %.mllib" 
374+   ~doc: " Builds a .cmxs containing exactly the modules listed in the \
375+         corresponding .mllib file. This rule triggers only when no .mldylib \ 
376+         could be found."  
377+   (Ocaml_compiler. native_shared_library_link_mldylib " %.mllib" " %.cmxs" 
378+ 
366379rule " ocaml: p.cmx & p.o -> p.cmxs & p.so" 
367380  ~prods: [" %.p.cmxs" 
368381  ~deps: [" %.p.cmx" 
@@ -376,9 +389,9 @@ rule "ocaml: p.cmxa & p.a -> p.cmxs & p.so"
376389rule " ocaml: cmx & o -> cmxs" 
377390  ~prods: [" %.cmxs" 
378391  ~deps: [" %.cmx" 
379-   ~doc: " If you have not created a foo.mldylib file for a compilation unit  \
380-         foo.cmx, the target foo.cmxs will produce a .cmxs file containing  \ 
381-         exactly the .cmx. 
392+   ~doc: " If you have not created a foo.mldylib or foo.mllib  file for a \
393+         compilation unit  foo.cmx, the target foo.cmxs will produce a .cmxs \ 
394+         file containing  exactly the .cmx. 
382395
383396\ 
384397        Note: this differs from the behavior of .cmxa targets \ 
@@ -397,7 +410,11 @@ rule "ocaml: cmxa & a -> cmxs & so"
397410  ~prods: [" %.cmxs" 
398411  ~deps: [" %.cmxa" 
399412  ~doc: " This rule allows to build a .cmxs from a .cmxa, to avoid having \
400-         to duplicate a .mllib file into a .mldylib."  
413+         to duplicate a .mllib file into a .mldylib. 
414+ 
415+ \ 
416+         Another way of avoiding duplication is by producing the .cmxs directly \ 
417+         from the .mllib file, using the corresponding rule."  
401418  (Ocaml_compiler. native_shared_library_link ~tags: [" linkall" " %.cmxa" " %.cmxs" 
402419
403420rule " ocaml dependencies ml" 
0 commit comments