-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
56 lines (41 loc) · 1.03 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
PACKAGE=pluto
VERSION=`git describe --tags`
BUILD=`date +%FT%T%z`
LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION} -X main.Build=${BUILD}"
ARCH_LINUX = $(PACKAGE)-linux-amd64 \
$(PACKAGE)-linux-arm64 \
$(PACKAGE)-linux-386
ARCH_WIN = $(PACKAGE)-windows-amd64.exe \
$(PACKAGE)-windows-386.exe
TARGET = $(PACKAGE)-linux-amd64
# TODO: Must write a configure.ac to find target for user end.
# then we can use:
# all: default
# default: $(TARGET)
all: default
default: $(TARGET)
dist: dist-linux dist-windows
dist-windows: $(ARCH_WIN)
dist-linux: $(ARCH_LINUX)
$(PACKAGE)-linux-arm64:
GOOS=linux \
GOARCH=arm64 \
go build ${LDFLAGS} -o=$@
$(PACKAGE)-linux-amd64:
GOOS=linux \
GOARCH=amd64 \
go build ${LDFLAGS} -o=$@
$(PACKAGE)-linux-386:
GOOS=linux \
GOARCH=386 \
go build ${LDFLAGS} -o=$@
$(PACKAGE)-windows-amd64.exe:
GOOS=windows \
GOARCH=amd64 \
go build ${LDFLAGS} -o=$@
$(PACKAGE)-windows-386.exe:
GOOS=windows \
GOARCH=386 \
go build ${LDFLAGS} -o=$@
dist-clean:
rm -f $(ARCH_WIN) $(ARCH_LINUX)