aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDannyDaemonic <DannyDaemonic@gmail.com>2023-05-01 09:23:47 -0700
committerGitHub <noreply@github.com>2023-05-01 18:23:47 +0200
commitf4cef87edfd1b2f8d5befd4fde54ca2e03987bea (patch)
treeb63939423df54fa5714e964e19e830811a990064 /Makefile
parent58b367c2d757c0ea12aec672382462b42204c724 (diff)
Add git-based build information for better issue tracking (#1232)
* Add git-based build information for better issue tracking * macOS fix * "build (hash)" and "CMAKE_SOURCE_DIR" changes * Redo "CMAKE_CURRENT_SOURCE_DIR" and clearer build messages * Fix conditional dependency on missing target * Broke out build-info.cmake, added find_package fallback, and added build into to all examples, added dependencies to Makefile * 4 space indenting for cmake, attempt to clean up my mess in Makefile * Short hash, less fancy Makefile, and don't modify build-info.h if it wouldn't change it
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile49
1 files changed, 32 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 1d62a44..6ebc3c5 100644
--- a/Makefile
+++ b/Makefile
@@ -181,41 +181,56 @@ llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
common.o: examples/common.cpp examples/common.h
$(CXX) $(CXXFLAGS) -c $< -o $@
+libllama.so: llama.o ggml.o $(OBJS)
+ $(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
+
clean:
- rm -vf *.o main quantize quantize-stats perplexity embedding benchmark-matmult
+ rm -vf *.o main quantize quantize-stats perplexity embedding benchmark-matmult save-load-state build-info.h
-main: examples/main/main.cpp ggml.o llama.o common.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+#
+# Examples
+#
+
+main: examples/main/main.cpp build-info.h ggml.o llama.o common.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
@echo
@echo '==== Run ./main -h for help. ===='
@echo
-quantize: examples/quantize/quantize.cpp ggml.o llama.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+quantize: examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
-quantize-stats: examples/quantize-stats/quantize-stats.cpp ggml.o llama.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
-perplexity: examples/perplexity/perplexity.cpp ggml.o llama.o common.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+perplexity: examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o common.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
-embedding: examples/embedding/embedding.cpp ggml.o llama.o common.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+embedding: examples/embedding/embedding.cpp build-info.h ggml.o llama.o common.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
-vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+save-load-state: examples/save-load-state/save-load-state.cpp build-info.h ggml.o llama.o common.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
-libllama.so: llama.o ggml.o $(OBJS)
- $(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
+build-info.h: $(wildcard .git/index) scripts/build-info.sh
+ @scripts/build-info.sh > $@.tmp
+ @if ! cmp -s $@.tmp $@; then \
+ mv $@.tmp $@; \
+ else \
+ rm $@.tmp; \
+ fi
#
# Tests
#
-benchmark-matmult: examples/benchmark/benchmark-matmult.cpp ggml.o $(OBJS)
- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+benchmark-matmult: examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
./$@
+vdot: pocs/vdot/vdot.cpp ggml.o $(OBJS)
+ $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS)
+
.PHONY: tests
tests:
bash ./tests/run-tests.sh