Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: add a cross target 🌵 #2903

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ FORCE:
bin/%: cmd/% FORCE
$(GO) build -mod=vendor $(LDFLAGS) -v -o $@ ./$<

.PHONY: cross
cross: amd64 arm arm64 s390x ppc64le ## build cross platform binaries

.PHONY: amd64
amd64:
GOOS=linux GOARCH=amd64 go build -mod=vendor $(LDFLAGS) ./cmd/...

.PHONY: arm
arm:
GOOS=linux GOARCH=arm go build -mod=vendor $(LDFLAGS) ./cmd/...

.PHONY: arm64
arm64:
GOOS=linux GOARCH=arm64 go build -mod=vendor $(LDFLAGS) ./cmd/...

.PHONY: s390x
s390x:
GOOS=linux GOARCH=s390x go build -mod=vendor $(LDFLAGS) ./cmd/...

.PHONY: ppc64le
ppc64le:
GOOS=linux GOARCH=ppc64le go build -mod=vendor $(LDFLAGS) ./cmd/...

KO = $(BIN)/ko
$(BIN)/ko: PACKAGE=github.com/google/ko/cmd/ko

Expand Down Expand Up @@ -173,6 +196,7 @@ fmt: ; $(info $(M) running gofmt…) @ ## Run gofmt on all source files
.PHONY: clean
clean: ; $(info $(M) cleaning…) @ ## Cleanup everything
@rm -rf $(BIN)
@rm -rf bin
@rm -rf test/tests.* test/coverage.*

.PHONY: help
Expand Down