-
-
Notifications
You must be signed in to change notification settings - Fork 133
/
Makefile
148 lines (126 loc) · 4.07 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
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
#
# Copyright 2019-2021 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
#
V ?= 0
Q = @
ifneq ($V,0)
Q =
endif
JOBS ?= 8
OUTPUT_DIR ?= out
BUILD_TYPES := release debug
GN_ARCHS := arm arm64 x86 x64
ANDROID_TARGETS := $(foreach t, $(BUILD_TYPES), \
$(foreach a, $(GN_ARCHS), \
android/$(a)/$(t)))
IOS_TARGETS := ios/release
# This can be overridden on the command line, e.g. "make electron NODEJS_ARCH=ia32"
# Note: make sure to only use NodeJS architectures here, like x64, ia32, arm64, etc.
NODEJS_ARCH := x64
help:
$(Q) echo "The following build targets are supported:"
$(Q) echo " ios -- download WebRTC and build for the iOS platform"
$(Q) echo " android -- download WebRTC and build for the Android platform"
$(Q) echo " electron -- build an Electron library"
$(Q) echo " direct -- build the direct/1:1 call test cli"
$(Q) echo " gctc -- build the group call test cli"
$(Q) echo " call_sim-cli -- build the call simulator test cli"
$(Q) echo
$(Q) echo "For the electron/cli/gctc builds, you can specify an optional platform"
$(Q) echo "which will download WebRTC. For example:"
$(Q) echo " $ make electron PLATFORM=unix"
$(Q) echo
$(Q) echo "The following clean targets are supported:"
$(Q) echo " clean -- remove all build artifacts"
$(Q) echo " distclean -- remove everything"
$(Q) echo
android: $(ANDROID_TARGETS)
$(Q) ./bin/build-aar -j$(JOBS)
$(OUTPUT_DIR)/android.env:
$(Q) echo "Preparing Android workspace"
$(Q) ./bin/prepare-workspace android
android/%: ARCH = $(word 1, $(subst /, , $*))
android/%: TYPE = $(word 2, $(subst /, , $*))
android/%: $(OUTPUT_DIR)/android.env
$(Q) ./bin/build-aar --compile-only --$(TYPE)-build --arch $(ARCH) -j$(JOBS)
ios: $(IOS_TARGETS)
$(OUTPUT_DIR)/ios.env:
$(Q) echo "Preparing iOS workspace"
$(Q) ./bin/prepare-workspace ios
ios/%: TYPE = $*
ios/%: $(OUTPUT_DIR)/ios.env
$(Q) if [ "$(TYPE)" = "debug" ] ; then \
echo "iOS: Debug build" ; \
./bin/build-ios -d ; \
else \
echo "iOS: Release build" ; \
./bin/build-ios ; \
fi
electron:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "Electron: Preparing workspace for $(PLATFORM)" ; \
./bin/prepare-workspace $(PLATFORM) ; \
fi
$(Q) if [ "$(TYPE)" = "debug" ] ; then \
echo "Electron: Debug build" ; \
TARGET_ARCH=$(NODEJS_ARCH) BUILD_WHAT=$(BUILD_WHAT) BUILD_WEBRTC_TESTS=$(BUILD_WEBRTC_TESTS) ./bin/build-electron -d ; \
else \
echo "Electron: Release build" ; \
TARGET_ARCH=$(NODEJS_ARCH) BUILD_WHAT=$(BUILD_WHAT) BUILD_WEBRTC_TESTS=$(BUILD_WEBRTC_TESTS) ./bin/build-electron -r ; \
fi
$(Q) (cd src/node && npm install && npm run build)
cli:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "cli: Preparing workspace for $(PLATFORM)" ; \
./bin/prepare-workspace $(PLATFORM) ; \
fi
$(Q) if [ "$(TYPE)" = "release" ] ; then \
echo "cli: Release build" ; \
./bin/build-direct -r ; \
else \
echo "cli: Debug build" ; \
./bin/build-direct -d ; \
fi
gctc:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "gctc: Preparing workspace for $(PLATFORM)" ; \
./bin/prepare-workspace $(PLATFORM) ; \
fi
$(Q) if [ "$(TYPE)" = "release" ] ; then \
echo "gctc: Release build" ; \
./bin/build-gctc -r ; \
else \
echo "gctc: Debug build" ; \
./bin/build-gctc -d ; \
fi
call_sim-cli:
$(Q) if [ "$(PLATFORM)" != "" ] ; then \
echo "call_sim-cli: Preparing workspace for $(PLATFORM)" ; \
./bin/prepare-workspace $(PLATFORM) ; \
fi
$(Q) if [ "$(TYPE)" = "debug" ] ; then \
echo "call_sim-cli: Debug build" ; \
./bin/build-call_sim-cli -d ; \
else \
echo "call_sim-cli: Release build" ; \
./bin/build-call_sim-cli -r ; \
fi
PHONY += clean
clean:
$(Q) ./bin/build-aar --clean
$(Q) ./bin/build-ios --clean
$(Q) ./bin/build-electron --clean
$(Q) ./bin/build-direct --clean
$(Q) ./bin/build-gctc --clean
$(Q) ./bin/build-call_sim-cli --clean
$(Q) rm -rf ./src/webrtc/src/out
PHONY += distclean
distclean:
$(Q) rm -rf ./out
$(Q) rm -rf ./target
$(Q) rm -rf ./src/node/build
$(Q) rm -rf ./src/node/dist
$(Q) rm -rf ./src/node/node_modules
$(Q) rm -rf ./src/webrtc/src/out
.PHONY: $(PHONY)