-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (57 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
73 lines (57 loc) · 2.08 KB
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
72
73
APP=WhyAwake
EXE=whyawake
VERSION=v0.10
IDENTITY ?= Developer ID Application: Casey Muller (AZGE7WP274)
IDENTIFIER=whyawake.caseymrm.github.com
SDK=$(shell xcrun --sdk macosx --show-sdk-path)
BUILD=build
APPDIR=$(APP).app
MACOS=$(APPDIR)/Contents/MacOS
# menuet's UNUserNotificationCenter requires macOS 10.14+; arm64 requires 11+
AMD64_MIN=10.14
ARM64_MIN=11.0
GO=go
GOFLAGS=-trimpath -ldflags="-s -w"
.PHONY: all amd64 arm64 universal app sign notarize zip release clean web-preview
all: app
$(BUILD):
mkdir -p $(BUILD)
# Capture a JSON snapshot of the running menu for the menuet.app showcase.
# Override MENUET_SNAPSHOT_DELAY to give startup goroutines more time to
# populate state (default is 2s).
web-preview: $(BUILD)
$(GO) build $(GOFLAGS) -o $(BUILD)/$(EXE)-snapshot .
MENUET_SNAPSHOT_PATH=menuet-demo.json $(BUILD)/$(EXE)-snapshot
@echo "Wrote menuet-demo.json"
amd64: $(BUILD)
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
CGO_CFLAGS="-mmacosx-version-min=$(AMD64_MIN) -isysroot $(SDK)" \
CGO_LDFLAGS="-mmacosx-version-min=$(AMD64_MIN)" \
$(GO) build $(GOFLAGS) -o $(BUILD)/$(EXE)-amd64 .
arm64: $(BUILD)
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
CGO_CFLAGS="-mmacosx-version-min=$(ARM64_MIN) -isysroot $(SDK)" \
CGO_LDFLAGS="-mmacosx-version-min=$(ARM64_MIN)" \
$(GO) build $(GOFLAGS) -o $(BUILD)/$(EXE)-arm64 .
universal: amd64 arm64
lipo -create -output $(BUILD)/$(EXE) $(BUILD)/$(EXE)-amd64 $(BUILD)/$(EXE)-arm64
lipo -info $(BUILD)/$(EXE)
app: universal
cp $(BUILD)/$(EXE) $(MACOS)/$(EXE)
sign: app
codesign --force --options runtime --timestamp \
--sign "$(IDENTITY)" $(APPDIR)
zip:
rm -f $(BUILD)/$(APP).app.zip
ditto -c -k --keepParent $(APPDIR) $(BUILD)/$(APP).app.zip
# Requires a keychain profile named AC_NOTARY: xcrun notarytool store-credentials AC_NOTARY
notarize: sign zip
xcrun notarytool submit $(BUILD)/$(APP).app.zip --keychain-profile AC_NOTARY --wait
xcrun stapler staple $(APPDIR)
$(MAKE) zip
release: zip
gh release create $(VERSION) $(BUILD)/$(APP).app.zip \
--title "$(VERSION)" \
--notes-file RELEASE_NOTES.md
clean:
rm -rf $(BUILD)