Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
Adding check before using `GOOS` and `GOARCH` variables in `go build` command. Ref. #1267 (comment)
  • Loading branch information
shahidhs-ibm authored Feb 7, 2023
1 parent b37103e commit 8467879
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ all: bin/cfssl bin/cfssl-bundle bin/cfssl-certinfo bin/cfssl-newkey bin/cfssl-sc

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

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

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

.PHONY: clean
clean:
Expand Down

0 comments on commit 8467879

Please sign in to comment.