| 1 |
BINARY_NAME := guesswidth |
| 2 |
SRCS := $(shell git ls-files '*.go') |
| 3 |
LDFLAGS := "-X github.com/noborus/guesswidth.version=$(shell git describe --tags --abbrev=0 --always) -X github.com/noborus/guesswidth.revision=$(shell git rev-parse --short HEAD)" |
| 4 |
|
| 5 |
all: build |
| 6 |
|
| 7 |
test: $(SRCS) |
| 8 |
go test ./... |
| 9 |
|
| 10 |
build: $(BINARY_NAME) |
| 11 |
|
| 12 |
$(BINARY_NAME): $(SRCS) |
| 13 |
go build -ldflags $(LDFLAGS) -o $(BINARY_NAME) ./cmd/guesswidth |
| 14 |
|
| 15 |
install: |
| 16 |
go install -ldflags $(LDFLAGS) ./cmd/guesswidth |
| 17 |
|
| 18 |
clean: |
| 19 |
rm -f $(BINARY_NAME) |
| 20 |
|
| 21 |
.PHONY: all test build install clean |