This option includes an extra source or object in the compilation. It is
particularly useful if you need to add an extra object (compiled by
another language maybe) or an extra source (maybe because a .di was
provided) when compiling the program (multiple --extra-file are
allowed).
Use the absolute path to the root .d file instead.
It is certainly possible that the build result will depend on
the current directory. For example, if the root file imports
other modules, these will be sought in the current directory
first. However, this is an unlikely use case, and can be
simulated using e.g. --force or -I%CD%.
On the other hand, having your script be rebuilt every time
it is run from a different directory is an unnecessary waste
of time and disk space.
The current format is not very human friendly and also makes doing
simple checks for testing quite hard. The new format is based on GCC's
format, and it looks like this:
target: \
source1.d \
source2.d \
source1.d:
source2.d:
Having the source file as the target for the dependencies on a Makefile
is useless, as there is no rule to rebuild the source file, Make can't
use that information at all.
To a have a meaningful target name, now --makedep* options require -of
to be present too.
The idea behind this option is to provide something similar to GCC's -MF
option, which generate a dependency file at the same time it compiles
the program. This is very useful to keep a Makefile with the
dependencies always updated:
-include .deps.mak
prog:
rdmd --build-only --makedepfile=.deps.mak prog.d
On the first build .deps.mak will be created and afterwards, the only
way the dependencies could change is if prog.d or any of its
dependencies change, in which case a build will be triggered and the new
dependencies file will be generated.