@@ -20,6 +20,7 @@ GOLIST := go list $(PKG)/... | grep -v '/vendor/'
2020XARGS  := xargs -L 1
2121
2222LDFLAGS  := -s -w -buildid=
23+ LDFLAGS_MOBILE  := -ldflags "$(call  make_ldflags, ${tags}, -s -w) "
2324
2425RM  := rm -f
2526CP  := cp
@@ -28,6 +29,18 @@ XARGS := xargs -L 1
2829
2930LINT  = $(LINT_BIN )  run -v --build-tags itest
3031
32+ PKG  := github.com/lightninglabs/lightning-node-connect
33+ MOBILE_PKG  := $(PKG ) /mobile
34+ MOBILE_BUILD_DIR  :=${GOPATH}/src/$(PKG ) /build
35+ IOS_BUILD_DIR  := $(MOBILE_BUILD_DIR ) /ios
36+ IOS_BUILD  := $(IOS_BUILD_DIR ) /Lndmobile.xcframework
37+ ANDROID_BUILD_DIR  := $(MOBILE_BUILD_DIR ) /android
38+ ANDROID_BUILD  := $(ANDROID_BUILD_DIR ) /lnc-mobile.aar
39+ 
40+ GOMOBILE_BIN  := $(GO_BIN ) /gomobile
41+ 
42+ RPC_TAGS  := appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc
43+ 
3144include  make/testing_flags.mk
3245
3346default : build
@@ -48,14 +61,36 @@ $(LINT_BIN):
4861
4962build :
5063	@$(call  print, "Building lightning-node-connect.") 
51- 	$(GOBUILD )  $(PKG ) /...
64+ 	$(GOBUILD )  -tags= " $( RPC_TAGS ) "   $(PKG ) /...
5265
5366wasm :
5467	#  The appengine build tag is needed because of the jessevdk/go-flags library
5568	#  that has some OS specific terminal code that doesn't compile to WASM.
56- 	cd  cmd/wasm-client;  GOOS=js GOARCH=wasm go build -trimpath -ldflags=" $( LDFLAGS) "   -tags=" appengine autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc signrpc wtclientrpc watchtowerrpc routerrpc walletrpc verrpc "   -v -o wasm-client.wasm . 
69+ 	cd  cmd/wasm-client;  GOOS=js GOARCH=wasm go build -trimpath -ldflags=" $( LDFLAGS) "   -tags=" $( RPC_TAGS ) "   -v -o wasm-client.wasm . 
5770	$(CP )  cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm
5871
72+ apple :
73+ 	@$(call  print, "Building iOS and macOS cxframework ($(IOS_BUILD ) ) ." )
74+ 	mkdir -p $(IOS_BUILD_DIR ) 
75+ 	$(GOMOBILE_BIN )  bind  -target=ios,iossimulator,macos -tags=" mobile $( DEV_TAGS)   $( RPC_TAGS) "   $(LDFLAGS_MOBILE )  -v -o $(IOS_BUILD )  $(MOBILE_PKG ) 
76+ 
77+ ios :
78+ 	@$(call  print, "Building iOS cxframework ($(IOS_BUILD ) ) ." )
79+ 	mkdir -p $(IOS_BUILD_DIR ) 
80+ 	$(GOMOBILE_BIN )  bind  -target=ios,iossimulator -tags=" mobile $( DEV_TAGS)   $( RPC_TAGS) "   $(LDFLAGS_MOBILE )  -v -o $(IOS_BUILD )  $(MOBILE_PKG ) 
81+ 
82+ macos :
83+ 	@$(call  print, "Building macOS cxframework ($(IOS_BUILD ) ) ." )
84+ 	mkdir -p $(IOS_BUILD_DIR ) 
85+ 	$(GOMOBILE_BIN )  bind  -target=macos -tags=" mobile $( DEV_TAGS)   $( RPC_TAGS) "   $(LDFLAGS_MOBILE )  -v -o $(IOS_BUILD )  $(MOBILE_PKG ) 
86+ 
87+ android :
88+ 	@$(call  print, "Building Android library ($(ANDROID_BUILD ) ) ." )
89+ 	mkdir -p $(ANDROID_BUILD_DIR ) 
90+ 	GOOS=js $(GOMOBILE_BIN )  bind  -target=android -tags=" mobile $( DEV_TAGS)   $( RPC_TAGS) "   -androidapi 21 $(LDFLAGS_MOBILE )  -v -o $(ANDROID_BUILD )  $(MOBILE_PKG ) 
91+ 
92+ mobile : ios android
93+ 
5994#  =======
6095#  TESTING
6196#  =======
@@ -64,11 +99,11 @@ check: unit
6499
65100unit :
66101	@$(call  print, "Running unit tests.") 
67- 	$(UNIT ) 
102+ 	$(UNIT )  -tags= " $( RPC_TAGS ) " 
68103
69104unit-race :
70105	@$(call  print, "Running unit race tests.") 
71- 	env CGO_ENABLED=1 GORACE=" history_size=7 halt_on_errors=1"   $(UNIT_RACE ) 
106+ 	env CGO_ENABLED=1 GORACE=" history_size=7 halt_on_errors=1"   $(UNIT_RACE )  -tags= " $( RPC_TAGS ) " 
72107
73108itest : itest-run
74109
0 commit comments