Debian Codegraph @

Makefile

raw symbols SCIP
1 # Makefile includes some useful commands to build or format incentives
2 # More commands could be added
3
4 # Variables
5 PROJECT = gojsonq
6 REPO_ROOT = github.com/thedevsaddam
7 ROOT = ${REPO_ROOT}/${PROJECT}
8
9 fmt:
10 goimports -w .
11 gofmt -s -w .
12
13 compile: fmt
14 go install .
15
16 check: fmt
17 golangci-lint run --deadline 10m ./...
18 staticcheck -checks="all,-S1*" ./...
19
20 dep:
21 go mod download
22 go mod vendor
23 go mod tidy
24
25 # A user can invoke tests in different ways:
26 # - make test runs all tests;
27 # - make test TEST_TIMEOUT=10 runs all tests with a timeout of 10 seconds;
28 # - make test TEST_PKG=./model/... only runs tests for the model package;
29 # - make test TEST_ARGS="-v -short" runs tests with the specified arguments;
30 # - make test-race runs tests with race detector enabled.
31 TEST_TIMEOUT = 60
32 TEST_PKGS ?= ./...
33 TEST_TARGETS := test-short test-verbose test-race test-cover
34 .PHONY: $(TEST_TARGETS) test
35 test-short: TEST_ARGS=-short
36 test-verbose: TEST_ARGS=-v
37 test-race: TEST_ARGS=-race
38 test-cover: TEST_ARGS=-cover
39 $(TEST_TARGETS): test
40
41 test: compile
42 go test -timeout $(TEST_TIMEOUT)s $(TEST_ARGS) $(TEST_PKGS)
43
44 clean:
45 @go clean
46
47 .PHONY: help
48 help:
49 @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
50 awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | \
51 sort | \
52 egrep -v -e '^[^[:alnum:]]' -e '^$@$$'