站点更新:2018-03-27 16:18:23

master
ehlxr 2018-03-27 16:18:23 +08:00
parent 18b625042e
commit 1add2f7a62
3 changed files with 42 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist

39
Makefile Normal file
View File

@ -0,0 +1,39 @@
# https://golang.org/doc/install/source#environment
GOOS := $(shell go env | awk -F= '$$1=="GOOS" {print $$2}' | awk -F '"' '{print $$2}') # 此处 awk 需使用两个 $
GOARCH := $(shell go env | awk -F= '$$1=="GOARCH" {print $$2}' | awk -F '"' '{print $$2}')
OSS = darwin dragonfly freebsd linux netbsd openbsd plan9 solaris windows
PKG =
# ifeq ($(strip $(GOOS)), windows)
# GOARCH := $(strip $(GOARCH)).exe
# endif
.PHONY: build
build:
@ go build -ldflags "-s -w" -o dist/jwt_$(strip $(GOOS))_$(strip $(if \
$(findstring windows,$(GOOS)),\
$(strip $(GOARCH)).exe,\
$(strip $(GOARCH))\
))
.PHONY: amd64
amd64:
@ $(foreach OS,\
$(OSS),\
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=amd64 go build -ldflags "-s -w" -o dist/jwt_$(OS)_amd64$(if $(findstring windows,$(OS)),.exe)))
@ echo done
.PHONY: 386
386:
@ $(foreach OS,\
$(OSS),\
$(shell CGO_ENABLED=0 GOOS=$(OS) GOARCH=386 go build -ldflags "-s -w" -o dist/jwt_$(OS)_386$(if $(findstring windows,$(OS)),.exe)))
@ echo done
.PHONY: clean
clean:
@ rm -rf dist/jwt* jbls
# 压缩。需要安装 https://github.com/upx/upx
.PHONY: upx
upx:
@ upx $(if $(PKG),$(PKG),dist/jwt*)

View File

@ -1 +1,2 @@
# jwt
# JWT
> This is a simple tool to sign, verify and show JSON Web Tokens ([JWT](http://jwt.io/)) from the command line, base [jwt-go](https://github.com/dgrijalva/jwt-go).