-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) · 1.1 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) · 1.1 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
.PHONY: proxy app run run-app clean tidy test
BUILD_DIR := build
PROXY_BIN := $(BUILD_DIR)/focus-shield-proxy
APP_NAME := FocusShield
APP_BUNDLE := $(BUILD_DIR)/$(APP_NAME).app
APP_BIN := $(APP_BUNDLE)/Contents/MacOS/$(APP_NAME)
APP_RES := $(APP_BUNDLE)/Contents/Resources
SWIFT_SOURCES := $(wildcard app/*.swift)
SDK := $(shell xcrun --sdk macosx --show-sdk-path)
proxy:
mkdir -p $(BUILD_DIR)
cd proxy && go build -trimpath -o ../$(PROXY_BIN) .
run: proxy
./$(PROXY_BIN) -v
# Build the Swift menubar app. Bundles the proxy binary into Resources so
# ProxyController can find it at runtime.
app: proxy
@echo "→ building $(APP_BUNDLE)"
mkdir -p $(APP_BUNDLE)/Contents/MacOS $(APP_RES)
cp app/Info.plist $(APP_BUNDLE)/Contents/Info.plist
cp $(PROXY_BIN) $(APP_RES)/focus-shield-proxy
swiftc \
-sdk $(SDK) \
-target arm64-apple-macosx13.0 \
-O \
-parse-as-library \
-module-name $(APP_NAME) \
-o $(APP_BIN) \
$(SWIFT_SOURCES)
@echo "→ built $(APP_BUNDLE)"
run-app: app
open $(APP_BUNDLE)
test:
cd proxy && go test ./...
tidy:
cd proxy && go mod tidy
clean:
rm -rf $(BUILD_DIR)