27 lines
618 B
Makefile
27 lines
618 B
Makefile
.PHONY: build
|
|
|
|
GOARCH=amd64
|
|
# GOARCH=arm
|
|
GOOS=darwin
|
|
# GOOS=linux
|
|
|
|
VERSION=$$(git rev-list -1 HEAD)
|
|
LDFLAGS=-w -s -X go/weather/internal/version.Version=$(VERSION)
|
|
GO_BUILD_FLAGS=-tags dev
|
|
CGO_ENABLED=0
|
|
|
|
build: dependencies
|
|
@echo "build for os $$GOOS and arch $$GOARCH"
|
|
go build -o bin/docker-multi-arch-builder-$(GOOS)-$(GOARCH) -ldflags="$(LDFLAGS)" $(GO_BUILD_FLAGS) main.go
|
|
|
|
dependencies:
|
|
go mod download
|
|
go mod verify
|
|
|
|
version:
|
|
./bin/docker-multi-arch-builder-darwin-amd64 --version
|
|
|
|
install: build
|
|
install -D -m 755 bin/docker-multi-arch-builder-$(GOOS)-$(GOARCH) /usr/local/bin/docker-multi-arch-builder
|
|
|