-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
71 lines (52 loc) · 2.02 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
64
65
66
67
68
69
70
71
# makefile to cross compile the certstate tool / utility
# list all cross compile possibilities: go tool dist list
#
# makefile adapted from this example:
# http://stackoverflow.com/documentation/go/1020/cross-compilation#t=201703051136361578518
#
# releases:
# - v1.0.0 - 2018/09/23: initial release
# - v1.1.0 - 2018/09/26: 386 support removed
# - v1.2.0 - 2019/11/03: freebsd, openbsd, solaris support added
appname := certstate
sources := $(wildcard *.go)
build = GOOS=$(1) GOARCH=$(2) go build -o build/$(appname)$(3)
tar = cd build && tar -cvzf $(appname)_$(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
zip = cd build && zip $(appname)_$(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
.PHONY: all windows darwin linux freebsd openbsd solaris clean
all: linux darwin windows freebsd openbsd solaris
clean:
rm -rf build/
# ----- linux builds -----
linux: build/$(appname)_linux_amd64.tar.gz build/$(appname)_linux_arm64.tar.gz
build/$(appname)_linux_amd64.tar.gz: $(sources)
$(call build,linux,amd64,)
$(call tar,linux,amd64)
build/$(appname)_linux_arm64.tar.gz: $(sources)
$(call build,linux,arm64,)
$(call tar,linux,arm64)
# ----- darwin (macOS) build -----
darwin: build/$(appname)_darwin_amd64.tar.gz
build/$(appname)_darwin_amd64.tar.gz: $(sources)
$(call build,darwin,amd64,)
$(call tar,darwin,amd64)
# ----- windows build -----
windows: build/$(appname)_windows_amd64.zip
build/$(appname)_windows_amd64.zip: $(sources)
$(call build,windows,amd64,.exe)
$(call zip,windows,amd64,.exe)
# ----- freebsd build -----
linux: build/$(appname)_freebsd_amd64.tar.gz
build/$(appname)_freebsd_amd64.tar.gz: $(sources)
$(call build,freebsd,amd64,)
$(call tar,freebsd,amd64)
# ----- openbsd build -----
linux: build/$(appname)_openbsd_amd64.tar.gz
build/$(appname)_openbsd_amd64.tar.gz: $(sources)
$(call build,openbsd,amd64,)
$(call tar,openbsd,amd64)
# ----- solaris build -----
linux: build/$(appname)_solaris_amd64.tar.gz
build/$(appname)_solaris_amd64.tar.gz: $(sources)
$(call build,solaris,amd64,)
$(call tar,solaris,amd64)