Skip to content

Commit b4c1f0c

Browse files
[lldb][test] Prefer gmake to make and warn for potentially non-GNU make (#119573)
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 ``` To solve this, you can install gmake which is a port of GNU make. However because we prefer 'make', gmake won't be used unless you set LLDB_TEST_MAKE. 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. ``` -- Found make: /usr/bin/make CMake Warning at /home/ec2-user/llvm-project/lldb/test/API/CMakeLists.txt:63 (message): 'make' tool /usr/bin/make may not be GNU make compatible. Some tests may fail to build. Provide a GNU compatible 'make' tool by setting LLDB_TEST_MAKE. ``` When a make isn't found at all, the warning message will show the names we tried: ``` -- Did not find one of: gmake make CMake Warning at /home/ec2-user/llvm-project/lldb/test/API/CMakeLists.txt:69 (message): Many LLDB API tests require a 'make' tool. Please provide it in Path or pass via LLDB_TEST_MAKE. ```
1 parent 003fb2a commit b4c1f0c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lldb/test/API/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@ set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTA
5252
if(LLDB_TEST_MAKE)
5353
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
5454
else()
55-
find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
55+
# Prefer gmake as it will be a version of GNU make. 'make' could be GNU compatible or not.
56+
set(MAKE_NAMES "gmake" "make")
57+
find_program(LLDB_DEFAULT_TEST_MAKE NAMES ${MAKE_NAMES})
5658
if(LLDB_DEFAULT_TEST_MAKE)
5759
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
60+
execute_process(COMMAND ${LLDB_DEFAULT_TEST_MAKE} --version OUTPUT_VARIABLE MAKE_VERSION
61+
ERROR_QUIET)
62+
if(NOT MAKE_VERSION MATCHES "^GNU Make")
63+
message(WARNING "'make' tool ${LLDB_DEFAULT_TEST_MAKE} may not be GNU make compatible. "
64+
"Some tests may fail to build. Provide a GNU compatible 'make' tool by setting "
65+
"LLDB_TEST_MAKE.")
66+
endif()
5867
else()
59-
message(STATUS "Not found: make")
68+
list(JOIN "${MAKE_NAMES}" " " MAKE_NAMES_SPACES)
69+
string(REPLACE ";" " " MAKE_NAMES_SPACES "${MAKE_NAMES}")
70+
message(STATUS "Did not find one of: ${MAKE_NAMES_SPACES}")
6071
message(WARNING
61-
"Many LLDB API tests require 'make' tool. Please provide it in Path "
72+
"Many LLDB API tests require a 'make' tool. Please provide it in Path "
6273
"or pass via LLDB_TEST_MAKE.")
6374
endif()
6475
endif()

0 commit comments

Comments
 (0)