clean up makefile

This commit is contained in:
Concedo 2024-12-05 23:58:23 +08:00
parent d0d1d922de
commit ece96e19bf

View file

@ -1,11 +1,13 @@
# Add custom options to Makefile.local rather than editing this file. # Add custom options to Makefile.local rather than editing this file.
-include $(abspath $(lastword ${MAKEFILE_LIST})).local -include $(abspath $(lastword ${MAKEFILE_LIST})).local
default: koboldcpp_default koboldcpp_failsafe koboldcpp_noavx2 koboldcpp_clblast koboldcpp_clblast_noavx2 koboldcpp_cublas koboldcpp_hipblas koboldcpp_vulkan koboldcpp_vulkan_noavx2 .PHONY: finishedmsg
default: koboldcpp_default koboldcpp_failsafe koboldcpp_noavx2 koboldcpp_clblast koboldcpp_clblast_noavx2 koboldcpp_cublas koboldcpp_hipblas koboldcpp_vulkan koboldcpp_vulkan_noavx2 finishedmsg
tools: quantize_gpt2 quantize_gptj quantize_gguf quantize_neox quantize_mpt quantize_clip whispermain sdmain gguf-split tools: quantize_gpt2 quantize_gptj quantize_gguf quantize_neox quantize_mpt quantize_clip whispermain sdmain gguf-split
dev: koboldcpp_default dev: koboldcpp_default
dev2: koboldcpp_clblast dev2: koboldcpp_clblast
dev3: koboldcpp_vulkan dev3: koboldcpp_vulkan finishedmsg
ifndef UNAME_S ifndef UNAME_S
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
@ -134,7 +136,7 @@ endif
# Architecture specific # Architecture specific
# 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)) 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)
@ -309,9 +311,13 @@ 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)
CFLAGS += ifdef LLAMA_PORTABLE
CXXFLAGS += else
CFLAGS += -mcpu=native
CXXFLAGS += -mcpu=native
endif endif
endif
ifneq ($(filter armv6%,$(UNAME_M)),) ifneq ($(filter armv6%,$(UNAME_M)),)
# Raspberry Pi 1, Zero # Raspberry Pi 1, Zero
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
@ -343,6 +349,7 @@ CLBLAST_BUILD =
CUBLAS_BUILD = CUBLAS_BUILD =
HIPBLAS_BUILD = HIPBLAS_BUILD =
VULKAN_BUILD = VULKAN_BUILD =
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)
@ -360,9 +367,11 @@ ifeq ($(OS),Windows_NT)
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))
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
ifdef LLAMA_CLBLAST ifdef LLAMA_CLBLAST
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
@ -385,7 +394,9 @@ else
ifndef LLAMA_CUBLAS ifndef LLAMA_CUBLAS
ifndef LLAMA_HIPBLAS ifndef LLAMA_HIPBLAS
ifndef LLAMA_VULKAN ifndef LLAMA_VULKAN
VULKAN_BUILD = @echo 'Your OS $(OS) does not appear to be Windows. For faster speeds, install and link a BLAS library. Set LLAMA_VULKAN=1 to compile with Vulkan support. This is just a reminder, not an error.' ifndef LLAMA_METAL
NOTIFY_MSG = @echo -e '\nYou did a basic CPU build. For faster speeds, install and link a BLAS library. \nSet LLAMA_VULKAN=1 to compile with Vulkan support. This is just a reminder, not an error.'
endif
endif endif
endif endif
endif endif
@ -721,3 +732,8 @@ simpleclinfo: simpleclinfo.cpp
build-info.h: build-info.h:
$(DONOTHING) $(DONOTHING)
#phony for printing messages
finishedmsg:
$(NOTIFY_MSG)
$(DONOTHING)