Replaced Makefile with original one
This commit is contained in:
parent
ebef9ed890
commit
f1c3abcf71
1 changed files with 14 additions and 30 deletions
44
Makefile
44
Makefile
|
@ -2,7 +2,7 @@
|
||||||
BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot train-text-from-scratch convert-llama2c-to-ggml simple save-load-state server embd-input-test gguf llama-bench baby-llama beam-search speculative tests/test-c.o
|
BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot train-text-from-scratch convert-llama2c-to-ggml simple save-load-state server embd-input-test gguf llama-bench baby-llama beam-search speculative tests/test-c.o
|
||||||
|
|
||||||
# Binaries only useful for tests
|
# Binaries only useful for tests
|
||||||
TEST_TARGETS = tests/test-llama-grammar tests/test-grammar-parser tests/test-double-float tests/test-grad0 tests/test-opt tests/test-quantize-fns tests/test-quantize-perf tests/test-sampling tests/test-tokenizer-0-llama tests/test-tokenizer-0-falcon tests/test-tokenizer-1
|
TEST_TARGETS = tests/test-llama-grammar tests/test-grammar-parser tests/test-double-float tests/test-grad0 tests/test-opt tests/test-quantize-fns tests/test-quantize-perf tests/test-sampling tests/test-tokenizer-0-llama tests/test-tokenizer-0-falcon tests/test-tokenizer-1-llama
|
||||||
|
|
||||||
# Code coverage output files
|
# Code coverage output files
|
||||||
COV_TARGETS = *.gcno tests/*.gcno *.gcda tests/*.gcda *.gcov tests/*.gcov lcov-report gcovr-report
|
COV_TARGETS = *.gcno tests/*.gcno *.gcda tests/*.gcda *.gcov tests/*.gcov lcov-report gcovr-report
|
||||||
|
@ -19,14 +19,6 @@ ifndef UNAME_M
|
||||||
UNAME_M := $(shell uname -m)
|
UNAME_M := $(shell uname -m)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef RISCV_CROSS_COMPILE
|
|
||||||
CC := riscv64-unknown-linux-gnu-gcc
|
|
||||||
CXX := riscv64-unknown-linux-gnu-g++
|
|
||||||
endif
|
|
||||||
|
|
||||||
CCV := $(shell $(CC) --version | head -n 1)
|
|
||||||
CXXV := $(shell $(CXX) --version | head -n 1)
|
|
||||||
|
|
||||||
# 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)
|
||||||
|
@ -57,7 +49,7 @@ test: $(TEST_TARGETS)
|
||||||
./$$test_target $(CURDIR)/models/ggml-vocab-llama.gguf; \
|
./$$test_target $(CURDIR)/models/ggml-vocab-llama.gguf; \
|
||||||
elif [ "$$test_target" = "tests/test-tokenizer-0-falcon" ]; then \
|
elif [ "$$test_target" = "tests/test-tokenizer-0-falcon" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
elif [ "$$test_target" = "tests/test-tokenizer-1" ]; then \
|
elif [ "$$test_target" = "tests/test-tokenizer-1-llama" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
else \
|
else \
|
||||||
echo "Running test $$test_target..."; \
|
echo "Running test $$test_target..."; \
|
||||||
|
@ -118,50 +110,42 @@ MK_LDFLAGS =
|
||||||
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
||||||
# posix_memalign came in POSIX.1-2001 / SUSv3
|
# posix_memalign came in POSIX.1-2001 / SUSv3
|
||||||
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
||||||
MK_CFLAGS += -D_XOPEN_SOURCE=600
|
MK_CPPFLAGS += -D_XOPEN_SOURCE=600
|
||||||
MK_CXXFLAGS += -D_XOPEN_SOURCE=600
|
|
||||||
|
|
||||||
# Somehow in OpenBSD whenever POSIX conformance is specified
|
# Somehow in OpenBSD whenever POSIX conformance is specified
|
||||||
# some string functions rely on locale_t availability,
|
# some string functions rely on locale_t availability,
|
||||||
# which was introduced in POSIX.1-2008, forcing us to go higher
|
# which was introduced in POSIX.1-2008, forcing us to go higher
|
||||||
ifeq ($(UNAME_S),OpenBSD)
|
ifeq ($(UNAME_S),OpenBSD)
|
||||||
MK_CFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
|
MK_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
|
||||||
MK_CXXFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Data types, macros and functions related to controlling CPU affinity and
|
# Data types, macros and functions related to controlling CPU affinity and
|
||||||
# some memory allocation are available on Linux through GNU extensions in libc
|
# some memory allocation are available on Linux through GNU extensions in libc
|
||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
MK_CFLAGS += -D_GNU_SOURCE
|
MK_CPPFLAGS += -D_GNU_SOURCE
|
||||||
MK_CXXFLAGS += -D_GNU_SOURCE
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
||||||
# and on macOS its availability depends on enabling Darwin extensions
|
# and on macOS its availability depends on enabling Darwin extensions
|
||||||
# similarly on DragonFly, enabling BSD extensions is necessary
|
# similarly on DragonFly, enabling BSD extensions is necessary
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
MK_CFLAGS += -D_DARWIN_C_SOURCE
|
MK_CPPFLAGS += -D_DARWIN_C_SOURCE
|
||||||
MK_CXXFLAGS += -D_DARWIN_C_SOURCE
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),DragonFly)
|
ifeq ($(UNAME_S),DragonFly)
|
||||||
MK_CFLAGS += -D__BSD_VISIBLE
|
MK_CPPFLAGS += -D__BSD_VISIBLE
|
||||||
MK_CXXFLAGS += -D__BSD_VISIBLE
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# alloca is a non-standard interface that is not visible on BSDs when
|
# alloca is a non-standard interface that is not visible on BSDs when
|
||||||
# POSIX conformance is specified, but not all of them provide a clean way
|
# POSIX conformance is specified, but not all of them provide a clean way
|
||||||
# to enable it in such cases
|
# to enable it in such cases
|
||||||
ifeq ($(UNAME_S),FreeBSD)
|
ifeq ($(UNAME_S),FreeBSD)
|
||||||
MK_CFLAGS += -D__BSD_VISIBLE
|
MK_CPPFLAGS += -D__BSD_VISIBLE
|
||||||
MK_CXXFLAGS += -D__BSD_VISIBLE
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),NetBSD)
|
ifeq ($(UNAME_S),NetBSD)
|
||||||
MK_CFLAGS += -D_NETBSD_SOURCE
|
MK_CPPFLAGS += -D_NETBSD_SOURCE
|
||||||
MK_CXXFLAGS += -D_NETBSD_SOURCE
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),OpenBSD)
|
ifeq ($(UNAME_S),OpenBSD)
|
||||||
MK_CFLAGS += -D_BSD_SOURCE
|
MK_CPPFLAGS += -D_BSD_SOURCE
|
||||||
MK_CXXFLAGS += -D_BSD_SOURCE
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef LLAMA_DEBUG
|
ifdef LLAMA_DEBUG
|
||||||
|
@ -190,7 +174,7 @@ MK_CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow
|
||||||
-Wmissing-prototypes -Werror=implicit-int -Wno-unused-function
|
-Wmissing-prototypes -Werror=implicit-int -Wno-unused-function
|
||||||
MK_CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar
|
MK_CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar
|
||||||
|
|
||||||
ifeq '' '$(findstring clang++,$(CXX))'
|
ifeq '' '$(findstring clang,$(shell $(CXX) --version))'
|
||||||
# g++ only
|
# g++ only
|
||||||
MK_CXXFLAGS += -Wno-format-truncation -Wno-array-bounds
|
MK_CXXFLAGS += -Wno-format-truncation -Wno-array-bounds
|
||||||
endif
|
endif
|
||||||
|
@ -294,8 +278,8 @@ ifneq ($(filter ppc64%,$(UNAME_M)),)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
CFLAGS += -march=rv64gcv -mabi=lp64d
|
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
|
||||||
CXXFLAGS += -march=rv64gcv -mabi=lp64d
|
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef LLAMA_NO_K_QUANTS
|
ifndef LLAMA_NO_K_QUANTS
|
||||||
|
@ -613,7 +597,7 @@ tests/test-tokenizer-0-falcon: tests/test-tokenizer-0-falcon.cpp build-info.h gg
|
||||||
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp build-info.h ggml.o llama.o common.o $(OBJS)
|
tests/test-tokenizer-0-llama: tests/test-tokenizer-0-llama.cpp build-info.h ggml.o llama.o common.o $(OBJS)
|
||||||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
tests/test-tokenizer-1: tests/test-tokenizer-1.cpp build-info.h ggml.o llama.o common.o $(OBJS)
|
tests/test-tokenizer-1-llama: tests/test-tokenizer-1-llama.cpp build-info.h ggml.o llama.o common.o $(OBJS)
|
||||||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
tests/test-c.o: tests/test-c.c llama.h
|
tests/test-c.o: tests/test-c.c llama.h
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue