-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (46 loc) · 1.34 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
.PHONY: build test install publish help release format dev
repo_root=$(shell git rev-parse --show-toplevel)
version=$(shell cat $(repo_root)/version.txt)
# Passed as: make release tag=v0.0.1
tag ?=
all: build
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " dev Init development env"
@echo " build Build codetalks"
@echo " format Format Go code"
@echo " test Run tests"
@echo " install Install codetalks"
@echo " release Release new version"
@echo " publish Publish codetalks to go remote packages index"
@echo " help Show this help message"
release:
@echo "Release new version..."
@bash ./scripts/release.sh $(tag)
dev:
@echo "Initializing development environment..."
@bash ./init-env.sh
format:
@echo "Formatting..."
@go fmt ./...
vet:
@echo "Vetting..."
@go vet ./...
# @go build -o bin/ ./cmd/...
# -ldflags '-extldflags "-static"' means that the binary will be statically linked
build: vet
@echo "Building..."
@mkdir -p bin
@go build -ldflags '-extldflags "-static"' -o bin/ ./cmd/...
# For a verbose output, use: go test -v ./... instead.
test: vet
@echo "Testing..."
@go test ./...
install: vet
@echo "Installing..."
@go install ./cmd/...
publish: release
@echo "Publishing to go packages..."
GOPROXY=proxy.golang.org go list -m github.com/92hackers/codetalks@$(version)