-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let include detection generate .d files too
Previously, the including detection process caching relied on the .d files generated by compilation to know what .h files a given source files depends on. This works correctly, but if a project does not compile completely, not all .d files are generated, so not all cached include detection results can be used. In practice, this means that if a there is a compilation error in the first file that is compiled, include detection will run again for all files on the next run. If you have a few errors to solve and a big project, this gets annoying quickly. To fix this, the include detection process should generate .d files itself. At first glance it appears that there is a problematic case where the list of included header files changes, the include detection overwrites the .d file and then compilation only sees the new list (which was generated later than the .o file was generated). However, since this implies that changes are made to an #include directive in the source file itself or one of the files that are still included, this should be detected normally. There is still a corner case when a file is changed during the build, but that was already the case. Since include detections uses `-o /dev/null`, the compiler generates a slightly different .d file. During compilation, a file `foo.cpp.d` is generated in the output directory starting with: /path/to/foo.cpp.o: \ But when just passing `-MMD` to the preproc recipe, it generates a `foo.d` file in the source directory starting with: foo.o: \ To make these equal, `-MF` must be passed during include detection to set the .d filename, and `-MT` must be passed to set the .o filename inside the .d file. To enable this feature, platform.txt should be modified by adding ` -MMD -MF {dep_file} -MT {object_file}` to `preproc.macros.flags` (or `recipe.preproc.macros`). Without any changes to platform.txt, behaviour is unchanged. To allow this, this adds `{dep_file}` and `{object_file}` variables to the build properties for the preproc macros recipe. For consistency, `{dep_file}` is also added during normal compilation, though it is not currently used.
- Loading branch information
1 parent
d4e9078
commit f13ade8
Showing
5 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters