-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (43 loc) · 1.33 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
42
43
44
45
46
47
48
49
50
51
52
53
54
SHELL := /bin/bash
NAME := exoalg
PKG := github.com/exohood/exohood-crypto-algorithms/$(NAME)
GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)"
GO := go
all: clean build fmt lint staticcheck vet test
.PHONY: build
build: $(NAME)
$(NAME): $(wildcard *.go) $(wildcard */*.go)
@echo "+ $@"
$(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) .
.PHONY: test
test: ## Runs the go tests
@echo "+ $@"
@$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor)
.PHONY: fmt
fmt: ## Verifies all files have been `gofmt`ed.
@echo "+ $@"
@if [[ ! -z "$(gofmt -s -l . | grep -v '.pb.go:' | grep -v '.twirp.go:' | grep -v vendor | tee /dev/stderr)" ]]; then \
exit 1; \
fi
.PHONY: lint
lint: ## Verifies `golint` passes.
@echo "+ $@"
@if [[ ! -z "$(golint ./... | grep -v '.pb.go:' | grep -v '.twirp.go:' | grep -v vendor | tee /dev/stderr)" ]]; then \
exit 1; \
fi
.PHONY: vet
vet: ## Verifies `go vet` passes.
@echo "+ $@"
@if [[ ! -z "$($(GO) vet $(shell $(GO) list ./... | grep -v vendor) | tee /dev/stderr)" ]]; then \
exit 1; \
fi
.PHONY: staticcheck
staticcheck: ## Verifies `staticcheck` passes.
@echo "+ $@"
@if [[ ! -z "$(staticcheck $(shell $(GO) list ./... | grep -v vendor) | tee /dev/stderr)" ]]; then \
exit 1; \
fi
.PHONY: clean
clean: ## Cleanup any build binaries or packages.
@echo "+ $@"
$(RM) $(NAME)