-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
43 lines (31 loc) · 1 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
GOOS:=$(shell go env GOOS)
GOARCH:=$(shell go env GOARCH)
LDFLAGS:=
# windows,linux,darwin
GOOS:=$(shell go env GOOS)
# amd64,arm64,arm
GOARCH:=$(shell go env GOARCH)
extension:=
ifeq ($(OS),Windows_NT)
extension=.exe
endif
ifeq ($(GOOS),darwin)
build: dist/darwin/universal/kopiaui
endif
ifeq ($(GOOS),windows)
build: dist/windows/amd64/kopiaui.exe
endif
ifeq ($(GOOS),linux)
build: dist/linux/amd64/kopiaui
endif
dist/darwin/universal/kopiaui: dist/darwin/arm64/kopiaui dist/darwin/amd64/kopiaui
mkdir -p dist/darwin/universal
lipo -create -output $@ $<
dist/darwin/arm64/kopiaui:
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 SDKROOT=$(shell xcrun --sdk macosx --show-sdk-path) go build -o $@ .
dist/darwin/amd64/kopiaui:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 SDKROOT=$(shell xcrun --sdk macosx --show-sdk-path) go build -o $@ .
dist/windows/amd64/kopiaui.exe:
GOOS=windows GOARCH=amd64 go build -ldflags "-H=windowsgui" -o $@ .
dist/linux/amd64/kopiaui:
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o $@ .