From b655572e5ac3ba140adb1beb265500054c1bc48d Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Tue, 28 Feb 2023 14:51:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=20Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ec892815f..5b6495421 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ GOCMD=go GOBUILD=$(GOCMD) build GOCLEAN=$(GOCMD) clean -GOARCH=amd64 -GOOS=linux +GOARCH=$(shell go env GOARCH) +GOOS=$(shell go env GOOS ) BASE_PAH := $(shell pwd) BUILD_PATH = $(BASE_PAH)/build @@ -16,6 +16,10 @@ build_web: build_bin: cd $(SERVER_PATH) \ - && CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN) + && CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN) + +build_linux_on_mac: + cd $(SERVER_PATH) \ + && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN) build_all: build_web build_bin \ No newline at end of file