File: Makefile

package info (click to toggle)
golang-github-sergi-go-diff 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 304 kB
  • sloc: makefile: 38; sh: 15
file content (44 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download
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
.PHONY: all clean clean-coverage install install-dependencies install-tools lint test test-verbose test-with-coverage

export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
export PKG := github.com/sergi/go-diff
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
export ARGS

ifdef ARGS
	PKG_TEST := $(ARGS)
else
	PKG_TEST := $(PKG)/...
endif

all: install-tools install-dependencies install lint test

clean:
	go clean -i $(PKG)/...
	go clean -i -race $(PKG)/...
clean-coverage:
	find $(ROOT_DIR) | grep .coverprofile | xargs rm
install:
	go install -v $(PKG)/...
install-dependencies:
	go get -t -v $(PKG)/...
	go build -v $(PKG)/...
install-tools:
	# Install linting tools
	go get -u -v golang.org/x/lint/...
	go get -u -v github.com/kisielk/errcheck/...

	# Install code coverage tools
	go get -u -v github.com/onsi/ginkgo/ginkgo/...
	go get -u -v github.com/modocache/gover/...
	go get -u -v github.com/mattn/goveralls/...
lint:
	$(ROOT_DIR)/scripts/lint.sh
test:
	go test -race -test.timeout 120s $(PKG_TEST)
test-verbose:
	go test -race -test.timeout 120s -v $(PKG_TEST)
test-with-coverage:
	ginkgo -r -cover -race -skipPackage="testdata"