|
1 | 1 | # Define the default target now so that it is always the first target
|
2 | 2 | BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot train-text-from-scratch simple server embd-input-test
|
3 | 3 |
|
| 4 | +# Binaries only useful for tests |
| 5 | +TEST_TARGETS = 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 |
| 6 | + |
4 | 7 | default: $(BUILD_TARGETS)
|
5 | 8 |
|
6 | 9 | ifndef UNAME_S
|
@@ -316,7 +319,7 @@ libllama.so: llama.o ggml.o $(OBJS)
|
316 | 319 | $(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
317 | 320 |
|
318 | 321 | clean:
|
319 |
| - rm -vf *.o *.so *.dll main quantize quantize-stats perplexity embedding benchmark-matmult save-load-state server simple vdot train-text-from-scratch embd-input-test build-info.h |
| 322 | + rm -vf *.o *.so *.dll main quantize quantize-stats perplexity embedding benchmark-matmult save-load-state server simple vdot train-text-from-scratch embd-input-test build-info.h $(TEST_TARGETS) |
320 | 323 |
|
321 | 324 | #
|
322 | 325 | # Examples
|
@@ -371,13 +374,32 @@ build-info.h: $(wildcard .git/index) scripts/build-info.sh
|
371 | 374 | # Tests
|
372 | 375 | #
|
373 | 376 |
|
| 377 | +tests: $(TEST_TARGETS) |
| 378 | + |
374 | 379 | benchmark-matmult: examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS)
|
375 | 380 | $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
376 | 381 | ./$@
|
377 | 382 |
|
378 | 383 | vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
|
379 | 384 | $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
|
380 | 385 |
|
381 |
| -.PHONY: tests clean |
382 |
| -tests: |
383 |
| - bash ./tests/run-tests.sh |
| 386 | +tests/test-double-float: tests/test-double-float.c build-info.h ggml.o llama.o common.o $(OBJS) |
| 387 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 388 | + |
| 389 | +tests/test-grad0: tests/test-grad0.c build-info.h ggml.o llama.o common.o $(OBJS) |
| 390 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 391 | + |
| 392 | +tests/test-opt: tests/test-opt.c build-info.h ggml.o llama.o common.o $(OBJS) |
| 393 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 394 | + |
| 395 | +tests/test-quantize-fns: tests/test-quantize-fns.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 396 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 397 | + |
| 398 | +tests/test-quantize-perf: tests/test-quantize-perf.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 399 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 400 | + |
| 401 | +tests/test-sampling: tests/test-sampling.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 402 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
| 403 | + |
| 404 | +tests/test-tokenizer-0: tests/test-tokenizer-0.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 405 | + $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) |
0 commit comments