forked from ooni/probe-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
209 lines (179 loc) · 7.91 KB
/
Makefile
File metadata and controls
209 lines (179 loc) · 7.91 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Many rules in here break if run in parallel.
.NOTPARALLEL:
#quickhelp: Usage: make [VARIABLE=VALUE ...] TARGET ...
.PHONY: usage
usage:
@cat Makefile | grep '^#quickhelp:' | sed -e 's/^#quickhelp://' -e 's/^\ *//'
# Most targets are .PHONY because whether to rebuild is controlled
# by golang. We expose to the user all the .PHONY targets.
#quickhelp:
#quickhelp: The `make list-targets` command lists all available targets.
.PHONY: list-targets
list-targets:
@cat Makefile | grep '^\.PHONY:' | sed -e 's/^\.PHONY://' | grep -v '^ search' | grep -v '^ maybe'
#quickhelp:
#quickhelp: The `make help` command provides detailed usage instructions. We
#quickhelp: recommend running `make help|less` to page its output.
.PHONY: help
help:
@cat Makefile | grep -E '^#(quick)?help:' | sed -E -e 's/^#(quick)?help://' -e s'/^\ //'
#help:
#help: The following variables control the build. You can specify them
#help: on the command line as a key-value pairs (see usage above).
#help:
#help: * GIT_CLONE_DIR : directory where to clone repositories, by default
#help: set to `$HOME/.ooniprobe-build/src`.
GIT_CLONE_DIR = $(HOME)/.ooniprobe-build/src
#help:
#help: * OONI_GO_DOCKER_GOCACHE : base directory to put GOMODCACHE and GOCACHE
#help: when building using Docker. By default this
#help: is set to `$HOME/.ooniprobe-build/cache`
#help:
OONI_GO_DOCKER_GOCACHE = $$(pwd)/GOCACHE
#help:
#help: * OONI_PSIPHON_TAGS : build tags for `go build -tags ...` that cause
#help: the build to embed a psiphon configuration file
#help: into the generated binaries. This build tag
#help: implies cloning the [email protected]:ooni/probe-private
#help: repository. If you do not have the permission to
#help: clone it, just clear this variable, e.g.:
#help:
#help: make OONI_PSIPHON_TAGS="" CLI/miniooni
OONI_PSIPHON_TAGS = ooni_psiphon_config
#quickhelp:
#quickhelp: The `make show-config` command shows the current value of the
#quickhelp: variables controlling the build.
.PHONY: show-config
show-config:
@echo "GIT_CLONE_DIR=$(GIT_CLONE_DIR)"
@echo "OONI_PSIPHON_TAGS=$(OONI_PSIPHON_TAGS)"
#help:
#help: The `make CLI/android-386` command builds miniooni and ooniprobe for android/386.
.PHONY: CLI/android-386
CLI/android-386: search/for/go search/for/android/sdk maybe/copypsiphon
./CLI/go-build-android 386 ./internal/cmd/miniooni
./CLI/go-build-android 386 ./cmd/ooniprobe
#help:
#help: The `make CLI/android-amd64` command builds miniooni and ooniprobe for android/amd64.
.PHONY: CLI/android-amd64
CLI/android-amd64: search/for/go search/for/android/sdk maybe/copypsiphon
./CLI/go-build-android amd64 ./internal/cmd/miniooni
./CLI/go-build-android amd64 ./cmd/ooniprobe
#help:
#help: The `make CLI/android-arm` command builds miniooni and ooniprobe for android/arm.
.PHONY: CLI/android-arm
CLI/android-arm: search/for/go search/for/android/sdk maybe/copypsiphon
./CLI/go-build-android arm ./internal/cmd/miniooni
./CLI/go-build-android arm ./cmd/ooniprobe
#help:
#help: The `make CLI/android-arm64` command builds miniooni and ooniprobe for android/arm64.
.PHONY: CLI/android-arm64
CLI/android-arm64: search/for/go search/for/android/sdk maybe/copypsiphon
./CLI/go-build-android arm64 ./internal/cmd/miniooni
./CLI/go-build-android arm64 ./cmd/ooniprobe
#help:
#help: The `make CLI/darwin` command builds the ooniprobe and miniooni
#help: command line clients for darwin/amd64 and darwin/arm64.
.PHONY: CLI/darwin
CLI/darwin: search/for/go maybe/copypsiphon
./CLI/go-build-darwin amd64 ./internal/cmd/miniooni
./CLI/go-build-darwin amd64 ./cmd/ooniprobe
./CLI/go-build-darwin arm64 ./internal/cmd/miniooni
./CLI/go-build-darwin arm64 ./cmd/ooniprobe
#help:
#help: The `make CLI/linux-static-386` command builds and statically links the
#help: ooniprobe and miniooni binaries for linux/386.
.PHONY: CLI/linux-static-386
CLI/linux-static-386: search/for/docker maybe/copypsiphon
./CLI/go-build-linux-static $(OONI_GO_DOCKER_GOCACHE) 386 ./cmd/ooniprobe ./internal/cmd/miniooni
#help:
#help: The `make CLI/linux-static-amd64` command builds and statically links the
#help: ooniprobe and miniooni binaries for linux/amd64.
.PHONY: CLI/linux-static-amd64
CLI/linux-static-amd64: search/for/docker maybe/copypsiphon
./CLI/go-build-linux-static $(OONI_GO_DOCKER_GOCACHE) amd64 ./cmd/ooniprobe ./internal/cmd/miniooni
#help:
#help: The `make CLI/linux-static-armv6` command builds and statically links the
#help: ooniprobe and miniooni binaries for linux/arm/v6.
.PHONY: CLI/linux-static-armv6
CLI/linux-static-armv6: search/for/docker maybe/copypsiphon
./CLI/go-build-linux-static $(OONI_GO_DOCKER_GOCACHE) armv6 ./cmd/ooniprobe ./internal/cmd/miniooni
#help:
#help: The `make CLI/linux-static-armv7` command builds and statically links the
#help: ooniprobe and miniooni binaries for linux/arm/v7.
.PHONY: CLI/linux-static-armv7
CLI/linux-static-armv7: search/for/docker maybe/copypsiphon
./CLI/go-build-linux-static $(OONI_GO_DOCKER_GOCACHE) armv7 ./cmd/ooniprobe ./internal/cmd/miniooni
#help:
#help: The `make CLI/linux-static-arm64` command builds and statically links the
#help: ooniprobe and miniooni binaries for linux/arm64.
.PHONY: CLI/linux-static-arm64
CLI/linux-static-arm64: search/for/docker maybe/copypsiphon
./CLI/go-build-linux-static $(OONI_GO_DOCKER_GOCACHE) arm64 ./cmd/ooniprobe ./internal/cmd/miniooni
#help:
#help: The `make CLI/windows` command builds the ooniprobe and miniooni
#help: command line clients for windows/386 and windows/amd64.
.PHONY: CLI/windows
CLI/windows: search/for/go search/for/mingw-w64 maybe/copypsiphon
./CLI/go-build-windows 386 ./internal/cmd/miniooni
./CLI/go-build-windows 386 ./cmd/ooniprobe
./CLI/go-build-windows amd64 ./internal/cmd/miniooni
./CLI/go-build-windows amd64 ./cmd/ooniprobe
#help:
#help: The `make MOBILE/android` command builds the oonimkall library for Android.
.PHONY: MOBILE/android
MOBILE/android: search/for/go search/for/android/sdk maybe/copypsiphon
./MOBILE/gomobile android ./pkg/oonimkall
./MOBILE/android/createpom
#help:
#help: The `make MOBILE/ios` command builds the oonimkall library for iOS.
.PHONY: MOBILE/ios
MOBILE/ios: search/for/go search/for/zip search/for/xcode maybe/copypsiphon
./MOBILE/gomobile ios ./pkg/oonimkall
./MOBILE/ios/zipframework
./MOBILE/ios/createpodspec
.PHONY: search/for/docker
search/for/docker:
@printf "checking for docker... "
@command -v docker || { echo "not found"; exit 1; }
.PHONY: search/for/git
search/for/git:
@printf "checking for git... "
@command -v git || { echo "not found"; exit 1; }
.PHONY: search/for/go
search/for/go:
./CLI/check-go-version
.PHONY: search/for/java
search/for/java:
@printf "checking for java... "
@command -v java || { echo "not found"; exit 1; }
.PHONY: search/for/mingw-w64
search/for/mingw-w64:
./CLI/check-mingw-w64-version
.PHONY: search/for/xcode
search/for/xcode:
./MOBILE/ios/check-xcode-version
.PHONY: search/for/zip
search/for/zip:
@printf "checking for zip... "
@command -v zip || { echo "not found"; exit 1; }
#
# Note: we check for files being already there before attempting
# to clone _because_ we put files in there using secrets when
# running cloud builds. This saves us from including a token with
# `repo` scope as a build secret, which is a very broad scope.
#
# Cloning the private repository, instead, is the way in which
# local builds get access to the psiphon config files.
#
.PHONY: maybe/copypsiphon
maybe/copypsiphon: search/for/git
@if test "$(OONI_PSIPHON_TAGS)" = "ooni_psiphon_config"; then \
if test ! -f ./internal/engine/psiphon-config.json.age -a \
! -f ./internal/engine/psiphon-config.key; then \
./script/copy-psiphon-files.bash $(GIT_CLONE_DIR) || exit 1; \
fi; \
fi
.PHONY: search/for/android/sdk
search/for/android/sdk: search/for/java
./MOBILE/android/ensure