forked from zyedidia/sregx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (28 loc) · 841 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
VERSION = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
go run tools/build-version.go)
GOVARS = -X main.Version=$(VERSION)
GOOS ?= $(shell go env GOHOSTOS)
GOARCH ?= $(shell go env GOHOSTARCH)
PKGEXT = $(VERSION)-$(GOOS)-$(GOARCH)
ifeq ($(GOOS), windows)
BIN=sregx.exe
else
BIN=sregx
endif
build:
go build -trimpath -ldflags "-s -w $(GOVARS)" ./cmd/sregx
install:
go install -trimpath -ldflags "-s -w $(GOVARS)" ./cmd/sregx
sregx.1: man/sregx.md
pandoc man/sregx.md -s -t man -o sregx.1
package: build sregx.1
mkdir sregx-$(PKGEXT)
cp README.md sregx-$(PKGEXT)
cp LICENSE sregx-$(PKGEXT)
cp sregx.1 sregx-$(PKGEXT)
cp $(BIN) sregx-$(PKGEXT)
tar -czf sregx-$(PKGEXT).tar.gz sregx-$(PKGEXT)
clean:
rm -f sregx sregx.exe sregx.1 sregx-*.tar.gz
rm -rf sregx-*/
.PHONY: build clean install package