On Sat, Mar 22, 2014 at 02:04:36PM +0100, Hilko Bengen wrote:
* Richard W.M. Jones:
>> Wouldn't a rule without commands such as
>>
>> mlguestfs.cmxa: mlguestfs.cma
>>
>> also prevent make from building the two targets in parallel?
>
> Doesn't that mean that if mlguestfs.cmxa is out of date, simply
> running the mlguestfs.cma rule will build it (which it won't)?
Not sure if I understand you.
If I cause mlguestfs.cmxa to be out of date by touching guestfs.cmx,
only mlguestfs.cmxa will be rebuilt.
If I cause mlguestfs.cma to be out of date by touching guestfs.cmo, both
mlguestfs.cma and mlguestfs.cmxa will be rebuilt. This could be fixed by
using an order-only prerequisite:
mlguestfs.cmxa: | mlguestfs.cma
I wanted to see what would work in practice, so I set up the following
test (note you may have to adjust the MD5 hashes depending on the
version of OCaml you have).
Save the following as test.sh, and make it executable:
----------------------------------------------------------------------
#!/bin/bash
set -e
make -C ocaml clean
make -C ocaml -j100
test "$(md5sum ocaml/mlguestfs.cm*)" = "e929569af895530898f9a513a9a8c8ff
ocaml/mlguestfs.cma
09847aa897b230316ae61d633a151fff ocaml/mlguestfs.cmxa"
----------------------------------------------------------------------
Run:
while ./test.sh >& log; do echo -n .; done
This will run for some time -- indefinitely if parallel builds work.
If it exits, examine the log file to see what went wrong.
I tried:
(1) Removing .NOTPARALLEL. This fails, as expected.
(2) mlguestfs.cmxa: mlguestfs.cma -- fails
(3) mlguestfs.cmxa: | mlguestfs.cma -- fails after a longer time
(4) The attached patch which is derived from dce94f -- this ran
without failing for 120 iterations (and still going).
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW