Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (63 loc) · 2.17 KB
/
Copy pathMakefile
File metadata and controls
72 lines (63 loc) · 2.17 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
.PHONY: build run clean bundle dmg reset
APP_NAME = OpenFlow
BUNDLE_DIR = build/$(APP_NAME).app
CONTENTS_DIR = $(BUNDLE_DIR)/Contents
MACOS_DIR = $(CONTENTS_DIR)/MacOS
RESOURCES_DIR = $(CONTENTS_DIR)/Resources
# Build the executable
build:
swift build -c release
# Create the .app bundle
bundle: build
@echo "Creating $(APP_NAME).app bundle..."
@mkdir -p $(MACOS_DIR)
@mkdir -p $(RESOURCES_DIR)
@cp .build/release/OpenFlow $(MACOS_DIR)/$(APP_NAME)
@cp OpenFlow/Resources/Info.plist $(CONTENTS_DIR)/Info.plist
@# Copy Assets if any icon files exist
@if [ -d "OpenFlow/Resources/Assets.xcassets" ]; then \
cp -r OpenFlow/Resources/Assets.xcassets $(RESOURCES_DIR)/; \
fi
@# Copy app icon if it exists
@if [ -f "OpenFlow/Resources/AppIcon.icns" ]; then \
cp OpenFlow/Resources/AppIcon.icns $(RESOURCES_DIR)/AppIcon.icns; \
fi
@# Ad-hoc code sign so macOS can track permissions consistently
@codesign --force --sign - $(BUNDLE_DIR)
@echo "✅ $(APP_NAME).app created and signed at $(BUNDLE_DIR)"
# Build, bundle, and run
run: bundle
@echo "Launching $(APP_NAME)..."
@open $(BUNDLE_DIR)
# Development build and run (debug)
dev:
swift build
@mkdir -p $(MACOS_DIR)
@mkdir -p $(RESOURCES_DIR)
@cp .build/debug/OpenFlow $(MACOS_DIR)/$(APP_NAME)
@cp OpenFlow/Resources/Info.plist $(CONTENTS_DIR)/Info.plist
@if [ -f "OpenFlow/Resources/AppIcon.icns" ]; then \
cp OpenFlow/Resources/AppIcon.icns $(RESOURCES_DIR)/AppIcon.icns; \
fi
@codesign --force --sign - $(BUNDLE_DIR)
@echo "Launching $(APP_NAME) (debug)..."
@open $(BUNDLE_DIR)
# Create DMG installer (drag-and-drop to Applications)
dmg: bundle
@chmod +x scripts/create-dmg.sh
@bash scripts/create-dmg.sh
# Clean build artifacts
clean:
swift package clean
rm -rf build/
@echo "✅ Cleaned"
# Install to /Applications
install: bundle
@cp -r $(BUNDLE_DIR) /Applications/$(APP_NAME).app
@echo "✅ Installed to /Applications/$(APP_NAME).app"
# Reset all app data (UserDefaults, database, models) for a fresh start
reset:
@echo "Resetting $(APP_NAME) data..."
@defaults delete com.openflow.app 2>/dev/null || true
@rm -rf ~/Library/Application\ Support/OpenFlow
@echo "✅ All app data cleared. Next launch will show onboarding."