On Wed, Jul 26, 2017 at 9:31 AM, Paul Smith <psm...@gnu.org> wrote:
> On Wed, 2017-07-26 at 09:17 -0800, Britton Kerin wrote:
>> Another option if you don't like non-static pattern rules or the
>> special-case stuff involved, is to use a stamp file:
>>
>> yaccouts.stamp: parser.mly
>>         ocamlyacc $<
>
> I expect you want to add a "touch $@" to this recipe.

Yes, thx.  My bad should always test before post.

> And, this will only work if you have only on .mly file you need to
> build; if you have more than one you'll need to ensure the stamp file
> name is based on the .mly file name rather than "yaccouts.stamp".

Ok ok here's a more real-life version:

OCAMLYACC_STAMPS = $(patsubst %.mly,%.ocamlyacc.stamp,$(wildcard *.mly))

$(OCAMLYACC_STAMPS): %.ocamlyacc.stamp: %.mly
        ocamlyacc $<
        touch $@

>> Since .ml and .mli files are always produced together by the
>> sameprogram, they don't need individual nodes in your dependency
>> graph so you arrange yaccouts.stamp to represent them (and depend on
>> the stampfile in turn where needed).
>
> This works if you can ensure that all other references to parser.ml and
> parser.mli in the prerequisites lists in your makefile can be replaced
> with a reference to the .stamp file.
>
> But, it's not so simple if you have auto-generated prerequisites etc.
> where it's harder to control this.
>
> Also, this method doesn't take into account someone deleting either or
> both of the .ml or .mli files by hand but not touching the .stamp file.

True.  It's still worth it to avoid non-static pattern rules though IMO.

Britton

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to