123456789101112131415161718192021222324 |
- BINARY_NAME := project_management
- GOOS := linux
- GOARCH := amd64
- all: build
- # 运行
- run:
- @echo "Running $(BINARY_NAME)..."
- go run main.go
- # 编译为linux下的二进制文件
- build:
- @echo "Cross-compiling for $(GOOS)/$(GOARCH)..."
- go build -o $(BINARY_NAME)-$(GOOS)-$(GOARCH) -ldflags="-s -w" -tags netgo -a -installsuffix cgo -x -v -gcflags=all=-trimpath=$(GOPATH) -asmflags=all=-trimpath=$(GOPATH)
- # 安装必要的依赖
- deps:
- @echo "Installing dependencies..."
- go mod tidy
- go mod download
- # 删除编译生成的文件
- clean:
- @echo "Cleaning..."
- del /Q $(BINARY_NAME)-*
- .PHONY: all build clean
|