-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (81 loc) · 3.5 KB
/
Makefile
File metadata and controls
92 lines (81 loc) · 3.5 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
APP_NAME ?= AutoClawd
BUNDLE_ID ?= com.autoclawd.app
BUILD_DIR = build
APP_BUNDLE = $(BUILD_DIR)/$(APP_NAME).app
CODESIGN_IDENTITY ?= -
CONTENTS = $(APP_BUNDLE)/Contents
MACOS_DIR = $(CONTENTS)/MacOS
SOURCES = $(wildcard Sources/*.swift)
RESOURCES = $(CONTENTS)/Resources
ARCH ?= $(shell uname -m)
ICON_SOURCE = Resources/AppIcon-Source.png
ICON_ICNS = Resources/AppIcon.icns
SDK = $(shell xcrun --show-sdk-path)
TARGET = $(ARCH)-apple-macosx13.0
VFS_OVERLAY = $(BUILD_DIR)/vfs-overlay.yaml
SWIFT_FLAGS = \
-parse-as-library \
-sdk $(SDK) \
-target $(TARGET) \
-lsqlite3 \
-framework ShazamKit
# Auto-enable native Liquid Glass APIs (glassEffect) when building with macOS 26+ SDK (Tahoe).
# On older SDKs (< 26) the flag is absent and the legacy ultraThinMaterial path compiles instead.
_SDK_MAJOR := $(shell xcrun --show-sdk-version 2>/dev/null | awk -F. '{printf "%d", $$1}')
ifeq ($(shell test "$(_SDK_MAJOR)" -ge 26 2>/dev/null && echo yes),yes)
SWIFT_FLAGS += -DNATIVE_GLASS_AVAILABLE
endif
VERSION ?= 0.1.0
DMG_NAME = $(APP_NAME)-$(VERSION).dmg
DMG_STAGING = $(BUILD_DIR)/dmg-staging
DMG_PATH = $(BUILD_DIR)/$(DMG_NAME)
.PHONY: all clean run dmg
all: $(MACOS_DIR)/$(APP_NAME)
$(MACOS_DIR)/$(APP_NAME): $(SOURCES) Info.plist $(ICON_ICNS)
@mkdir -p "$(MACOS_DIR)" "$(RESOURCES)"
swiftc $(SWIFT_FLAGS) \
-o "$(MACOS_DIR)/$(APP_NAME)" \
$(SOURCES)
@cp Info.plist "$(CONTENTS)/"
@plutil -replace CFBundleName -string "$(APP_NAME)" "$(CONTENTS)/Info.plist"
@plutil -replace CFBundleDisplayName -string "$(APP_NAME)" "$(CONTENTS)/Info.plist"
@plutil -replace CFBundleExecutable -string "$(APP_NAME)" "$(CONTENTS)/Info.plist"
@plutil -replace CFBundleIdentifier -string "$(BUNDLE_ID)" "$(CONTENTS)/Info.plist"
@cp $(ICON_ICNS) "$(RESOURCES)/"
@xattr -cr "$(APP_BUNDLE)" 2>/dev/null || true
@codesign --force --sign "$(CODESIGN_IDENTITY)" \
--entitlements AutoClawd.entitlements "$(APP_BUNDLE)"
@echo "Built $(APP_BUNDLE)"
clean:
rm -rf $(BUILD_DIR)
run: all
@-pkill -x "$(APP_NAME)" 2>/dev/null; true
@sleep 0.4
@# Try to install into ~/Applications; if bundle is locked (quarantine/codesign), fall back to build dir
@chmod -R u+w ~/Applications/$(APP_NAME).app 2>/dev/null; true
@rm -rf ~/Applications/$(APP_NAME).app 2>/dev/null; true
@cp -r "$(APP_BUNDLE)" ~/Applications/ 2>/dev/null && \
open ~/Applications/$(APP_NAME).app 2>/dev/null || \
open "$(APP_BUNDLE)"
# ── DMG ──────────────────────────────────────────────────────────────────────
# Produces build/AutoClawd-<VERSION>.dmg — standard drag-to-Applications UX.
# No external tools required; uses only hdiutil + AppleScript (built into macOS).
dmg: all
@echo "Building DMG $(DMG_NAME)..."
@rm -rf "$(DMG_STAGING)" "$(DMG_PATH)" "$(BUILD_DIR)/tmp-rw.dmg"
@mkdir -p "$(DMG_STAGING)"
@cp -r "$(APP_BUNDLE)" "$(DMG_STAGING)/"
@ln -s /Applications "$(DMG_STAGING)/Applications"
@hdiutil create -srcfolder "$(DMG_STAGING)" \
-volname "$(APP_NAME)" -fs HFS+ -format UDRW \
-o "$(BUILD_DIR)/tmp-rw.dmg" > /dev/null
@hdiutil attach -readwrite -noverify "$(BUILD_DIR)/tmp-rw.dmg" > /dev/null
@sleep 2
@bash scripts/set-dmg-appearance.sh "$(APP_NAME)" "$(APP_NAME)"
@hdiutil detach "/Volumes/$(APP_NAME)" > /dev/null
@hdiutil convert "$(BUILD_DIR)/tmp-rw.dmg" \
-format UDZO -imagekey zlib-level=9 \
-o "$(DMG_PATH)" > /dev/null
@rm -f "$(BUILD_DIR)/tmp-rw.dmg"
@rm -rf "$(DMG_STAGING)"
@echo "Done → $(DMG_PATH)"