Debian Codegraph @

Makefile

raw
1 XC_OS="linux darwin"
2 XC_ARCH="amd64"
3 XC_PARALLEL="2"
4 BIN="bin"
5 SRC=$(shell find . -name "*.go")
6
7 ifeq (, $(shell which golangci-lint))
8 $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
9 endif
10
11 ifeq (, $(shell which richgo))
12 $(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
13 endif
14
15 ifeq (, $(shell which gox))
16 $(warning "could not find gox in $(PATH), run: go get github.com/mitchellh/gox")
17 endif
18
19 .PHONY: all build fmt lint test install_deps clean
20
21 default: all
22
23 all: fmt test build
24
25 build: install_deps
26 gox \
27 -os=$(XC_OS) \
28 -arch=$(XC_ARCH) \
29 -parallel=$(XC_PARALLEL) \
30 -output=$(BIN)/{{.Dir}}_{{.OS}}_{{.Arch}} \
31 ;
32
33 fmt:
34 $(info ******************** checking formatting ********************)
35 @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
36
37 lint:
38 $(info ******************** running lint tools ********************)
39 golangci-lint run -v
40
41 test: install_deps
42 $(info ******************** running tests ********************)
43 richgo test -v ./...
44
45 install_deps:
46 $(info ******************** downloading dependencies ********************)
47 go get -v ./...
48
49 clean:
50 rm -rf $(BIN)