[Lldb-commits] [PATCH] D68558: [Testsuite] Get rid of most of the recursive shared library Makefiles

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 6 18:31:54 PDT 2019


friss created this revision.
friss added reviewers: aprantl, labath.
Herald added a project: LLDB.

I was working on cleaning up our on-device test runs last week, and as
a result I needed to update a lot of test Makefiles in the Swift
tree. I found it especailly annoying to update the build system of
tests that are building mutliple images (typically a shared
library).

The main reason is that you can't see what's (if anything) special
about the build from the main makefile. You always need to open
mutliple Makefiles. Another reason is the way you have to add a
special line to your clean rule to do the right thing, and you never
really know which arguments to pass.

Most of the secondary Makefiles we have are just a couple variable
definitions and then an include of Makefile.rules. This patch removes
most of the secondary Makefiles and replaces them with a direct
invocation of Makefile.rules in the main Makefile. The specificities
of each sub-build are listed right there on the recursive $(MAKE)
call. All the variables that matter are being passed automagically by
make as they have been passed on the command line. The only things you
need to specify are the variables customizating the Makefile.rules
logic for each image.

This patch also deals with the clean rules using this trick to avoid
having to duplicate the recursive invocation in a separate clean rule:

mylib clean::

  $(MAKE) -f $(MAKEFILE_RULES) ... $(MAKECMDGOALS)

The MAKECMDGOALS variable at the end contains the list of build goals
that have been passed on the command line. When it's empty, this
invocation just calls the default Makefile.rules rule which is what
you want. When "clean" is passed as a goal, the rule will be invoked
too and it is passed through MAKECMDGOALS invoking the appropriate
cleaning logic from Makefile.rules.

I really like the conciseness of this approach and the fact that
everything is visible in one place. What do others think?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68558

Files:
  lldb/packages/Python/lldbsuite/test/commands/expression/top-level/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/top-level/dummy.mk
  lldb/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile
  lldb/packages/Python/lldbsuite/test/commands/target/create-deps/a.mk
  lldb/packages/Python/lldbsuite/test/functionalities/exec/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/exec/secondprog.mk
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/simple.mk
  lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
  lldb/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk
  lldb/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk
  lldb/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk
  lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk
  lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk
  lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
  lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk
  lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk
  lldb/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/lc-note/kern-ver-str/create-empty-corefile.mk
  lldb/packages/Python/lldbsuite/test/macosx/macabi/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/macabi/dylib.mk
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.mk
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.mk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68558.223449.patch
Type: text/x-patch
Size: 17473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191007/e1557d3c/attachment-0001.bin>


More information about the lldb-commits mailing list