summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-02-23 15:08:45 +0000
committerlhchavez <[email protected]>2020-02-23 15:08:45 +0000
commit3c88bd9f1aebc53ea9d77937829f8c155aa834c3 (patch)
tree8556d00fb42f2fcab5ba748e49e21e1141b9d604 /Makefile
parentc75e0221d70bc471917aa3de34ca1ead1a747987 (diff)
parent21d618136f415486d95965e75af80c0e6688a0d5 (diff)
Merge remote-tracking branch 'upstream/master' into cherrypick-commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile51
1 files changed, 43 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index cf00cef..182c53e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,53 @@
default: test
-test: build-libgit2
+# System library
+# ==============
+# This uses whatever version of libgit2 can be found in the system.
+test:
go run script/check-MakeGitError-thread-lock.go
- go test ./...
+ go test --count=1 ./...
-install: build-libgit2
+install:
go install ./...
-build-libgit2:
+# Bundled dynamic library
+# =======================
+# In order to avoid having to manipulate `git_dynamic.go`, which would prevent
+# the system-wide libgit2.so from being used in a sort of ergonomic way, this
+# instead moves the complexity of overriding the paths so that the built
+# libraries can be found by the build and tests.
+.PHONY: build-libgit2-dynamic
+build-libgit2-dynamic:
+ ./script/build-libgit2-dynamic.sh
+
+dynamic-build/install/lib/libgit2.so:
+ ./script/build-libgit2-dynamic.sh
+
+test-dynamic: dynamic-build/install/lib/libgit2.so
+ PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
+ go run script/check-MakeGitError-thread-lock.go
+ PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
+ LD_LIBRARY_PATH=dynamic-build/install/lib \
+ go test --count=1 ./...
+
+install-dynamic: dynamic-build/install/lib/libgit2.so
+ PKG_CONFIG_PATH=dynamic-build/install/lib/pkgconfig \
+ go install ./...
+
+# Bundled static library
+# ======================
+# This is mostly used in tests, but can also be used to provide a
+# statically-linked library with the bundled version of libgit2.
+.PHONY: build-libgit2-static
+build-libgit2-static:
./script/build-libgit2-static.sh
-install-static: build-libgit2
- go install --tags "static" ./...
+static-build/install/lib/libgit2.a:
+ ./script/build-libgit2-static.sh
-test-static: build-libgit2
+test-static: static-build/install/lib/libgit2.a
go run script/check-MakeGitError-thread-lock.go
- go test --tags "static" ./...
+ go test --count=1 --tags "static" ./...
+
+install-static: static-build/install/lib/libgit2.a
+ go install --tags "static" ./...