Add makefile targets to build easily with just go

Makes it easier to build inside of containers, including the ability to
cross compile easily with usage similar to:

    GOOS=darwin make plugin

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
pull/40/head
Eli Uriegas 6 years ago
parent 02d0474e04
commit 01863cf558

@ -1,3 +1,28 @@
PKG=github.com/tonistiigi/buildx
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
LDFLAGS=-X ${PKG}/version.Version=${VERSION} \
-X ${PKG}/version.Revision=${REVISION} \
-X ${PKG}/version.Package=${PKG}
GOFILES=$(shell find . -type f -name '*.go')
.PHONY: build
build: plugin
bin/buildx bin/docker-buildx: $(GOFILES)
go build -ldflags "$(LDFLAGS)" -o $@ ./cmd/buildx
.PHONY: clean
clean:
$(RM) -r bin/
.PHONY: standalone
standalone: bin/buildx
.PHONY: plugin
plugin: bin/docker-buildx
shell:
./hack/shell

Loading…
Cancel
Save