-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
46 lines (39 loc) · 901 Bytes
/
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
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOMOD=$(GOCMD) mod
GOLINT=golangci-lint
BINARY_NAME=dynamic-buildkite-template
.PHONY: test
all: clean lint build
## lint: Runs the linter on the source
#lint:
# $(GOLINT) run --fix
## build: Gathers the dependencies and builds the binary
build:
$(GOMOD) tidy
$(GOBUILD) -o $(BINARY_NAME) -v
## test: Runs all available tests in the source code
test:
$(GOTEST) -v ./...
## clean: Cleans the build files
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
## run: Builds and runs the project
run: build
./$(BINARY_NAME)
## rpm: Builds rpm package
rpm: build
nfpm pkg --packager rpm --target .
## deb: Buids deb package
deb: build
nfpm pkg --packager deb --target .
## help: gives help instructions
help: Makefile
@echo
@echo "Available Commands:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo