-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (34 loc) · 1 KB
/
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
37
38
39
40
41
VERSION=`git describe --tags`
VER = $(shell git describe --tags --abbrev=0)
DATE=`date -u '+%Y-%m-%d_%I:%M:%S%p'`
FLAGS_SHARED = CGO_ENABLED=0 GOARCH=amd64
FLAGS_LD=-trimpath -ldflags "-w -s \
-X github.com/gnames/bhlindex.Build=${DATE} \
-X github.com/gnames/bhlindex.Version=${VERSION}"
GOCMD=go
GOBUILD=$(GOCMD) build $(FLAGS_LD)
GOINSTALL=$(GOCMD) install $(FLAGS_LD)
GOCLEAN=$(GOCMD) clean
all: install
tools: deps
@echo Installing tools from tools.go
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
deps:
@echo Download go.mod dependencies
$(GOCMD) mod download; \
$(GOGENERATE)
test: deps install
@echo Run tests
go test -race -count=1 ./...
build:
$(GOCLEAN); \
$(FLAGS_SHARED) $(GOBUILD);
install:
@echo Building and Installing bhlindex
$(FLAGS_SHARED) $(GOINSTALL); \
$(GOCLEAN);
release:
@echo Building release for Linux
$(GOCLEAN); \
$(FLAGS_SHARED) GOOS=linux $(GOBUILD); \
tar zcvf /tmp/bhlindex-${VER}-linux.tar.gz bhlindex;