-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (50 loc) · 1.41 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
60
61
62
63
SHELL := bash
.ONESHELL:
VER=$(shell git describe --tags --always --dirty)
GO=$(shell which go)
GOGET=$(GO) get
GOINSTALL=$(GO) install
GOMOD=$(GO) mod
GOFMT=$(GO) fmt
GOBUILD=$(GO) build -trimpath -mod=readonly -ldflags "-X main.version=$(VER:v%=%) -s -w -buildid="
dir:
@if [ ! -d bin ]; then mkdir -p bin; fi
mod:
@$(GOMOD) download
@$(GOINSTALL) github.com/google/go-licenses@latest
format:
@$(GOFMT) ./...
build/linux/armv7: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm
export GOARM=7
$(GOBUILD) -o bin/go-lg-linux-$(VER:v%=%)-armv7
build/linux/arm64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm64
$(GOBUILD) -o bin/go-lg-linux-$(VER:v%=%)-arm64
build/linux/i386: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=386
$(GOBUILD) -o bin/go-lg-linux-$(VER:v%=%)-i386
build/linux/amd64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64
$(GOBUILD) -o bin/go-lg-linux-$(VER:v%=%)-amd64
build/linux: build/linux/armv7 build/linux/arm64 build/linux/i386 build/linux/amd64
build: build/linux
license: dir
cp NOTICE bin/NOTICE
cp LICENSE bin/LICENSE
go-licenses save . --save_path="bin/licenses"
rm -rf bin/licenses/github.com/CHTJonas/go-lg
rmdir --ignore-fail-on-non-empty bin/licenses/github.com/CHTJonas
(cd bin/licenses && zip -r ../third-party-licenses.zip *)
rm -rf bin/licenses
clean:
@rm -rf bin
all: format build license