@@ -6,11 +6,23 @@ BUILD_TARGETS = \
66
77# Binaries only useful for tests
88TEST_TARGETS = \
9- tests/test-llama-grammar tests/test-grammar-parser tests/test-double-float tests/test-grad0 tests/test-opt \
10- tests/test-quantize-fns tests/test-quantize-perf tests/test-sampling tests/test-tokenizer-0-llama \
11- tests/test-tokenizer-0-falcon tests/test-tokenizer-1-llama tests/test-tokenizer-1-bpe tests/test-rope \
12- tests/test-backend-ops tests/test-model-load-cancel tests/test-autorelease \
13- tests/test-json-schema-to-grammar tests/test-grammar-integration
9+ tests/test-autorelease \
10+ tests/test-backend-ops \
11+ tests/test-double-float \
12+ tests/test-grad0 \
13+ tests/test-grammar-integration \
14+ tests/test-grammar-parser \
15+ tests/test-json-schema-to-grammar \
16+ tests/test-llama-grammar \
17+ tests/test-model-load-cancel \
18+ tests/test-opt \
19+ tests/test-quantize-fns \
20+ tests/test-quantize-perf \
21+ tests/test-rope \
22+ tests/test-sampling \
23+ tests/test-tokenizer-0 \
24+ tests/test-tokenizer-1-bpe \
25+ tests/test-tokenizer-1-spm
1426
1527# Code coverage output files
1628COV_TARGETS = *.gcno tests/*.gcno *.gcda tests/*.gcda *.gcov tests/*.gcov lcov-report gcovr-report
@@ -27,6 +39,17 @@ ifndef UNAME_M
2739UNAME_M := $(shell uname -m)
2840endif
2941
42+ # In GNU make default CXX is g++ instead of c++. Let's fix that so that users
43+ # of non-gcc compilers don't have to provide g++ alias or wrapper.
44+ DEFCC := cc
45+ DEFCXX := c++
46+ ifeq ($(origin CC ) ,default)
47+ CC := $(DEFCC )
48+ endif
49+ ifeq ($(origin CXX ) ,default)
50+ CXX := $(DEFCXX )
51+ endif
52+
3053# Mac OS + Arm can report x86_64
3154# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
3255ifeq ($(UNAME_S ) ,Darwin)
@@ -49,11 +72,17 @@ default: $(BUILD_TARGETS)
4972test : $(TEST_TARGETS )
5073 @failures=0; \
5174 for test_target in $( TEST_TARGETS) ; do \
52- if [ " $$ test_target" = " tests/test-tokenizer-0-llama" ]; then \
53- ./$$ test_target $(CURDIR ) /models/ggml-vocab-llama.gguf; \
54- elif [ " $$ test_target" = " tests/test-tokenizer-0-falcon" ]; then \
75+ if [ " $$ test_target" = " tests/test-tokenizer-0" ]; then \
76+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-llama-spm.gguf; \
77+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-llama-bpe.gguf; \
78+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-phi-3.gguf; \
5579 ./$$ test_target $(CURDIR ) /models/ggml-vocab-falcon.gguf; \
56- elif [ " $$ test_target" = " tests/test-tokenizer-1-llama" ]; then \
80+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-deepseek-coder.gguf; \
81+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-deepseek-llm.gguf; \
82+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-bert-bge.gguf; \
83+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-starcoder.gguf; \
84+ ./$$ test_target $(CURDIR ) /models/ggml-vocab-gpt-2.gguf; \
85+ elif [ " $$ test_target" = " tests/test-tokenizer-1-spm" ]; then \
5786 continue ; \
5887 elif [ " $$ test_target" = " tests/test-tokenizer-1-bpe" ]; then \
5988 continue ; \
@@ -971,19 +1000,15 @@ tests/test-sampling: tests/test-sampling.cpp ggml.o llama.o $(OBJS)
9711000 $(CXX ) $(CXXFLAGS ) -c $< -o $(call GET_OBJ_FILE, $< )
9721001 $(CXX ) $(CXXFLAGS ) $(filter-out % .h $< ,$^ ) $(call GET_OBJ_FILE, $< ) -o $@ $(LDFLAGS )
9731002
974- tests/test-tokenizer-0-falcon : tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
975- $(CXX ) $(CXXFLAGS ) -c $< -o $(call GET_OBJ_FILE, $< )
976- $(CXX ) $(CXXFLAGS ) $(filter-out % .h $< ,$^ ) $(call GET_OBJ_FILE, $< ) -o $@ $(LDFLAGS )
977-
978- tests/test-tokenizer-0-llama : tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
1003+ tests/test-tokenizer-0 : tests/test-tokenizer-0.cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
9791004 $(CXX ) $(CXXFLAGS ) -c $< -o $(call GET_OBJ_FILE, $< )
9801005 $(CXX ) $(CXXFLAGS ) $(filter-out % .h $< ,$^ ) $(call GET_OBJ_FILE, $< ) -o $@ $(LDFLAGS )
9811006
9821007tests/test-tokenizer-1-bpe : tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
9831008 $(CXX ) $(CXXFLAGS ) -c $< -o $(call GET_OBJ_FILE, $< )
9841009 $(CXX ) $(CXXFLAGS ) $(filter-out % .h $< ,$^ ) $(call GET_OBJ_FILE, $< ) -o $@ $(LDFLAGS )
9851010
986- tests/test-tokenizer-1-llama : tests/test-tokenizer-1-llama .cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
1011+ tests/test-tokenizer-1-spm : tests/test-tokenizer-1-spm .cpp ggml.o llama.o $(COMMON_DEPS ) console.o $(OBJS )
9871012 $(CXX ) $(CXXFLAGS ) -c $< -o $(call GET_OBJ_FILE, $< )
9881013 $(CXX ) $(CXXFLAGS ) $(filter-out % .h $< ,$^ ) $(call GET_OBJ_FILE, $< ) -o $@ $(LDFLAGS )
9891014
0 commit comments