[all-commits] [llvm/llvm-project] da9ca9: [flang][driver] Support Makefile dependency genera...
Thirumalai Shaktivel via All-commits
all-commits at lists.llvm.org
Tue Aug 4 20:53:33 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da9ca9c5aeb29e5c1f1bfc27c746d03da1e1974d
https://github.com/llvm/llvm-project/commit/da9ca9c5aeb29e5c1f1bfc27c746d03da1e1974d
Author: Thirumalai Shaktivel <74826228+Thirumalai-Shaktivel at users.noreply.github.com>
Date: 2026-08-05 (Wed, 05 Aug 2026)
Changed paths:
M clang/include/clang/Basic/MakeSupport.h
M clang/include/clang/Frontend/DependencyOutputOptions.h
M clang/include/clang/Options/Options.td
M clang/lib/Basic/MakeSupport.cpp
M clang/lib/Driver/ToolChains/Flang.cpp
M clang/lib/Frontend/DependencyFile.cpp
M flang/docs/FlangDriver.md
M flang/include/flang/Frontend/FrontendAction.h
M flang/include/flang/Frontend/FrontendOptions.h
M flang/include/flang/Parser/provenance.h
M flang/lib/Frontend/CompilerInvocation.cpp
M flang/lib/Frontend/FrontendAction.cpp
M flang/lib/Parser/provenance.cpp
A flang/test/Driver/dependency-file-gen-mod.f90
A flang/test/Driver/dependency-file-gen.f90
A flang/test/Driver/dependency-file.f90
Log Message:
-----------
[flang][driver] Support Makefile dependency generation (#209379)
Implement the GCC/Clang dependency-file flags for flang, which it
previously rejected as unknown arguments: -M, -MM, -MD, -MMD, -MF,
-MT and -MQ.
Feature:
- -MD/-MMD : write a .d file alongside a normal compile
- -M/-MM : run through semantics; emit deps to stdout by default
- -MF : dependency-file path
- -MT/-MQ : target name (verbatim / Make-quoted)
(-M==-MM and -MD==-MMD; Fortran has no system/user header split.)
Design:
- `-M`/`-MM`: driver passes `-fsyntax-only -dependency-file - -MT
<target>` to `-fc1`. Running through semantics resolves USE
statements so module file dependencies are captured in the output.
This deviates from clang's prescan-only behaviour for -M, but is
intentional: unlike C/C++ #include, Fortran's USE statement is
resolved at the semantic stage, not during preprocessing.
- `-MD`/`-MMD`: driver passes `-dependency-file foo.d -MT <target>`
alongside the normal compile action. The object file is produced as
usual, and the dependency file is written as a side effect.
- `-MF <path>` overrides where the dependency file is written.
`-MT <target>` sets the target name (the part before the colon in
the Make rule) verbatim. `-MQ` does the same but additionally
quotes characters that are special to Make.
- In `-fc1`, `-dependency-file` and `-MT` are stored in the frontend
options. After the action, `writeDependencyFile()` is called
unconditionally. It collects every file opened during the action —
the source plus all INCLUDE/#include/USE module files — via
`GetIncludedFilePaths()`, then writes the
`target: source includes...` Make rule to the specified file, or
stdout if the path is `-`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list