File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,18 @@ MAKEFLAGS += --no-print-directory
16
16
GO ?= go
17
17
18
18
GOARCH ?= $(shell $(GO ) env GOARCH)
19
+ GOOS ?= $(shell $(GO ) env GOOS)
20
+ ifeq ($(GOOS ) ,windows)
21
+ BIN_EXT := .exe
22
+ endif
19
23
20
24
# test for go module support
21
25
ifeq ($(shell go help mod >/dev/null 2>&1 && echo true) , true)
22
- export GO_BUILD=GO111MODULE =on GOARCH=$(GOARCH ) $(GO ) build -mod=vendor
23
- export GO_TEST=GO111MODULE =on GOARCH=$(GOARCH ) $(GO ) test -mod=vendor
26
+ export GO_BUILD=GO111MODULE =on GOARCH=$(GOARCH ) GOOS= $( GOOS ) $(GO ) build -mod=vendor
27
+ export GO_TEST=GO111MODULE =on GOARCH=$(GOARCH ) GOOS= $( GOOS ) $(GO ) test -mod=vendor
24
28
else
25
- export GO_BUILD=GOARCH =$(GOARCH ) $(GO ) build
26
- export GO_TEST=GOARCH =$(GOARCH ) $(GO ) test
27
- endif
28
-
29
- GOOS := $(shell $(GO ) env GOOS)
30
- ifeq ($(GOOS ) ,windows)
31
- BIN_EXT := .exe
29
+ export GO_BUILD=GOARCH =$(GOARCH ) GOOS=$(GOOS ) $(GO ) build
30
+ export GO_TEST=GOARCH =$(GOARCH ) GOOS=$(GOOS ) $(GO ) test
32
31
endif
33
32
34
33
PROJECT := github.com/kubernetes-sigs/cri-tools
@@ -39,7 +38,7 @@ VERSION := $(VERSION:v%=%)
39
38
GO_LDFLAGS := -X $(PROJECT ) /pkg/version.Version=$(VERSION )
40
39
41
40
BUILD_PATH := $(shell pwd) /build
42
- BUILD_BIN_PATH := $(BUILD_PATH ) /bin
41
+ BUILD_BIN_PATH := $(BUILD_PATH ) /bin/ $( GOOS ) / $( GOARCH )
43
42
44
43
define go-build
45
44
$(shell cd `pwd` && $(GO_BUILD ) -o $(BUILD_BIN_PATH ) /$(shell basename $(1 ) ) $(1 ) )
You can’t perform that action at this time.
0 commit comments