@@ -24,6 +24,38 @@ bin/git-sizer:
24
24
mkdir -p bin
25
25
$(GO ) build $(GOFLAGS ) -o $@ $(PACKAGE )
26
26
27
+ # Cross-compile for a bunch of common platforms. Note that this
28
+ # doesn't work with USE_ISATTY:
29
+ .PHONY : common-platforms
30
+ common-platforms : \
31
+ bin/git-sizer-linux-amd64 \
32
+ bin/git-sizer-linux-386 \
33
+ bin/git-sizer-darwin-amd64 \
34
+ bin/git-sizer-darwin-386 \
35
+ bin/git-sizer-windows-amd64.exe \
36
+ bin/git-sizer-windows-386.exe
37
+
38
+ # Define rules for a bunch of common platforms that are supported by go; see
39
+ # https://golang.org/doc/install/source#environment
40
+ # You can compile for any other platform in that list by running
41
+ # make GOOS=foo GOARCH=bar
42
+
43
+ define PLATFORM_template =
44
+ .PHONY: bin/git-sizer-$(1 ) -$(2 )$(3 )
45
+ bin/git-sizer-$(1 ) -$(2 )$(3 ) :
46
+ mkdir -p bin
47
+ GOOS=$(1 ) GOARCH=$(2 ) $$(GO ) build $$(GOFLAGS ) -o $$@ $$(PACKAGE )
48
+ endef
49
+
50
+ $(eval $(call PLATFORM_template,linux,amd64))
51
+ $(eval $(call PLATFORM_template,linux,386))
52
+
53
+ $(eval $(call PLATFORM_template,darwin,386))
54
+ $(eval $(call PLATFORM_template,darwin,amd64))
55
+
56
+ $(eval $(call PLATFORM_template,windows,amd64,.exe))
57
+ $(eval $(call PLATFORM_template,windows,386,.exe))
58
+
27
59
.PHONY : test
28
60
test : bin/git-sizer gotest
29
61
0 commit comments