================
@@ -236,6 +236,21 @@ is `ParseSyntaxOnlyAction`, which corresponds to 
`-fsyntax-only`. In other
 words, `flang -fc1 <input-file>` is equivalent to `flang -fc1 -fsyntax-only
 <input-file>`.
 
+## Dependency File Generation
+Flang can emit Makefile-style dependency rules with `-M`, `-MM`, `-MD` and
+`-MMD` (paired with `-MF`, `-MT` and `-MQ` to control the output file and the
+rule target).
+
+There is one behavioural difference to be aware of regarding module
+dependencies (the `.mod` files brought in by `use` statements):
+
+* `-MD` and `-MMD` run a full compilation, so the `.mod` files opened during
+  semantic analysis are recorded and appear in the dependency rule.
+* `-M` and `-MM` run the prescanner only. They report textual dependencies
----------------
tarunprabhu wrote:

Thanks for looking into this.

The implication of `-E` given `-M`, only means that no object files will be 
created - but the behavior of the option should be "consistent". I think the 
user will expect the `USE` statements to be processed since they would expect 
`-M` to handle all dependencies. If passing `-syntax-only` internally will do 
that, then that's what we should do.

I asked what applications do because I expected that Fortran applications would 
prefer `-MD`, over `-M`. Still, if we can support both without too much 
difficulty, we should.

https://github.com/llvm/llvm-project/pull/209379
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to