Makefile: variable detection for cross-compilation

The PR to add support for cross-compilation to other OSs introduced a
bug in ARCH and OS variable detection. This commit fixes it.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín 2020-11-23 10:18:08 +01:00
parent ab24242a44
commit f52efc212c
No known key found for this signature in database
GPG Key ID: 586FEAF680DA74AD

View File

@ -139,7 +139,7 @@ pkg/k8s/apis/kilo/v1alpha1/openapi_generated.go: pkg/k8s/apis/kilo/v1alpha1/type
go fmt $@
$(BINS): $(SRC) go.mod
@mkdir -p bin/$(word 2,$(subst /, ,$*))/$(word 3,$(subst /, ,$*))
@mkdir -p bin/$(word 2,$(subst /, ,$@))/$(word 3,$(subst /, ,$@))
@echo "building: $@"
@docker run --rm \
-u $$(id -u):$$(id -g) \
@ -147,8 +147,8 @@ $(BINS): $(SRC) go.mod
-w /$(PROJECT) \
$(BUILD_IMAGE) \
/bin/sh -c " \
GOARCH=$(word 3,$(subst /, ,$*)) \
GOOS=$(word 2,$(subst /, ,$*)) \
GOARCH=$(word 3,$(subst /, ,$@)) \
GOOS=$(word 2,$(subst /, ,$@)) \
GOCACHE=/$(PROJECT)/.cache \
CGO_ENABLED=0 \
go build -mod=vendor -o $@ \