[all-commits] [llvm/llvm-project] 6afdf1: Makefile.rules: Avoid redundant .d generation (mak...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Jan 20 14:27:19 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6afdf13ae4ccf00296065960a0b311c87e6f8dd5
      https://github.com/llvm/llvm-project/commit/6afdf13ae4ccf00296065960a0b311c87e6f8dd5
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-01-20 (Wed, 20 Jan 2021)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/make/Makefile.rules
    M lldb/test/API/functionalities/archives/Makefile

  Log Message:
  -----------
  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




More information about the All-commits mailing list