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