diff --git a/cmd/verysimple/Makefile b/cmd/verysimple/Makefile index 9ed13cb..2e97d39 100644 --- a/cmd/verysimple/Makefile +++ b/cmd/verysimple/Makefile @@ -129,7 +129,7 @@ linuxAmdFn :=${prefix}_linux_amd64 linuxArmFn :=${prefix}_linux_arm64 androidArm64Fn :=${prefix}_android_arm64 macFn :=${prefix}_macos -macM1Fn :=${prefix}_macm +macMFn :=${prefix}_macm winFn :=${prefix}_win10 @@ -149,7 +149,7 @@ macos: #macos apple silicon macm: - $(call compile,$(macM1Fn),darwin,arm64) + $(call compile,$(macMFn),darwin,arm64) win10: $(call compile,$(winFn),windows,amd64,$(winsuffix)) @@ -164,14 +164,14 @@ clean: rm -f $(linuxArmFn) rm -f ${winFn}.exe rm -f $(macFn) - rm -f $(macM1Fn) + rm -f $(macMFn) rm -f $(androidArm64Fn) rm -f $(linuxAmdFn).tar.xz rm -f $(linuxArmFn).tar.xz rm -f ${winFn}.tar.xz rm -f $(macFn).tar.xz - rm -f $(macM1Fn).tar.xz + rm -f $(macMFn).tar.xz rm -f $(androidArm64Fn).tar.xz rmlog: diff --git a/cmd/verysimple/Makefile_r_vsc b/cmd/verysimple/Makefile_r_vsc index c04c574..6e66bb5 100644 --- a/cmd/verysimple/Makefile_r_vsc +++ b/cmd/verysimple/Makefile_r_vsc @@ -1,10 +1,17 @@ # 本文件的一些解释请参考 Makefile_release. -# 本文件用于编译客户端版本的verysimple +# 本文件用于编译客户端版本的verysimple。vsc = verysimple client +# 该版本使用cgo。 +# vsc因为开启了cgo,是较难交叉编译的,建议在目标平台上编译。 prefix :=vsc cmd:=go build -tags "vsc $(tags)" -trimpath -ldflags "-X 'main.Version=${BUILD_VERSION}' -s -w -buildid=" -o +ifeq ($(OS),Windows_NT) + detected_OS :=Windows +else + detected_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown') +endif ifdef PACK define compile @@ -16,9 +23,20 @@ endef else +ifeq ($(detected_OS),Windows) + +define compile + set CGO_ENABLED=1&& set GOOS=$(2)&& set GOARCH=$(3)&& $(cmd) $(1)$(4) +endef + +else define compile CGO_ENABLED=1 GOOS=$(2) GOARCH=$(3) GOARM=$(5) $(cmd) ${prefix}_$(1)$(4) endef + +endif + + endif main: linux_amd64 linux_arm64 macos macm win10 win10_arm