Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit b83a78c

Browse files
Merge pull request #82 from r2d4/release-rule
Add release rule, exe for windows
2 parents 32b0eaa + e1f29b1 commit b83a78c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ BUILD_DIR ?= ./out
2525
ORG := github.com/GoogleCloudPlatform
2626
PROJECT := container-diff
2727
REPOPATH ?= $(ORG)/$(PROJECT)
28+
RELEASE_BUCKET ?= $(PROJECT)
2829

29-
SUPPORTED_PLATFORMS := linux-amd64 darwin-amd64 windows-amd64
30+
SUPPORTED_PLATFORMS := linux-amd64 darwin-amd64 windows-amd64.exe
3031
BUILD_PACKAGE = $(REPOPATH)
3132

3233
# These build tags are from the containers/image library.
@@ -37,17 +38,20 @@ GO_BUILD_TAGS := "container_image_ostree_stub containers_image_openpgp"
3738
GO_LDFLAGS := "-X $(REPOPATH)/version.version=$(VERSION)"
3839
GO_FILES := $(shell go list -f '{{join .Deps "\n"}}' $(BUILD_PACKAGE) | grep $(ORG) | xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}')
3940

40-
$(BUILD_DIR)/$(PROJECT): out/$(PROJECT)-$(GOOS)-$(GOARCH)
41+
$(BUILD_DIR)/$(PROJECT): $(BUILD_DIR)/$(PROJECT)-$(GOOS)-$(GOARCH)
4142
cp $(BUILD_DIR)/$(PROJECT)-$(GOOS)-$(GOARCH) $@
4243

4344
$(BUILD_DIR)/$(PROJECT)-%-$(GOARCH): $(GO_FILES) $(BUILD_DIR)
4445
GOOS=$* GOARCH=$(GOARCH) go build -tags $(GO_BUILD_TAGS) -ldflags $(GO_LDFLAGS) -o $@ $(BUILD_PACKAGE)
4546

47+
%.exe: %
48+
mv $< $@
49+
4650
$(BUILD_DIR):
4751
mkdir -p $(BUILD_DIR)
4852

4953
.PHONY: cross
50-
cross: $(foreach platform, $(SUPPORTED_PLATFORMS), out/$(PROJECT)-$(platform))
54+
cross: $(foreach platform, $(SUPPORTED_PLATFORMS), $(BUILD_DIR)/$(PROJECT)-$(platform))
5155

5256
.PHONY: test
5357
test: $(BUILD_DIR)/$(PROJECT)
@@ -57,6 +61,10 @@ test: $(BUILD_DIR)/$(PROJECT)
5761
integration: $(BUILD_DIR)/$(PROJECT)
5862
go test -v -tags integration $(REPOPATH)/tests
5963

64+
.PHONY: release
65+
release: cross
66+
gsutil cp $(BUILD_DIR)/$(PROJECT)-* gs://$(RELEASE_BUCKET)/$(VERSION)/
67+
6068
.PHONY: clean
6169
clean:
6270
rm -rf $(BUILD_DIR)

0 commit comments

Comments
 (0)