-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 1.76 KB
/
Makefile
File metadata and controls
62 lines (48 loc) · 1.76 KB
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
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
# This is just for development purposes. The version is determined at build time using git tags.
VERSION ?= $(shell git describe --tags 2>/dev/null || echo "dev")
TAG ?= "parseablehq/pb:$(VERSION)"
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go $(VERSION))
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
GOLANGCI_LINT_VERSION := v2.11.4
all: build
checks:
@echo "Checking dependencies"
@(env bash $(PWD)/buildscripts/checkdeps.sh)
getdeps:
@mkdir -p ${GOPATH}/bin
@echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)"
# Will need to make it more error prone in future!
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
crosscompile:
@(env bash $(PWD)/buildscripts/cross-compile.sh)
verifiers: getdeps vet lint
docker: build
@docker build -t $(TAG) . -f Dockerfile.dev
vet:
@echo "Running $@"
@go vet $(PWD)/...
lint:
@echo "Running $@ check"
@${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
# Builds pb locally.
build: checks
@echo "Building pb binary to './pb'"
@CGO_ENABLED=0 go build -trimpath -tags kqueue --ldflags "$(LDFLAGS)" -o $(PWD)/pb
# Build pb for all supported platforms.
build-release: verifiers crosscompile
@echo "Built releases for version $(VERSION)"
# Builds pb and installs it to $GOPATH/bin.
install: build
@echo "Installing pb binary to '$(GOPATH)/bin/pb'"
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/pb $(GOPATH)/bin/pb
@echo "Installation successful. To learn more, try \"pb --help\"."
clean:
@echo "Cleaning up all the generated files"
@find . -name '*.test' | xargs rm -fv
@find . -name '*~' | xargs rm -fv
@rm -rvf pb
@rm -rvf build
@rm -rvf release