@@ -26,13 +26,15 @@ bin/git-sizer:
26
26
# Cross-compile for a bunch of common platforms. Note that this
27
27
# doesn't work with USE_ISATTY:
28
28
.PHONY : common-platforms
29
- common-platforms : \
30
- bin/git-sizer-linux-amd64 \
31
- bin/git-sizer-linux-386 \
32
- bin/git-sizer-darwin-amd64 \
33
- bin/git-sizer-darwin-386 \
34
- bin/git-sizer-windows-amd64.exe \
35
- bin/git-sizer-windows-386.exe
29
+ common-platforms :
30
+
31
+ # Create releases for a bunch of common platforms. Note that this
32
+ # doesn't work with USE_ISATTY, and VERSION must be set on the command
33
+ # line; e.g.,
34
+ #
35
+ # make releases VERSION=1.2.3
36
+ .PHONY : releases
37
+ releases :
36
38
37
39
# Define rules for a bunch of common platforms that are supported by go; see
38
40
# https://golang.org/doc/install/source#environment
@@ -44,6 +46,20 @@ define PLATFORM_template =
44
46
bin/git-sizer-$(1 ) -$(2 )$(3 ) :
45
47
mkdir -p bin
46
48
cd $$(GOPATH ) /src/$$(PACKAGE ) && GOOS=$(1 ) GOARCH=$(2 ) $$(GO ) build $$(GOFLAGS ) -o $$(ROOTDIR ) /$$@ $$(PACKAGE )
49
+ common-platforms: bin/git-sizer-$(1 ) -$(2 )$(3 )
50
+
51
+ # Note that releases don't include code from vendor (they're only used
52
+ # for testing), so no license info is needed from those projects.
53
+ .PHONY: releases/git-sizer-$$(VERSION ) -$(1 ) -$(2 ) .zip
54
+ releases/git-sizer-$$(VERSION ) -$(1 ) -$(2 ) .zip: bin/git-sizer-$(1 ) -$(2 )$(3 )
55
+ if test -z "$$(VERSION ) "; then echo "Please set VERSION to make releases"; exit 1; fi
56
+ mkdir -p releases/tmp-$$(VERSION ) -$(1 ) -$(2 )
57
+ cp README.md LICENSE.md releases/tmp-$$(VERSION ) -$(1 ) -$(2 )
58
+ cp bin/git-sizer-$(1 ) -$(2 )$(3 ) releases/tmp-$$(VERSION ) -$(1 ) -$(2 ) /git-sizer$(3 )
59
+ rm -f $$@
60
+ zip -j $$@ releases/tmp-$$(VERSION ) -$(1 ) -$(2 ) /*
61
+ rm -rf releases/tmp-$$(VERSION ) -$(1 ) -$(2 )
62
+ releases: releases/git-sizer-$$(VERSION ) -$(1 ) -$(2 ) .zip
47
63
endef
48
64
49
65
$(eval $(call PLATFORM_template,linux,amd64))
0 commit comments