You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

4 years ago
DIR = "bin"
NAME = "tun2socks"
TAGS = ""
BUILD_FLAGS = "-v"
4 years ago
VERSION = $(shell git describe --tags || echo "unknown version")
4 years ago
BUILD_TIME = $(shell date -u '+%FT%TZ')
LDFLAGS += -w -s -buildid=
LDFLAGS += -X "main.Version=$(VERSION)"
LDFLAGS += -X "main.BuildTime=$(BUILD_TIME)" # RFC3339
GO_BUILD = CGO_ENABLED=0 go build $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)' -trimpath
PLATFORM_LIST = \
darwin-amd64 \
freebsd-amd64 \
freebsd-arm64 \
4 years ago
linux-amd64 \
linux-arm64 \
openbsd-amd64 \
openbsd-arm64 \
4 years ago
4 years ago
all: linux-amd64 darwin-amd64
4 years ago
docker:
$(GO_BUILD) -o $(DIR)/$(NAME)-$@
darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GO_BUILD) -o $(DIR)/$(NAME)-$@
freebsd-amd64:
GOARCH=amd64 GOOS=freebsd $(GO_BUILD) -o $(DIR)/$(NAME)-$@
freebsd-arm64:
GOARCH=arm64 GOOS=freebsd $(GO_BUILD) -o $(DIR)/$(NAME)-$@
4 years ago
linux-amd64:
GOARCH=amd64 GOOS=linux $(GO_BUILD) -o $(DIR)/$(NAME)-$@
linux-arm64:
GOARCH=arm64 GOOS=linux $(GO_BUILD) -o $(DIR)/$(NAME)-$@
openbsd-amd64:
GOARCH=amd64 GOOS=openbsd $(GO_BUILD) -o $(DIR)/$(NAME)-$@
openbsd-arm64:
GOARCH=arm64 GOOS=openbsd $(GO_BUILD) -o $(DIR)/$(NAME)-$@
4 years ago
zip_releases=$(addsuffix .zip, $(PLATFORM_LIST))
$(zip_releases): %.zip : %
zip -m -j $(DIR)/$(NAME)-$(basename $@).zip $(DIR)/$(NAME)-$(basename $@)
4 years ago
all-arch: $(PLATFORM_LIST)
4 years ago
releases: $(zip_releases)
clean:
rm $(DIR)/*