-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (34 loc) · 958 Bytes
/
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
NAME = sshsrv
PACKAGE = github.com/Crosse/$(NAME)
default: release
define build
@env GOOS=$(1) GOARCH=$(2) make release/$(NAME)-$(1)-$(2)$(3)
endef
release/$(NAME)-%:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o "$@" $(PACKAGE)
release/$(NAME)-darwin-universal: release/$(NAME)-darwin-amd64 release/$(NAME)-darwin-arm64
$(RM) "$@"
lipo -create -o "$@" $^
.PHONY: release
release:
mkdir -p release
$(call build,linux,arm)
$(call build,linux,amd64)
$(call build,linux,arm64)
$(call build,darwin,amd64)
$(call build,darwin,arm64)
@make release/$(NAME)-darwin-universal
$(call build,openbsd,arm)
$(call build,openbsd,amd64)
$(call build,openbsd,arm64)
$(call build,freebsd,arm)
$(call build,freebsd,amd64)
$(call build,freebsd,arm64)
$(call build,windows,amd64,.exe)
$(call build,windows,arm64,.exe)
.PHONY: zip
zip: release
find release -type f ! -name '*.zip' -execdir zip -9 "{}.zip" "{}" \;
.PHONY: clean
clean:
$(RM) -r release