You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.4 KiB
Makefile

1 year ago
GO = CGO_ENABLED=0 GO111MODULE=on GOPROXY=https://goproxy.cn,direct go
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
GIT_BRANCH := $(shell git symbolic-ref --short -q HEAD)
GIT_COMMIT_HASH := $(shell git rev-parse HEAD|cut -c 1-8)
1 year ago
GO_FLAGS := -v -ldflags="-X 'github.com/forget-the-bright/grvm/internal/build.Build=$(BUILD_DATE)' -X 'github.com/forget-the-bright/grvm/internal/build.Commit=$(GIT_COMMIT_HASH)' -X 'github.com/forget-the-bright/grvm/internal/build.Branch=$(GIT_BRANCH)'"
1 year ago
all: install test clean
build:
$(GO) build $(GO_FLAGS)
install: build
$(GO) install $(GO_FLAGS)
build-myall: build-linux-amd64 build-windows-amd64
build-all: build-linux build-darwin build-windows
build-linux: build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x
build-linux-386:
1 year ago
GOOS=linux GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/linux-386/grvm
1 year ago
build-linux-amd64:
1 year ago
GOOS=linux GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/linux-amd64/linux_amd_x86_64_grvm
1 year ago
build-linux-arm:
1 year ago
GOOS=linux GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/linux-arm/grvm
1 year ago
build-linux-arm64:
1 year ago
GOOS=linux GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/linux-arm64/grvm
1 year ago
build-linux-s390x:
1 year ago
GOOS=linux GOARCH=s390x $(GO) build $(GO_FLAGS) -o bin/linux-s390x/grvm
1 year ago
build-darwin: build-darwin-amd64 build-darwin-arm64
build-darwin-amd64:
1 year ago
GOOS=darwin GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/darwin-amd64/grvm
1 year ago
build-darwin-arm64:
1 year ago
GOOS=darwin GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/darwin-arm64/grvm
1 year ago
build-windows: build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64
build-windows-386:
1 year ago
GOOS=windows GOARCH=386 $(GO) build $(GO_FLAGS) -o bin/windows-386/grvm.exe
1 year ago
build-windows-amd64:
1 year ago
GOOS=windows GOARCH=amd64 $(GO) build $(GO_FLAGS) -o bin/windows-amd64/windows_amd_x86_64_grvm.exe
1 year ago
build-windows-arm:
1 year ago
GOOS=windows GOARCH=arm $(GO) build $(GO_FLAGS) -o bin/windows-arm/grvm.exe
1 year ago
build-windows-arm64:
1 year ago
GOOS=windows GOARCH=arm64 $(GO) build $(GO_FLAGS) -o bin/windows-arm64/grvm.exe
1 year ago
package:
sh ./package.sh
test:
$(GO) test -v ./...
clean:
$(GO) clean -x
rm -f sha256sum.txt
rm -rf bin
.PHONY: all build install test package clean build-linux build-darwin build-windows build-linux-386 build-linux-amd64 build-linux-arm build-linux-arm64 build-linux-s390x build-darwin-amd64 build-darwin-arm64 build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64