[Issue 13517] Only touch .di generated file if changed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 22 15:55:01 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13517

--- Comment #22 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Ketmar Dark from comment #20)
> (In reply to Steven Schveighoffer from comment #17)
> so it's not a "side effect", .di file has to be explicitly asked.
> 
> > > and why build tool doesn't know about '.di'?
> > I mean, the build tool knows it only as a dependency, not as a target. It
> > has no idea how to build the .di file. The .di file is built as a side
> > effect of building the .o file.
> no, it's not a "side effect". and build tool doesn't know how to build .o
> from .d too. one must provide the rule which builds .o from .d. one must
> provide the rule which builds .di from .d. simple and easy.

Actually it's not that simple and easy. One invocation of the compiler produces
both .o and .di files. A common mistake made with rules that generate multiple
files is to do
https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html, which
is wrong. There are a few better solutions, neither of which trivial. See e g.
http://www.cmcrossroads.com/article/rules-multiple-outputs-gnu-make.

--


More information about the Digitalmars-d-bugs mailing list