remake icon indicating copy to clipboard operation
remake copied to clipboard

New kind of dependencies

Open bobot opened this issue 11 years ago • 1 comments

Feature wish: Currently the content of a file can only depend on the content of other files. However you can need to state that the content of a file depend on the presence or absence of a file. One example is the construction in ocaml of a .cmo that depend on the presence of a .mli.

One question is what if a dependency doesn't exists but it can be built. Do we try to build it when a rule states that it depends on the presence of the file. What if finally there is an error during the construction of the dependency?

bobot avatar Jun 18 '13 11:06 bobot

I think your example is a bit off. A .cmo file does not depend on the presence of a .mli file, it depends on its absence. Currently, if a .cmo file is originally built in the absence of a .mli file and if one is later added, the .cmo file will not be rebuilt, yet it now depends on the .cmi file built from the .mli file. Thus, the rule for a .cmo file should ideally look like the following, with --missing indicating to remake that the target becomes obsolete if the argument ever appears.

%.cmo: %.ml
    test -f $<i || remake --missing $<i
    ocamldep $< | remake -r $@
    ocamlc -c $<

At least for this example, I don't think the prerequisite can be built. But you are right that, in general, there is an issue if a rule depends on the absence of a prerequisite, since this prerequisite might well be built independently. The only solution I can come with is that remake --missing should error out if there exists a rule for building the prerequisite.

Note: --missing is not meant to be a well-thought way of indicating absence of prerequisite.

silene avatar Jun 18 '13 16:06 silene