添加一个makefile,该makefile用来构建我的脚手架
用来构建 https://github.com/AgoCan/code-generator
# Makefile
# 变量定义
BINARY_NAME=myapp
GO=go
GOFLAGS=
# 默认构建目标
all: windows x86 darwin aarch64
# Windows x86 构建
windows:
@echo "Building for Windows x86..."
GOOS=windows GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_windows_x86.exe
# Linux x86 构建
linux:
@echo "Building for Linux x86..."
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_linux_x86
# Darwin x86 构建
darwin:
@echo "Building for Darwin x86..."
GOOS=darwin GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_darwin_x86
# Windows AARCH64 构建
windows_aarch64:
@echo "Building for Windows AARCH64..."
GOOS=windows GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_windows_arm64.exe
# Linux AARCH64 构建
linux_aarch64:
@echo "Building for Linux AARCH64..."
GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_linux_arm64
# Darwin AARCH64 构建
darwin_aarch64:
@echo "Building for Darwin AARCH64..."
GOOS=darwin GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(BINARY_NAME)_darwin_arm64
# X86 构建,构建所有平台的 x86 版本
x86: windows linux darwin
# AARCH64 构建,构建所有平台的 aarch64 版本
aarch64: windows_aarch64 linux_aarch64 darwin_aarch64
# 清理构建文件
clean:
@echo "Cleaning up..."
rm -f $(BINARY_NAME)_windows_x86.exe $(BINARY_NAME)_linux_x86 $(BINARY_NAME)_darwin_x86
rm -f $(BINARY_NAME)_windows_arm64.exe $(BINARY_NAME)_linux_arm64 $(BINARY_NAME)_darwin_arm64
.PHONY: all windows linux darwin x86 clean windows_aarch64 linux_aarch64 darwin_aarch64 aarch64