mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-16 20:09:41 +00:00
makefile indentation fix (+1 squashed commits)
Squashed commits: [f640eb59] makefile indentation fix
This commit is contained in:
parent
558bc5c901
commit
2f69432774
1 changed files with 116 additions and 116 deletions
232
Makefile
232
Makefile
|
@ -30,14 +30,14 @@ endif
|
||||||
# Mac OS + Arm can report x86_64
|
# Mac OS + Arm can report x86_64
|
||||||
# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
|
# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
ifneq ($(UNAME_P),arm)
|
ifneq ($(UNAME_P),arm)
|
||||||
SYSCTL_M := $(shell sysctl -n hw.optional.arm64 2>/dev/null)
|
SYSCTL_M := $(shell sysctl -n hw.optional.arm64 2>/dev/null)
|
||||||
ifeq ($(SYSCTL_M),1)
|
ifeq ($(SYSCTL_M),1)
|
||||||
# UNAME_P := arm
|
# UNAME_P := arm
|
||||||
# UNAME_M := arm64
|
# UNAME_M := arm64
|
||||||
warn := $(warning Your arch is announced as x86_64, but it seems to actually be ARM64. Not fixing that can lead to bad performance. For more info see: https://github.com/ggerganov/whisper.cpp/issues/66\#issuecomment-1282546789)
|
warn := $(warning Your arch is announced as x86_64, but it seems to actually be ARM64. Not fixing that can lead to bad performance. For more info see: https://github.com/ggerganov/whisper.cpp/issues/66\#issuecomment-1282546789)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -106,9 +106,9 @@ ifeq ($(UNAME_S),Darwin)
|
||||||
CFLAGS += -pthread
|
CFLAGS += -pthread
|
||||||
CXXFLAGS += -pthread
|
CXXFLAGS += -pthread
|
||||||
CLANG_VER = $(shell clang -v 2>&1 | head -n 1 | awk 'BEGIN {FS="[. ]"};{print $$1 $$2 $$4}')
|
CLANG_VER = $(shell clang -v 2>&1 | head -n 1 | awk 'BEGIN {FS="[. ]"};{print $$1 $$2 $$4}')
|
||||||
ifeq ($(CLANG_VER),Appleclang15)
|
ifeq ($(CLANG_VER),Appleclang15)
|
||||||
LDFLAGS += -ld_classic
|
LDFLAGS += -ld_classic
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),FreeBSD)
|
ifeq ($(UNAME_S),FreeBSD)
|
||||||
CFLAGS += -pthread
|
CFLAGS += -pthread
|
||||||
|
@ -143,48 +143,48 @@ CXXV := $(shell $(CXX) --version | head -n 1)
|
||||||
# TODO: probably these flags need to be tweaked on some architectures
|
# TODO: probably these flags need to be tweaked on some architectures
|
||||||
# feel free to update the Makefile for your architecture and send a pull request or issue
|
# feel free to update the Makefile for your architecture and send a pull request or issue
|
||||||
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
||||||
# Use all CPU extensions that are available:
|
# Use all CPU extensions that are available:
|
||||||
# old library NEEDS mf16c to work. so we must build with it. new one doesnt
|
# old library NEEDS mf16c to work. so we must build with it. new one doesnt
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
ifdef LLAMA_PORTABLE
|
ifdef LLAMA_PORTABLE
|
||||||
CFLAGS +=
|
CFLAGS +=
|
||||||
NONECFLAGS +=
|
NONECFLAGS +=
|
||||||
SIMPLECFLAGS += -mavx -msse3 -mssse3
|
SIMPLECFLAGS += -mavx -msse3 -mssse3
|
||||||
SIMPLERCFLAGS += -msse3 -mssse3
|
SIMPLERCFLAGS += -msse3 -mssse3
|
||||||
ifdef LLAMA_NOAVX2
|
ifdef LLAMA_NOAVX2
|
||||||
FULLCFLAGS += -msse3 -mssse3 -mavx
|
FULLCFLAGS += -msse3 -mssse3 -mavx
|
||||||
else
|
else
|
||||||
FULLCFLAGS += -mavx2 -msse3 -mssse3 -mfma -mf16c -mavx
|
FULLCFLAGS += -mavx2 -msse3 -mssse3 -mfma -mf16c -mavx
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
CFLAGS += -march=native -mtune=native
|
CFLAGS += -march=native -mtune=native
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifdef LLAMA_PORTABLE
|
ifdef LLAMA_PORTABLE
|
||||||
CFLAGS +=
|
CFLAGS +=
|
||||||
NONECFLAGS +=
|
NONECFLAGS +=
|
||||||
SIMPLECFLAGS += -mavx -msse3 -mssse3
|
SIMPLECFLAGS += -mavx -msse3 -mssse3
|
||||||
SIMPLERCFLAGS += -msse3 -mssse3
|
SIMPLERCFLAGS += -msse3 -mssse3
|
||||||
ifdef LLAMA_NOAVX2
|
ifdef LLAMA_NOAVX2
|
||||||
FULLCFLAGS += -msse3 -mssse3 -mavx
|
FULLCFLAGS += -msse3 -mssse3 -mavx
|
||||||
else
|
else
|
||||||
FULLCFLAGS += -mavx2 -msse3 -mssse3 -mfma -mf16c -mavx
|
FULLCFLAGS += -mavx2 -msse3 -mssse3 -mfma -mf16c -mavx
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
CFLAGS += -march=native -mtune=native
|
CFLAGS += -march=native -mtune=native
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef LLAMA_NO_ACCELERATE
|
ifndef LLAMA_NO_ACCELERATE
|
||||||
# Mac M1 - include Accelerate framework.
|
# Mac M1 - include Accelerate framework.
|
||||||
# `-framework Accelerate` works on Mac Intel as well, with negliable performance boost (as of the predict time).
|
# `-framework Accelerate` works on Mac Intel as well, with negliable performance boost (as of the predict time).
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
CFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DGGML_BLAS_USE_ACCELERATE
|
CFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DGGML_BLAS_USE_ACCELERATE
|
||||||
CXXFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DGGML_BLAS_USE_ACCELERATE
|
CXXFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DGGML_BLAS_USE_ACCELERATE
|
||||||
LDFLAGS += -framework Accelerate
|
LDFLAGS += -framework Accelerate
|
||||||
OBJS += ggml-blas.o
|
OBJS += ggml-blas.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# it is recommended to use the CMAKE file to build for cublas if you can - will likely work better
|
# it is recommended to use the CMAKE file to build for cublas if you can - will likely work better
|
||||||
|
@ -265,17 +265,17 @@ ggml_v3-cuda.o: otherarch/ggml_v3-cuda.cu otherarch/ggml_v3-cuda.h
|
||||||
endif # LLAMA_CUBLAS
|
endif # LLAMA_CUBLAS
|
||||||
|
|
||||||
ifdef LLAMA_HIPBLAS
|
ifdef LLAMA_HIPBLAS
|
||||||
ifeq ($(wildcard /opt/rocm),)
|
ifeq ($(wildcard /opt/rocm),)
|
||||||
ROCM_PATH ?= /usr
|
ROCM_PATH ?= /usr
|
||||||
GPU_TARGETS ?= $(shell $(shell which amdgpu-arch))
|
GPU_TARGETS ?= $(shell $(shell which amdgpu-arch))
|
||||||
HCC := $(ROCM_PATH)/bin/hipcc
|
HCC := $(ROCM_PATH)/bin/hipcc
|
||||||
HCXX := $(ROCM_PATH)/bin/hipcc
|
HCXX := $(ROCM_PATH)/bin/hipcc
|
||||||
else
|
else
|
||||||
ROCM_PATH ?= /opt/rocm
|
ROCM_PATH ?= /opt/rocm
|
||||||
GPU_TARGETS ?= gfx803 gfx900 gfx906 gfx908 gfx90a gfx1030 gfx1100 $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch)
|
GPU_TARGETS ?= gfx803 gfx900 gfx906 gfx908 gfx90a gfx1030 gfx1100 $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch)
|
||||||
HCC := $(ROCM_PATH)/llvm/bin/clang
|
HCC := $(ROCM_PATH)/llvm/bin/clang
|
||||||
HCXX := $(ROCM_PATH)/llvm/bin/clang++
|
HCXX := $(ROCM_PATH)/llvm/bin/clang++
|
||||||
endif
|
endif
|
||||||
LLAMA_CUDA_DMMV_X ?= 32
|
LLAMA_CUDA_DMMV_X ?= 32
|
||||||
LLAMA_CUDA_MMV_Y ?= 1
|
LLAMA_CUDA_MMV_Y ?= 1
|
||||||
LLAMA_CUDA_KQUANTS_ITER ?= 2
|
LLAMA_CUDA_KQUANTS_ITER ?= 2
|
||||||
|
@ -320,26 +320,26 @@ ggml-metal.o: ggml/src/ggml-metal/ggml-metal.m ggml/src/ggml-metal/ggml-metal-im
|
||||||
endif # LLAMA_METAL
|
endif # LLAMA_METAL
|
||||||
|
|
||||||
ifneq ($(filter aarch64%,$(UNAME_M)),)
|
ifneq ($(filter aarch64%,$(UNAME_M)),)
|
||||||
# Apple M1, M2, etc.
|
# Apple M1, M2, etc.
|
||||||
# Raspberry Pi 3, 4, Zero 2 (64-bit)
|
# Raspberry Pi 3, 4, Zero 2 (64-bit)
|
||||||
ifdef LLAMA_PORTABLE
|
ifdef LLAMA_PORTABLE
|
||||||
CFLAGS +=
|
CFLAGS +=
|
||||||
CXXFLAGS +=
|
CXXFLAGS +=
|
||||||
else
|
else
|
||||||
# sve is cooked on termux so we are disabling it
|
# sve is cooked on termux so we are disabling it
|
||||||
ifeq ($(UNAME_O), Android)
|
ifeq ($(UNAME_O), Android)
|
||||||
ifneq ($(findstring clang, $(CCV)), )
|
ifneq ($(findstring clang, $(CCV)), )
|
||||||
CFLAGS += -mcpu=native+nosve
|
CFLAGS += -mcpu=native+nosve
|
||||||
CXXFLAGS += -mcpu=native+nosve
|
CXXFLAGS += -mcpu=native+nosve
|
||||||
else
|
else
|
||||||
CFLAGS += -mcpu=native
|
CFLAGS += -mcpu=native
|
||||||
CXXFLAGS += -mcpu=native
|
CXXFLAGS += -mcpu=native
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
CFLAGS += -mcpu=native
|
CFLAGS += -mcpu=native
|
||||||
CXXFLAGS += -mcpu=native
|
CXXFLAGS += -mcpu=native
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(filter armv6%,$(UNAME_M)),)
|
ifneq ($(filter armv6%,$(UNAME_M)),)
|
||||||
|
@ -359,10 +359,10 @@ ifneq ($(filter armv8%,$(UNAME_M)),)
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter ppc64%,$(UNAME_M)),)
|
ifneq ($(filter ppc64%,$(UNAME_M)),)
|
||||||
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)
|
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)
|
||||||
ifneq (,$(findstring POWER9,$(POWER9_M)))
|
ifneq (,$(findstring POWER9,$(POWER9_M)))
|
||||||
CFLAGS += -mcpu=power9
|
CFLAGS += -mcpu=power9
|
||||||
CXXFLAGS += -mcpu=power9
|
CXXFLAGS += -mcpu=power9
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,49 +377,49 @@ NOTIFY_MSG =
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
||||||
ifdef LLAMA_PORTABLE
|
ifdef LLAMA_PORTABLE
|
||||||
FAILSAFE_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
FAILSAFE_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
||||||
NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.dll $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef LLAMA_CLBLAST
|
ifdef LLAMA_CLBLAST
|
||||||
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ lib/OpenCL.lib lib/clblast.lib -shared -o $@.dll $(LDFLAGS)
|
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ lib/OpenCL.lib lib/clblast.lib -shared -o $@.dll $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_VULKAN
|
ifdef LLAMA_VULKAN
|
||||||
VULKAN_BUILD = $(CXX) $(CXXFLAGS) $^ lib/vulkan-1.lib -shared -o $@.dll $(LDFLAGS)
|
VULKAN_BUILD = $(CXX) $(CXXFLAGS) $^ lib/vulkan-1.lib -shared -o $@.dll $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef LLAMA_CUBLAS
|
ifdef LLAMA_CUBLAS
|
||||||
CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.dll $(CUBLASLD_FLAGS) $(LDFLAGS)
|
CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.dll $(CUBLASLD_FLAGS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_HIPBLAS
|
ifdef LLAMA_HIPBLAS
|
||||||
HIPBLAS_BUILD = $(HCXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.dll $(HIPLDFLAGS) $(LDFLAGS)
|
HIPBLAS_BUILD = $(HCXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.dll $(HIPLDFLAGS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
DEFAULT_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
||||||
ifdef LLAMA_PORTABLE
|
ifdef LLAMA_PORTABLE
|
||||||
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
||||||
FAILSAFE_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
FAILSAFE_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
||||||
NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
NOAVX2_BUILD = $(CXX) $(CXXFLAGS) $^ -shared -o $@.so $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef LLAMA_CLBLAST
|
ifdef LLAMA_CLBLAST
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -framework OpenCL $(ARCH_ADD) -shared -o $@.so $(LDFLAGS)
|
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -framework OpenCL $(ARCH_ADD) -shared -o $@.so $(LDFLAGS)
|
||||||
else
|
else
|
||||||
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -lOpenCL $(ARCH_ADD) -shared -o $@.so $(LDFLAGS)
|
CLBLAST_BUILD = $(CXX) $(CXXFLAGS) $^ -lclblast -lOpenCL $(ARCH_ADD) -shared -o $@.so $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_CUBLAS
|
ifdef LLAMA_CUBLAS
|
||||||
CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.so $(CUBLASLD_FLAGS) $(LDFLAGS)
|
CUBLAS_BUILD = $(CXX) $(CXXFLAGS) $(CUBLAS_FLAGS) $^ -shared -o $@.so $(CUBLASLD_FLAGS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_HIPBLAS
|
ifdef LLAMA_HIPBLAS
|
||||||
HIPBLAS_BUILD = $(HCXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.so $(HIPLDFLAGS) $(LDFLAGS)
|
HIPBLAS_BUILD = $(HCXX) $(CXXFLAGS) $(HIPFLAGS) $^ -shared -o $@.so $(HIPLDFLAGS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_VULKAN
|
ifdef LLAMA_VULKAN
|
||||||
VULKAN_BUILD = $(CXX) $(CXXFLAGS) $^ -lvulkan -shared -o $@.so $(LDFLAGS)
|
VULKAN_BUILD = $(CXX) $(CXXFLAGS) $^ -lvulkan -shared -o $@.so $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef LLAMA_CLBLAST
|
ifndef LLAMA_CLBLAST
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue