[Lldb-commits] [lldb] [lldb] Require gmake on FreeBSD and NetBSD (PR #119573)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 12 02:44:55 PST 2024


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/119573

>From aa3c542bd0f05ea46138b4335cfcbdf7aa19bf16 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Thu, 12 Dec 2024 10:42:35 +0000
Subject: [PATCH] [lldb] Prefer gmake on FreeBSD and NetBSD

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
```

gmake is GNU compatible make, but we were preferring make
even if it was installed.

Reverse that on the BSDs so we use gmake if we can, and
warn if we cannot find a gmake that some of the tests
won't build.
---
 lldb/test/API/CMakeLists.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 36f4973ad9a452..75f06c91e90aa8 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -52,11 +52,22 @@ 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)
+  set(MAKE_NAMES "make" "gmake")
+  if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
+    # Prefer gmake (GNU compatible make) to make on the BSDs.
+    list(REVERSE MAKE_NAMES)
+  endif()
+  find_program(LLDB_DEFAULT_TEST_MAKE NAMES ${MAKE_NAMES})
   if(LLDB_DEFAULT_TEST_MAKE)
     message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
+    if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD") AND
+           NOT LLDB_DEFAULT_TEST_MAKE MATCHES "gmake$")
+       message(WARNING
+               "Make tool '${LLDB_DEFAULT_TEST_MAKE}' may not be able to build LLDB tests. "
+               "Consider installing 'gmake' if you want to run tests.")
+    endif()
   else()
-    message(STATUS "Not found: make")
+    message(STATUS "Did not find one of: ${MAKE_NAMES}")
     message(WARNING
           "Many LLDB API tests require 'make' tool. Please provide it in Path "
           "or pass via LLDB_TEST_MAKE.")



More information about the lldb-commits mailing list