Skip to content

Commit 8467879

Browse files
authored
Update Makefile
Adding check before using `GOOS` and `GOARCH` variables in `go build` command. Ref. #1267 (comment)
1 parent b37103e commit 8467879

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ all: bin/cfssl bin/cfssl-bundle bin/cfssl-certinfo bin/cfssl-newkey bin/cfssl-sc
99

1010
bin/%: $(shell find . -type f -name '*.go')
1111
@mkdir -p $(dir $@)
12+
ifneq ($(and $(TARGETOS),$(TARGETARCH)),)
1213
GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -ldflags $(LDFLAGS) -o $@ ./cmd/$(@F)
14+
else
15+
go build -ldflags $(LDFLAGS) -o $@ ./cmd/$(@F)
16+
endif
1317

1418
.PHONY: install
1519
install: install-cfssl install-cfssl-bundle install-cfssl-certinfo install-cfssl-newkey install-cfssl-scan install-cfssljson install-mkbundle install-multirootca
@@ -25,7 +29,11 @@ serve:
2529

2630
bin/goose: $(shell find vendor -type f -name '*.go')
2731
@mkdir -p $(dir $@)
32+
ifneq ($(and $(TARGETOS),$(TARGETARCH)),)
2833
GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -o $@ ./vendor/bitbucket.org/liamstask/goose/cmd/goose
34+
else
35+
go build -o $@ ./vendor/bitbucket.org/liamstask/goose/cmd/goose
36+
endif
2937

3038
.PHONY: clean
3139
clean:

0 commit comments

Comments
 (0)