Skip to content

Commit

Permalink
Add cross command
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bata committed Feb 22, 2019
1 parent 063ccdb commit 61afb2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.o
bin/
builds/
vendor/
ingress_rules_editor
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
NAME := ingress-rules-editor
VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
-X 'main.revision=$(REVISION)'

.DEFAULT_GOAL := help

PKGS := $(shell go list ./...)
Expand All @@ -15,7 +21,19 @@ lint: ## Run golint and go vet.

.PHONY: build
build: ## Build ingress_rules_editor.
go build -o ingress_rules_editor ./main.go
go build -ldflags "$(LDFLAGS)" -o ingress_rules_editor ./main.go

.PHONY: cross
cross: main.go ## Build binaries for cross platform.
mkdir -p builds
@for arch in "amd64" "386"; do \
GOOS=darwin GOARCH=$${arch} make build; \
zip builds/ingress_rules_editor-$(VERSION)_darwin_$${arch}.zip ingress_rules_editor; \
done;
@for arch in "amd64" "386" "arm64"; do \
GOOS=linux GOARCH=$${arch} make build; \
zip builds/ingress_rules_editor-$(VERSION)_linux_$${arch}.zip ingress_rules_editor; \
done;

.PHONY: docker-build
docker-build: ## Build docker image.
Expand Down

0 comments on commit 61afb2e

Please sign in to comment.