Skip to content

Commit

Permalink
release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanhb committed Apr 10, 2021
1 parent 86b6fda commit 29722ae
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.iml
.idea/
cidr-merger
dist/
target/
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
VERSION=$(shell git describe --exact-match --tags 2>/dev/null | sed 's/^v//')
ifeq ($(VERSION),)
VERSION=$(shell git rev-list -1 HEAD)
endif

export CGO_ENABLED=0
LDFLAGS=-X main.VERSION=$(VERSION) -s -w
GCFLAGS=

BINARIES=
define compile
dist/cidr-merger-$(1)-$(or $(3),$(2))$(if $(filter windows,$(1)),.exe):
mkdir -p $$(@D)
GOOS=$(1) GOARCH=$(2) $(4) go build -ldflags "$$(LDFLAGS)" -gcflags "$$(GCFLAGS)" -o $$@
BINARIES+=dist/cidr-merger-$(1)-$(or $(3),$(2))$(if $(filter windows,$(1)),.exe)
endef

dist/cidr-merger:
mkdir -p $(@D)
go build -ldflags "$(LDFLAGS)" -gcflags "$(GCFLAGS)" -o $@

$(eval $(call compile,darwin,amd64))
$(eval $(call compile,darwin,arm64))
$(eval $(call compile,dragonfly,amd64))
$(eval $(call compile,freebsd,386))
$(eval $(call compile,freebsd,amd64))
$(eval $(call compile,linux,386))
$(eval $(call compile,linux,amd64))
$(eval $(call compile,linux,arm,arm5,GOARM=5))
$(eval $(call compile,linux,arm,arm6,GOARM=6))
$(eval $(call compile,linux,arm,arm7,GOARM=7))
$(eval $(call compile,linux,arm64))
$(eval $(call compile,linux,mips,mips-hard,GOMIPS=hardfloat))
$(eval $(call compile,linux,mips,mips-soft,GOMIPS=softfloat))
$(eval $(call compile,linux,mipsle,mipsle-hard,GOMIPS=hardfloat))
$(eval $(call compile,linux,mipsle,mipsle-soft,GOMIPS=softfloat))
$(eval $(call compile,linux,mips64,mips64-hard,GOMIPS64=hardfloat))
$(eval $(call compile,linux,mips64,mips64-soft,GOMIPS64=softfloat))
$(eval $(call compile,linux,mips64le,mips64le-hard,GOMIPS64=hardfloat))
$(eval $(call compile,linux,mips64le,mips64le-soft,GOMIPS64=softfloat))
$(eval $(call compile,netbsd,386))
$(eval $(call compile,netbsd,amd64))
$(eval $(call compile,openbsd,386))
$(eval $(call compile,openbsd,amd64))
$(eval $(call compile,windows,386))
$(eval $(call compile,windows,amd64))

all: $(BINARIES)
.PHONY: all

clean:
rm -rf dist
.PHONY: clean
15 changes: 0 additions & 15 deletions build.sh

This file was deleted.

0 comments on commit 29722ae

Please sign in to comment.