2021-05-10 18:25:49 +00:00
|
|
|
IOS_OUT := ./ios
|
|
|
|
|
2021-08-09 23:55:55 +00:00
|
|
|
.PHONY: all linux android windows macos clean ios
|
2021-06-24 22:30:46 +00:00
|
|
|
|
|
|
|
DEFAULT_GOAL: linux
|
|
|
|
|
2021-08-09 23:55:55 +00:00
|
|
|
all: linux android windows
|
2021-06-24 22:30:46 +00:00
|
|
|
|
|
|
|
linux: libCwtch.so
|
|
|
|
|
2022-06-22 19:34:01 +00:00
|
|
|
macos: libCwtch.x64.dylib libCwtch.arm64.dylib
|
2021-08-09 23:55:55 +00:00
|
|
|
|
2021-06-24 22:30:46 +00:00
|
|
|
android: cwtch.aar
|
|
|
|
|
|
|
|
windows: libCwtch.dll
|
|
|
|
|
|
|
|
libCwtch.so: lib.go
|
|
|
|
./switch-ffi.sh
|
2022-03-04 00:34:39 +00:00
|
|
|
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.so
|
2021-06-24 22:30:46 +00:00
|
|
|
|
2022-06-22 18:41:51 +00:00
|
|
|
libCwtch.x64.dylib: lib.go
|
2021-08-28 22:22:56 +00:00
|
|
|
./switch-ffi.sh
|
2022-06-22 18:41:51 +00:00
|
|
|
go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.x64.dylib
|
|
|
|
|
2022-06-22 19:34:01 +00:00
|
|
|
libCwtch.arm64.dylib: lib.go
|
2022-06-22 18:41:51 +00:00
|
|
|
./switch-ffi.sh
|
|
|
|
env GOARCH=arm64 GOOS=darwin CGO_ENABLED=1 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.arm64.dylib
|
2021-08-28 22:22:56 +00:00
|
|
|
|
2021-06-24 22:30:46 +00:00
|
|
|
cwtch.aar: lib.go
|
|
|
|
./switch-gomobile.sh
|
2022-03-04 00:34:39 +00:00
|
|
|
gomobile bind -target android -ldflags="-X cwtch.buildVer=$(shell git describe --tags) -X cwtch.buildDate=$(shell date +%G-%m-%d-%H-%M)"
|
2021-06-24 22:30:46 +00:00
|
|
|
|
|
|
|
libCwtch.dll: lib.go
|
|
|
|
./switch-ffi.sh
|
2022-03-04 00:34:39 +00:00
|
|
|
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc-win32 go build -ldflags "-X main.buildVer=$(shell git describe --tags) -X main.buildDate=$(shell date +%G-%m-%d-%H-%M)" -buildmode c-shared -o libCwtch.dll
|
2021-06-24 22:30:46 +00:00
|
|
|
|
|
|
|
clean:
|
2021-09-30 17:49:57 +00:00
|
|
|
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll libCwtch.dylib
|
2021-05-10 18:25:49 +00:00
|
|
|
|
2021-08-06 21:38:26 +00:00
|
|
|
# iOS - for testing purposes only for now, not officially supported
|
|
|
|
|
2021-05-10 18:25:49 +00:00
|
|
|
ios-arm64:
|
|
|
|
CGO_ENABLED=1 \
|
|
|
|
GOOS=darwin \
|
|
|
|
GOARCH=arm64 \
|
2021-05-14 06:59:00 +00:00
|
|
|
SDK=iphoneos \
|
2021-05-10 18:25:49 +00:00
|
|
|
CGO_CFLAGS="-fembed-bitcode" \
|
2021-05-14 06:59:00 +00:00
|
|
|
CC=$(PWD)/clangwrap.sh \
|
2021-05-10 18:25:49 +00:00
|
|
|
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
|
|
|
|
|
|
|
|
ios-x86_64:
|
|
|
|
CGO_ENABLED=1 \
|
|
|
|
GOOS=darwin \
|
|
|
|
GOARCH=amd64 \
|
2021-05-14 06:59:00 +00:00
|
|
|
SDK=iphonesimulator \
|
|
|
|
CC=$(PWD)/clangwrap.sh \
|
2021-05-10 18:25:49 +00:00
|
|
|
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/x86_64.a .
|
|
|
|
|
|
|
|
ios: ios-arm64 ios-x86_64
|
|
|
|
lipo $(IOS_OUT)/x86_64.a $(IOS_OUT)/arm64.a -create -output $(IOS_OUT)/cwtch.a
|
|
|
|
cp $(IOS_OUT)/arm64.h $(IOS_OUT)/cwtch.h
|