-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.42 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
SDK_NAME := liblantern
SDK_DIR := sdk
LIBLANTERN := liblantern.aar
SDK_OUTPUT := lanternsdk-android.aar
LIBS_DIR := $(SDK_DIR)/libs
BUILD_DIR := build
PROD_FLAG := -ldflags "-s -w"
GRADLEW := ./gradlew
EXAMPLE_PROJECT := :example
.PHONY: build release clean publish example-debug clone-go-client build-sdk build-aar copy-aar
build-aar: export EXTRA_LDFLAGS += -checklinkname=0
build-aar:
@echo "Building Lantern library..."
go env -w 'GOPRIVATE=github.com/getlantern/*' && \
go install golang.org/x/mobile/cmd/gomobile@latest && \
go get golang.org/x/mobile/bind && \
gomobile init && \
gomobile bind -target=android -tags='headless lantern' -o=$(BUILD_DIR)/$(LIBLANTERN) \
-androidapi=23 \
-ldflags="-s -w $(EXTRA_LDFLAGS)" ./lantern
copy-aar:
echo "Copying AAR to $(LIBS_DIR)..."
mkdir -p $(LIBS_DIR)
cp $(BUILD_DIR)/$(LIBLANTERN) $(LIBS_DIR)/$(LIBLANTERN)
build: build-aar copy-aar
echo "Lantern: build/$(LIBLANTERN)"
build-sdk: build sdk-release
# Build SDK
release: build sdk-release copy-sdk example-release
copy-sdk:
cp build/$(SDK_OUTPUT) example/libs
sdk-debug:
$(GRADLEW) clean :$(SDK_DIR):assembleDebug
sdk-release:
$(GRADLEW) clean :$(SDK_DIR):assembleRelease
cp build/sdk/outputs/aar/sdk-release.aar ./build/$(SDK_OUTPUT)
example-debug:
$(GRADLEW) clean $(EXAMPLE_PROJECT):assembleDebug
example-release:
$(GRADLEW) $(EXAMPLE_PROJECT):assembleRelease
clean:
rm -rf $(LIBS_DIR)/$(LIBLANTERN)
rm -rf $(BUILD_DIR)