-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (38 loc) · 1.19 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
59
NAME = iserv2go
SHELL = /bin/sh
RM = rm
GO = go
OUT_DIR = build
VERSION = $(shell git describe --tags --abbrev=0)
COMMIT = $(shell git rev-parse --short $(VERSION))
GOFLAGS = -ldflags "-X main.VERSION=$(VERSION) -X main.COMMIT_SHA=$(COMMIT)"
# build
build:
go build -v $(GOFLAGS) .
# linux
build-amd64:
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-linux-amd64 .
build-i386:
GOOS=linux GOARCH=386 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-linux-386 .
build-arm:
GOOS=linux GOARCH=arm $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-linux-arm .
build-arm64:
GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-linux-arm64 .
# windows
build-win-amd64:
GOOS=windows GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-windows-amd64.exe
build-win-i386:
GOOS=windows GOARCH=386 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-windows-386.exe
# mac
build-mac:
GOOS=darwin GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(OUT_DIR)/$(NAME)-darwin-arm64
build-all: build-amd64 build-i386 build-arm build-arm64 build-win-amd64 build-win-i386 build-mac
# install
install:
$(GO) install .
# clean
clean:
$(RM) -rf build
# info
info:
@echo $(VERSION) $(COMMIT)