-
Notifications
You must be signed in to change notification settings - Fork 315
/
Makefile
59 lines (46 loc) · 1.77 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
TEST_ARGS ?= --count=1
default: test
generate: static-build/install/lib/libgit2.a
go generate --tags "static" ./...
# 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 $(TEST_ARGS) ./...
install:
go install ./...
# 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 $(TEST_ARGS) ./...
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
static-build/install/lib/libgit2.a:
./script/build-libgit2-static.sh
test-static: static-build/install/lib/libgit2.a
go run script/check-MakeGitError-thread-lock.go
go test --tags "static" $(TEST_ARGS) ./...
install-static: static-build/install/lib/libgit2.a
go install --tags "static" ./...