-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile.lsp
37 lines (37 loc) · 964 Bytes
/
Makefile.lsp
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
(let*
((exe (if (equal (getenv "OS") "Windows_NT") ".exe" ""))
(name (notdir (abspath ".")))
(aout (string-append name exe))
(version (shell "git describe --tag"))
(ldflags (string-append "-s -w -X main.version=" version))
(mkdir (lambda (d) (or (-d d) (sh ($ "mkdir $(d)")))))
(build
(lambda (target)
(mkdir "bin")
(mkdir ($ "bin$/$(target)"))
(setenv "GOARCH" target)
(x "go" "build" "-o" ($ "bin$/$(target)$/$(aout)") "-ldflags" ldflags)
)))
(make
$1
('("snapshot")
(x "go" "fmt")
(x "go" "build" "-ldflags" ldflags)
)
('("all")
(x "go" "fmt")
(build "386")
(build "amd64")
)
('("package" "all")
(mapc
(lambda (x)
(sh ($ "zip -9j $(name)-$(version)-$(x).zip bin$/$(x)$/$(aout)")))
'("386" "amd64"))
)
('("get")
(sh "go get -u")
(sh "go mod tidy")
)
)
)