[Lldb-commits] [lldb] [lldb][test] Prefer gmake to make and warn for potentially non-GNU make (PR #119573)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 13 06:19:21 PST 2024
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/119573
>From 42fe1cb8dcb131110f18eef23625e3910f795401 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 13 Dec 2024 13:55:23 +0000
Subject: [PATCH] [lldb][test] Prefer gmake to make and warn for potentially
non-GNU make
System make on FreeBSD is missing some GNU make features so
out of the box you get a lot of:
```
make: "<...>/Makefile.rules" line 569: Invalid line type
```
You can install gmake which is a port of GNU make to solve this.
However because we prefer 'make', it still won't be found.
To fix that, prefer 'gmake'. Also check (as best we can) that
the make we found is GNU make. This won't be perfect but it's
better than the cryptic error shown above.
---
lldb/test/API/CMakeLists.txt | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 36f4973ad9a452..da51f2252d0233 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -52,13 +52,24 @@ set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTA
if(LLDB_TEST_MAKE)
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
else()
- find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
+ # Prefer gmake as it will be a version of GNU make. 'make' could be GNU compatible or not.
+ set(MAKE_NAMES "gmake" "make")
+ find_program(LLDB_DEFAULT_TEST_MAKE NAMES ${MAKE_NAMES})
if(LLDB_DEFAULT_TEST_MAKE)
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
+ execute_process(COMMAND ${LLDB_DEFAULT_TEST_MAKE} --version OUTPUT_VARIABLE MAKE_VERSION
+ ERROR_QUIET)
+ if(NOT MAKE_VERSION MATCHES "^GNU Make")
+ message(WARNING "'make' tool ${LLDB_DEFAULT_TEST_MAKE} may not be GNU make compatible. "
+ "Some tests may fail to build. Provide a GNU compatible 'make' tool by setting "
+ "LLDB_TEST_MAKE.")
+ endif()
else()
- message(STATUS "Not found: make")
+ list(JOIN "${MAKE_NAMES}" " " MAKE_NAMES_SPACES)
+ string(REPLACE ";" " " MAKE_NAMES_SPACES "${MAKE_NAMES}")
+ message(STATUS "Did not find one of: ${MAKE_NAMES_SPACES}")
message(WARNING
- "Many LLDB API tests require 'make' tool. Please provide it in Path "
+ "Many LLDB API tests require a 'make' tool. Please provide it in Path "
"or pass via LLDB_TEST_MAKE.")
endif()
endif()
More information about the lldb-commits
mailing list