]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
makefile: automatic Arch Linux detection (#1332)
authorDaniAndTheWeb <redacted>
Fri, 5 May 2023 21:57:14 +0000 (23:57 +0200)
committerGitHub <redacted>
Fri, 5 May 2023 21:57:14 +0000 (23:57 +0200)
This commit is a port of a detection method used in koboldcpp's Makefile in order to automatically set the -lcblas option on Arch Linux

Makefile
README.md

index 260b2487ffab84c39b6fc409f9e5a66d0f85f41a..0ddff9961ac76f567c7637f399dbb18703bdb54e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -107,7 +107,11 @@ ifndef LLAMA_NO_ACCELERATE
 endif
 ifdef LLAMA_OPENBLAS
        CFLAGS  += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
-       LDFLAGS += -lopenblas
+       ifneq ($(shell grep -e "Arch Linux" -e "ID_LIKE=arch" /etc/os-release 2>/dev/null),)
+               LDFLAGS += -lopenblas -lcblas
+       else
+               LDFLAGS += -lopenblas
+       endif
 endif
 ifdef LLAMA_CUBLAS
        CFLAGS    += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include
index 233c5c5e1e19c4e82ce5b05f79f268038cf3a01c..19cc94aa269c9c73f0863620773939c3a9299e1d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -216,7 +216,6 @@ Building the program with BLAS support may lead to some performance improvements
       ```bash
       make LLAMA_OPENBLAS=1
       ```
-      Note: In order to build on Arch Linux with OpenBLAS support enabled you must edit the Makefile adding at the end of the line 105: `-lcblas`
 
     - On Windows: