@@ -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,7 +614,7 @@ 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
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 )
@@ -623,19 +623,19 @@ llava: examples/llava/llava.cpp examples/llava/llava-utils.h examples/llava/clip
623
623
baby-llama : examples/baby-llama/baby-llama.cpp ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
624
624
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
625
625
626
- beam-search : examples/beam-search/beam-search.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
626
+ beam-search : examples/beam-search/beam-search.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
627
627
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
628
628
629
- finetune : examples/finetune/finetune.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
629
+ finetune : examples/finetune/finetune.cpp ggml.o llama.o $(COMMON_DEPS ) train.o $(OBJS )
630
630
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
631
631
632
- export-lora : examples/export-lora/export-lora.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
632
+ export-lora : examples/export-lora/export-lora.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
633
633
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
634
634
635
- speculative : examples/speculative/speculative.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
635
+ speculative : examples/speculative/speculative.cpp ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
636
636
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
637
637
638
- parallel : examples/parallel/parallel.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
638
+ parallel : examples/parallel/parallel.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
639
639
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
640
640
641
641
ifdef LLAMA_METAL
@@ -648,21 +648,24 @@ swift: examples/batched.swift
648
648
(cd examples/batched.swift; make build)
649
649
endif
650
650
651
- build-info.h : $(wildcard .git/index) scripts/build-info.sh
651
+ common/ build-info.cpp : $(wildcard .git/index) scripts/build-info.sh
652
652
@sh scripts/build-info.sh $(CC ) > $@ .tmp
653
653
@if ! cmp -s $@ .tmp $@ ; then \
654
654
mv $@ .tmp $@ ; \
655
655
else \
656
656
rm $@ .tmp; \
657
657
fi
658
658
659
+ build-info.o : common/build-info.cpp
660
+ $(CXX ) $(CXXFLAGS ) -c $(filter-out % .h,$^ ) -o $@
661
+
659
662
#
660
663
# Tests
661
664
#
662
665
663
666
tests : $(TEST_TARGETS )
664
667
665
- benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS )
668
+ benchmark-matmult : examples/benchmark/benchmark-matmult.cpp build-info.o ggml.o $(OBJS )
666
669
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
667
670
668
671
run-benchmark-matmult : benchmark-matmult
@@ -676,40 +679,40 @@ vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
676
679
q8dot : pocs/vdot/q8dot.cpp ggml.o $(OBJS )
677
680
$(CXX ) $(CXXFLAGS ) $^ -o $@ $(LDFLAGS )
678
681
679
- tests/test-llama-grammar : tests/test-llama-grammar.cpp build-info.h ggml.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
682
+ tests/test-llama-grammar : tests/test-llama-grammar.cpp ggml.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
680
683
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
681
684
682
- tests/test-grammar-parser : tests/test-grammar-parser.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
685
+ tests/test-grammar-parser : tests/test-grammar-parser.cpp ggml.o llama.o $(COMMON_DEPS ) grammar-parser.o $(OBJS )
683
686
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
684
687
685
- tests/test-double-float : tests/test-double-float.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
688
+ tests/test-double-float : tests/test-double-float.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
686
689
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
687
690
688
- tests/test-grad0 : tests/test-grad0.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
691
+ tests/test-grad0 : tests/test-grad0.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
689
692
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
690
693
691
- tests/test-opt : tests/test-opt.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
694
+ tests/test-opt : tests/test-opt.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
692
695
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
693
696
694
- tests/test-quantize-fns : tests/test-quantize-fns.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
697
+ tests/test-quantize-fns : tests/test-quantize-fns.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
695
698
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
696
699
697
- tests/test-quantize-perf : tests/test-quantize-perf.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
700
+ tests/test-quantize-perf : tests/test-quantize-perf.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
698
701
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
699
702
700
- tests/test-sampling : tests/test-sampling.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
703
+ tests/test-sampling : tests/test-sampling.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
701
704
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
702
705
703
- tests/test-tokenizer-0-falcon : tests/test-tokenizer-0-falcon.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
706
+ tests/test-tokenizer-0-falcon : tests/test-tokenizer-0-falcon.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
704
707
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
705
708
706
- tests/test-tokenizer-0-llama : tests/test-tokenizer-0-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
709
+ tests/test-tokenizer-0-llama : tests/test-tokenizer-0-llama.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
707
710
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
708
711
709
- tests/test-tokenizer-1-bpe : tests/test-tokenizer-1-bpe.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
712
+ tests/test-tokenizer-1-bpe : tests/test-tokenizer-1-bpe.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
710
713
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
711
714
712
- tests/test-tokenizer-1-llama : tests/test-tokenizer-1-llama.cpp build-info.h ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
715
+ tests/test-tokenizer-1-llama : tests/test-tokenizer-1-llama.cpp ggml.o llama.o $(COMMON_DEPS ) $(OBJS )
713
716
$(CXX ) $(CXXFLAGS ) $(filter-out % .h,$^ ) -o $@ $(LDFLAGS )
714
717
715
718
tests/test-c.o : tests/test-c.c llama.h
0 commit comments