-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (36 loc) · 1.35 KB
/
Makefile
File metadata and controls
50 lines (36 loc) · 1.35 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
default: build
# Default version empty
version := "${VERSION:-}"
release_path := "compile_artifacts"
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
name := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
ifeq ($(OS),Windows_NT)
bin_suffix := ".exe"
else
bin_suffix := ""
endif
clean:
rm -f ./bin/$(name)*
compile: deps
GOGC=off CGOENABLED=0 go build -i -o ./bin/$(name)$(bin_suffix) ./cmd
print-success:
@echo
@echo "Plugin built."
@echo
@echo "To use it, either run 'make install' or set your PATH environment variable correctly."
build: compile print-success
deps:
go get
release: deps
rm -rf $(release_path)
mkdir $(release_path)
GOOS=linux GOARCH=amd64 GOGC=off CGOENABLED=0 go build -i -o $(release_path)/$(name) ./cmd
tar --remove-files -cvzf $(release_path)/$(name)-linux-amd64$(version).tar.gz -C $(release_path) $(name)
release-other: deps
GOOS=darwin GOARCH=amd64 GOGC=off CGOENABLED=0 go build -i -o $(release_path)/$(name) ./cmd
tar --remove-files -cvzf $(release_path)/$(name)-darwin-amd64$(version).tar.gz -C $(release_path) $(name)
GOOS=windows GOARCH=amd64 GOGC=off CGOENABLED=0 go build -i -o $(release_path)/$(name).exe ./cmd
tar --remove-files -cvzf $(release_path)/$(name)-windows-amd64$(version).tar.gz -C $(release_path) $(name).exe
install:
cp bin/$(name) /usr/local/bin/
.PHONY : build release release-other install deps