-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
41 lines (31 loc) · 969 Bytes
/
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
GOMOBILE=gomobile
GOBIND=$(GOMOBILE) bind
BUILDDIR=$(shell pwd)/build
IMPORT_PATH=nkn
LDFLAGS='-s -w'
ANDROID_LDFLAGS='-s -w'
ANDROID_BUILDDIR=$(BUILDDIR)/android
ANDROID_ARTIFACT=$(ANDROID_BUILDDIR)/nkn.aar
IOS_BUILDDIR=$(BUILDDIR)/ios
IOS_ARTIFACT=$(IOS_BUILDDIR)/Nkn.xcframework
BUILD_PACKAGE=github.com/nknorg/nkn-sdk-go github.com/nknorg/ncp-go github.com/nknorg/nkn/v2/transaction github.com/nknorg/nkngomobile
ANDROID_BUILD_CMD="$(GOBIND) -a -ldflags $(ANDROID_LDFLAGS) -target=android -o $(ANDROID_ARTIFACT) $(BUILD_PACKAGE)"
IOS_BUILD_CMD="$(GOBIND) -a -ldflags $(LDFLAGS) -target=ios -o $(IOS_ARTIFACT) $(BUILD_PACKAGE)"
.PHONY: test
test:
go test ./...
.PHONY: pb
pb:
protoc --go_out=. payloads/*.proto
define build
mkdir -p $(1)
eval $(2)
endef
.PHONY: mobile android ios clean
mobile: android ios
android:
$(call build,$(ANDROID_BUILDDIR),$(ANDROID_BUILD_CMD))
ios:
$(call build,$(IOS_BUILDDIR),$(IOS_BUILD_CMD))
clean:
rm -rf $(BUILDDIR)