1
1
# Define the default target now so that it is always the first target
2
2
BUILD_TARGETS = \
3
3
main quantize quantize-stats perplexity embedding vdot q8dot train-text-from-scratch convert-llama2c-to-ggml \
4
- simple batched batched-bench save-load-state server gguf llama-bench llava baby-llama beam-search \
4
+ simple batched batched-bench save-load-state server gguf llama-bench libllava.a llava-cli baby-llama beam-search \
5
5
speculative infill benchmark-matmult parallel finetune export-lora tests/test-c.o
6
6
7
7
# Binaries only useful for tests
@@ -542,9 +542,9 @@ llama.o: llama.cpp ggml.h ggml-alloc.h ggml-backend.h ggml-cuda.h ggml-metal.h l
542
542
$(CXX ) $(CXXFLAGS ) -c $< -o $@
543
543
544
544
COMMON_H_DEPS = common/common.h common/sampling.h common/log.h
545
- COMMON_DEPS = common.o sampling.o grammar-parser.o
545
+ COMMON_DEPS = common.o sampling.o grammar-parser.o build-info.o
546
546
547
- common.o : common/common.cpp build-info.h $(COMMON_H_DEPS )
547
+ common.o : common/common.cpp $(COMMON_H_DEPS )
548
548
$(CXX ) $(CXXFLAGS ) -c $< -o $@
549
549
550
550
sampling.o : common/sampling.cpp $(COMMON_H_DEPS )
@@ -563,46 +563,46 @@ libllama.so: llama.o ggml.o $(OBJS)
563
563
$(CXX ) $(CXXFLAGS ) -shared -fPIC -o $@ $^ $(LDFLAGS )
564
564
565
565
clean :
566
- rm -vrf * .o tests/* .o * .so * .dll benchmark-matmult build-info.h * .dot $(COV_TARGETS ) $(BUILD_TARGETS ) $(TEST_TARGETS )
566
+ rm -vrf * .o tests/* .o * .so * .dll benchmark-matmult common/ build-info.cpp * .dot $(COV_TARGETS ) $(BUILD_TARGETS ) $(TEST_TARGETS )
567
567
568
568
#
569
569
# Examples
570
570
#
571
571
572
- main : examples/main/main.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) console.o grammar-parser.o $(OBJS )
572
+ main : examples/main/main.cpp ggml.o llama.o $(COMMON_DEPS ) console.o grammar-parser.o $(OBJS )
573
573
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
574
574
@echo
575
575
@echo ' ==== Run ./main -h for help. ===='
576
576
@echo
577
577
578
- infill : examples/infill/infill.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) console.o grammar-parser.o $(OBJS )
578
+ infill : examples/infill/infill.cpp ggml.o llama.o $(COMMON_DEPS ) console.o grammar-parser.o $(OBJS )
579
579
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
580
580
581
- simple : examples/simple/simple.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
581
+ simple : examples/simple/simple.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
582
582
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
583
583
584
- batched : examples/batched/batched.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
584
+ batched : examples/batched/batched.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
585
585
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
586
586
587
- batched-bench : examples/batched-bench/batched-bench.cpp build-info.h ggml.o llama.o common.o $(OBJS )
587
+ batched-bench : examples/batched-bench/batched-bench.cpp build-info.o ggml.o llama.o common.o $(OBJS )
588
588
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
589
589
590
- quantize : examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS )
590
+ quantize : examples/quantize/quantize.cpp build-info.o ggml.o llama.o $(OBJS )
591
591
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
592
592
593
- quantize-stats : examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS )
593
+ quantize-stats : examples/quantize-stats/quantize-stats.cpp build-info.o ggml.o llama.o $(OBJS )
594
594
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
595
595
596
- perplexity : examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
596
+ perplexity : examples/perplexity/perplexity.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
597
597
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
598
598
599
- embedding : examples/embedding/embedding.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
599
+ embedding : examples/embedding/embedding.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
600
600
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
601
601
602
- save-load-state : examples/save-load-state/save-load-state.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
602
+ save-load-state : examples/save-load-state/save-load-state.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
603
603
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
604
604
605
- server : examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h build-info.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
605
+ server : examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
606
606
$(CXX ) $(CXXFLAGS ) -Iexamples/server $(filter-out % .h,$(filter-out % .hpp,$^ ) ) -o $@ $(LDFLAGS ) $(LWINSOCK2 ) -Wno-cast-qual
607
607
608
608
gguf : examples/gguf/gguf.cpp ggml.o llama.o $(OBJS )
@@ -614,28 +614,31 @@ train-text-from-scratch: examples/train-text-from-scratch/train-text-from-scratc
614
614
convert-llama2c-to-ggml : examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp ggml.o llama.o $(OBJS )
615
615
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
616
616
617
- llama-bench : examples/llama-bench/llama-bench.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
617
+ llama-bench : examples/llama-bench/llama-bench.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
618
618
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
619
619
620
- llava : examples/llava/llava.cpp examples/llava/llava-utils.h examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
620
+ libllava.a : examples/llava/llava.cpp examples/llava/llava.h examples/llava/clip.cpp examples/llava/clip.h common/stb_image.h common/base64.hpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
621
+ $(CXX ) $(CXXFLAGS ) -static -fPIC -c $< -o $@ -Wno-cast-qual
622
+
623
+ llava-cli : examples/llava/llava-cli.cpp examples/llava/clip.h examples/llava/clip.cpp examples/llava/llava.h examples/llava/llava.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
621
624
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS ) -Wno-cast-qual
622
625
623
626
baby-llama : examples/baby-llama/baby-llama.cpp ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
624
627
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
625
628
626
- beam-search : examples/beam-search/beam-search.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
629
+ beam-search : examples/beam-search/beam-search.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
627
630
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
628
631
629
- finetune : examples/finetune/finetune.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
632
+ finetune : examples/finetune/finetune.cpp ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
630
633
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
631
634
632
- export-lora : examples/export-lora/export-lora.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
635
+ export-lora : examples/export-lora/export-lora.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
633
636
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
634
637
635
- speculative : examples/speculative/speculative.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
638
+ speculative : examples/speculative/speculative.cpp ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
636
639
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
637
640
638
- parallel : examples/parallel/parallel.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
641
+ parallel : examples/parallel/parallel.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
639
642
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
640
643
641
644
ifdef LLAMA_METAL
@@ -648,21 +651,24 @@ swift: examples/batched.swift
648
651
(cd examples/batched.swift; make build)
649
652
endif
650
653
651
- build-info.h : $(wildcard .git/index) scripts/build-info.sh
654
+ common/ build-info.cpp : $(wildcard .git/index) scripts/build-info.sh
652
655
@sh scripts/build-info.sh $(CC ) > $@ .tmp
653
656
@if ! cmp -s $@ .tmp $@ ; then \
654
657
mv $@ .tmp $@ ; \
655
658
else \
656
659
rm $@ .tmp; \
657
660
fi
658
661
662
+ build-info.o : common/build-info.cpp
663
+ $(CXX ) $(CXXFLAGS ) -c $(filter-out % .h,$^ ) -o $@
664
+
659
665
#
660
666
# Tests
661
667
#
662
668
663
669
tests : $(TEST_TARGETS )
664
670
665
- benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS )
671
+ benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.o ggml.o $(OBJS )
666
672
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
667
673
668
674
run-benchmark-matmult : benchmark-matmult
@@ -676,40 +682,40 @@ vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
676
682
q8dot : pocs/vdot/q8dot.cpp ggml.o $(OBJS )
677
683
$(CXX ) $(CXXFLAGS ) $^ -o $@ $(LDFLAGS )
678
684
679
- tests/test-llama-grammar : tests/test-llama-grammar.cpp build-info.h ggml.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
685
+ tests/test-llama-grammar : tests/test-llama-grammar.cpp ggml.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
680
686
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
681
687
682
- tests/test-grammar-parser : tests/test-grammar-parser.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
688
+ tests/test-grammar-parser : tests/test-grammar-parser.cpp ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
683
689
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
684
690
685
- tests/test-double-float : tests/test-double-float.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
691
+ tests/test-double-float : tests/test-double-float.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
686
692
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
687
693
688
- tests/test-grad0 : tests/test-grad0.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
694
+ tests/test-grad0 : tests/test-grad0.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
689
695
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
690
696
691
- tests/test-opt : tests/test-opt.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
697
+ tests/test-opt : tests/test-opt.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
692
698
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
693
699
694
- tests/test-quantize-fns : tests/test-quantize-fns.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
700
+ tests/test-quantize-fns : tests/test-quantize-fns.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
695
701
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
696
702
697
- tests/test-quantize-perf : tests/test-quantize-perf.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
703
+ tests/test-quantize-perf : tests/test-quantize-perf.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
698
704
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
699
705
700
- tests/test-sampling : tests/test-sampling.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
706
+ tests/test-sampling : tests/test-sampling.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
701
707
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
702
708
703
- tests/test-tokenizer-0-falcon : tests/test-tokenizer-0-falcon.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
709
+ tests/test-tokenizer-0-falcon : tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
704
710
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
705
711
706
- tests/test-tokenizer-0-llama : tests/test-tokenizer-0-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
712
+ tests/test-tokenizer-0-llama : tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
707
713
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
708
714
709
- tests/test-tokenizer-1-bpe : tests/test-tokenizer-1-bpe.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
715
+ tests/test-tokenizer-1-bpe : tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
710
716
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
711
717
712
- tests/test-tokenizer-1-llama : tests/test-tokenizer-1-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
718
+ tests/test-tokenizer-1-llama : tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
713
719
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
714
720
715
721
tests/test-c.o : tests/test-c.c llama.h
0 commit comments