commit | 215d157e844bda2cc766f8dc819d0ca6f467cdf2 | [log] [tgz] |
---|---|---|
author | Fangrui Song <i@maskray.me> | Wed Jan 20 14:22:33 2021 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Jan 21 17:27:22 2021 -0800 |
tree | 6d8139f729d1da1b9c6c1332d97077d10495a171 | |
parent | d513e4ac5db0c1a594f820bdd9067a308add4754 [diff] |
Makefile.rules: Avoid redundant .d generation (make restart) and inline archive rule to the only test Take an example when `CXX_SOURCES` is main.cpp. main.d is an included file. make will rebuild main.d, re-executes itself [1] to read in the new main.d file, then rebuild main.o, finally link main.o into a.out. main.cpp is parsed twice in this process. This patch merges .d generation into .o generation [2], writes explicit rules for .c/.m and deletes suffix rules for %.m and %.o. Since a target can be satisfied by either of .c/.cpp/.m/.mm, we use multiple pattern rules. The rule with the prerequisite (with VPATH considered) satisfied is used [3]. Since suffix rules are disabled, the implicit rule for archive member targets is no long available [4]. Rewrite, simplify the archive rule and inline it into the only test `test/API/functionalities/archives/Makefile`. [1]: https://www.gnu.org/software/make/manual/html_node/Remaking-Makefiles.html [2]: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ [3]: https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html [4]: https://www.gnu.org/software/make/manual/html_node/Archive-Update.html ObjC/ObjCXX tests only run on macOS. I don't have testing environment. Hope someone can do it for me. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94890 GitOrigin-RevId: 6afdf13ae4ccf00296065960a0b311c87e6f8dd5