forked from johnkerl/miller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
127 lines (106 loc) · 4.01 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
PREFIX=/usr/local
INSTALLDIR=$(PREFIX)/bin
# ================================================================
# General-use targets
# This must remain the first target in this file, which is what 'make' with no
# arguments will run.
build:
go build github.com/johnkerl/miller/cmd/mlr
@echo "Build complete. The Miller executable is ./mlr (or .\mlr.exe on Windows)."
@echo "You can use 'make check' to run tests".
quiet:
@go build github.com/johnkerl/miller/cmd/mlr
# For interactive use, 'mlr regtest' offers more options and transparency.
check: unit-test regression-test
@echo "Tests complete. You can use 'make install' if you like, optionally preceded"
@echo "by './configure --prefix=/your/install/path' if you wish to install to"
@echo "somewhere other than /usr/local/bin -- the default prefix is /usr/local."
# DESTDIR is for package installs; nominally blank when this is run interactively.
# See also https://www.gnu.org/prep/standards/html_node/DESTDIR.html
install: build
mkdir -p $(DESTDIR)/$(INSTALLDIR)
cp mlr $(DESTDIR)/$(INSTALLDIR)/
make -C man install
# ================================================================
# Dev targets
# ----------------------------------------------------------------
# Unit tests (small number)
unit-test ut: build
go test github.com/johnkerl/miller/pkg/...
ut-lib:build
go test github.com/johnkerl/miller/pkg/lib...
ut-scan:build
go test github.com/johnkerl/miller/pkg/scan/...
ut-mlv:build
go test github.com/johnkerl/miller/pkg/mlrval/...
ut-bifs:build
go test github.com/johnkerl/miller/pkg/bifs/...
ut-input:build
go test github.com/johnkerl/miller/pkg/input/...
bench:build
go test -run=nonesuch -bench=. github.com/johnkerl/miller/pkg/...
bench-mlv:build
go test -run=nonesuch -bench=. github.com/johnkerl/miller/pkg/mlrval/...
bench-input:build
go test -run=nonesuch -bench=. github.com/johnkerl/miller/pkg/input/...
# ----------------------------------------------------------------
# Regression tests (large number)
#
# See ./regression_test.go for information on how to get more details
# for debugging. TL;DR is for CI jobs, we have 'go test -v'; for
# interactive use, instead of 'go test -v' simply use 'mlr regtest
# -vvv' or 'mlr regtest -s 20'. See also pkg/terminals/regtest.
regression-test: build
go test -v regression_test.go
# ----------------------------------------------------------------
# Formatting
# go fmt ./... finds experimental C files which we want to ignore.
fmt format:
-go fmt ./cmd/...
-go fmt ./pkg/...
-go fmt ./regression_test.go
# ----------------------------------------------------------------
# Static analysis
# Needs first: go install honnef.co/go/tools/cmd/staticcheck@latest
# See also: https://staticcheck.io
staticcheck:
staticcheck ./...
# ----------------------------------------------------------------
# For developers before pushing to GitHub.
#
# These steps are done in a particular order:
# go:
# * builds the mlr executable
# man:
# * creates manpage mlr.1 and manpage.txt using mlr from the $PATH
# * copies the latter to docs/src
# docs:
# * turns *.md.in into *.md (live code samples), using mlr from the $PATH
# * note the man/manpage.txt becomes some of the HTML content
# * turns *.md into docs/site HTML and CSS files
dev:
-make fmt
make build
make check
make -C man build
make -C docs/src forcebuild
make -C docs
@echo DONE
docs: build
make -C docs/src forcebuild
make -C docs
# ----------------------------------------------------------------
# Keystroke-savers
sure: build check
it: build check
so: install
mlr:
go build github.com/johnkerl/miller/cmd/mlr
# ----------------------------------------------------------------
# Please see comments in ./create-release-tarball as well as
# https://miller.readthedocs.io/en/latest/build/#creating-a-new-release-for-developers
release_tarball: build check
./create-release-tarball
# ================================================================
# Go does its own dependency management, outside of make.
.PHONY: build mlr check unit_test regression_test bench fmt staticcheck dev docs