-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
210 lines (169 loc) · 8.75 KB
/
Makefile
File metadata and controls
210 lines (169 loc) · 8.75 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
.PHONY: help build build-ios build-macos build-tvos build-ios-ci build-macos-ci build-tvos-ci list-device run-ios-sim run-ios-device run-macos run-tvos-sim run-tvos-device archive-ios archive-macos archive-tvos archive-ios-organizer archive-macos-organizer archive-tvos-organizer export release release-organizer release-ios release-macos release-tvos clean-archives clean-exports bump major minor patch format localize
# Configuration
SCHEME = KMReader
PROJECT = KMReader.xcodeproj
MISC_DIR = misc
ARCHIVES_DIR = archives
EXPORTS_DIR = exports
# Colors
GREEN = \033[0;32m
YELLOW = \033[1;33m
NC = \033[0m # No Color
help: ## Show this help message
@echo "KMReader Build Commands"
@echo ""
@echo "Format commands:"
@echo " make format - Format Swift files with swift-format"
@echo " make localize - Sync Localizable.xcstrings from stringsdata"
@echo ""
@echo "Build commands:"
@echo " make build - Build all platforms (iOS, macOS, tvOS)"
@echo " make build-ios - Build for iOS"
@echo " make build-macos - Build for macOS"
@echo " make build-tvos - Build for tvOS"
@echo ""
@echo "Run commands:"
@echo " make list-device - List available devices (simulators and physical)"
@echo " make run-ios-sim - Build and run on iOS simulator"
@echo " make run-ios-device - Build and run on iOS device"
@echo " make run-macos - Build and run on macOS"
@echo " make run-tvos-sim - Build and run on tvOS simulator"
@echo " make run-tvos-device - Build and run on tvOS device"
@echo " (Add '-select' suffix to force device selection, e.g., run-ios-sim-select)"
@echo ""
@echo "Archive commands:"
@echo " make archive-ios - Archive for iOS (custom location)"
@echo " make archive-macos - Archive for macOS (custom location)"
@echo " make archive-tvos - Archive for tvOS (custom location)"
@echo " make archive-ios-organizer - Archive for iOS (appears in Xcode Organizer)"
@echo " make archive-macos-organizer - Archive for macOS (appears in Xcode Organizer)"
@echo " make archive-tvos-organizer - Archive for tvOS (appears in Xcode Organizer)"
@echo ""
@echo "Export commands:"
@echo " make export ARCHIVE=<path> [OPTIONS=<plist>] [DEST=<dir>]"
@echo " Example: make export ARCHIVE=archives/KMReader-iOS_20240101_120000.xcarchive"
@echo ""
@echo "Build all platforms:"
@echo " make release - Archive and export all platforms (iOS, macOS, tvOS)"
@echo " make release-organizer - Archive and export all platforms (appears in Organizer)"
@echo ""
@echo "Clean commands:"
@echo " make clean-archives - Remove all archives"
@echo " make clean-exports - Remove all exports"
@echo " make clean - Remove archives and exports"
@echo ""
@echo "Version commands:"
@echo " make bump - Increment CURRENT_PROJECT_VERSION and commit only the version file"
@echo " make major - Increment major version and commit only the version file"
@echo " make minor - Increment minor version and commit only the version file"
@echo ""
build: build-ios build-macos build-tvos ## Build all platforms (iOS, macOS, tvOS)
@echo "$(GREEN)All platforms built successfully!$(NC)"
build-ios: ## Build for iOS
@python3 $(MISC_DIR)/xcode.py build ios
build-macos: ## Build for macOS
@python3 $(MISC_DIR)/xcode.py build macos
build-tvos: ## Build for tvOS
@python3 $(MISC_DIR)/xcode.py build tvos
build-ios-ci: ## Build for iOS (CI, uses simulator, no code signing)
@python3 $(MISC_DIR)/xcode.py build ios --ci
build-macos-ci: ## Build for macOS (CI, no code signing)
@python3 $(MISC_DIR)/xcode.py build macos --ci
build-tvos-ci: ## Build for tvOS (CI, uses simulator, no code signing)
@python3 $(MISC_DIR)/xcode.py build tvos --ci
list-device: ## List available devices
@python3 $(MISC_DIR)/xcode.py list
run-ios-sim: ## Build and run on iOS simulator
@python3 $(MISC_DIR)/xcode.py run ios --simulator
run-ios-sim-select: ## Build and run on iOS simulator (force device selection)
@python3 $(MISC_DIR)/xcode.py run ios --simulator --select
run-ios-device: ## Build and run on iOS device
@python3 $(MISC_DIR)/xcode.py run ios --device
run-ios-device-select: ## Build and run on iOS device (force device selection)
@python3 $(MISC_DIR)/xcode.py run ios --device --select
run-macos: ## Build and run on macOS
@python3 $(MISC_DIR)/xcode.py run macos
run-tvos-sim: ## Build and run on tvOS simulator
@python3 $(MISC_DIR)/xcode.py run tvos --simulator
run-tvos-sim-select: ## Build and run on tvOS simulator (force device selection)
@python3 $(MISC_DIR)/xcode.py run tvos --simulator --select
run-tvos-device: ## Build and run on tvOS device
@python3 $(MISC_DIR)/xcode.py run tvos --device
run-tvos-device-select: ## Build and run on tvOS device (force device selection)
@python3 $(MISC_DIR)/xcode.py run tvos --device --select
archive-ios: ## Archive for iOS
@echo "$(GREEN)Archiving for iOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive ios --destination $(ARCHIVES_DIR)
@echo "$(GREEN)iOS archived successfully!$(NC)"
archive-macos: ## Archive for macOS
@echo "$(GREEN)Archiving for macOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive macos --destination $(ARCHIVES_DIR)
@echo "$(GREEN)macOS archived successfully!$(NC)"
archive-tvos: ## Archive for tvOS
@echo "$(GREEN)Archiving for tvOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive tvos --destination $(ARCHIVES_DIR)
@echo "$(GREEN)tvOS archived successfully!$(NC)"
archive-ios-organizer: ## Archive for iOS (appears in Xcode Organizer)
@echo "$(GREEN)Archiving for iOS (will appear in Organizer)...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive ios --show-in-organizer
@echo "$(GREEN)iOS archived successfully!$(NC)"
archive-macos-organizer: ## Archive for macOS (appears in Xcode Organizer)
@echo "$(GREEN)Archiving for macOS (will appear in Organizer)...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive macos --show-in-organizer
@echo "$(GREEN)macOS archived successfully!$(NC)"
archive-tvos-organizer: ## Archive for tvOS (appears in Xcode Organizer)
@echo "$(GREEN)Archiving for tvOS (will appear in Organizer)...$(NC)"
@python3 $(MISC_DIR)/xcode.py archive tvos --show-in-organizer
@echo "$(GREEN)tvOS archived successfully!$(NC)"
export: ## Export archive (requires ARCHIVE=<path>)
@if [ -z "$(ARCHIVE)" ]; then \
echo "Error: ARCHIVE path is required"; \
echo "Usage: make export ARCHIVE=<path> [OPTIONS=<plist>] [DEST=<dir>]"; \
exit 1; \
fi
@python3 $(MISC_DIR)/xcode.py export "$(ARCHIVE)" "$(OPTIONS)" "$(DEST)"
@echo "$(GREEN)Exported successfully!$(NC)"
release: ## Archive and export all platforms (iOS, macOS, tvOS)
@echo "$(GREEN)Building all platforms...$(NC)"
@python3 $(MISC_DIR)/xcode.py release
@echo "$(GREEN)All platforms built successfully!$(NC)"
release-organizer: ## Archive and export all platforms (appears in Xcode Organizer)
@echo "$(GREEN)Building all platforms (will appear in Organizer)...$(NC)"
@python3 $(MISC_DIR)/xcode.py release --show-in-organizer
@echo "$(GREEN)All platforms built successfully!$(NC)"
release-ios: ## Archive and export iOS only
@echo "$(GREEN)Building iOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py release --platform ios
@echo "$(GREEN)iOS built successfully!$(NC)"
release-macos: ## Archive and export macOS only
@echo "$(GREEN)Building macOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py release --platform macos
@echo "$(GREEN)macOS built successfully!$(NC)"
release-tvos: ## Archive and export tvOS only
@echo "$(GREEN)Building tvOS...$(NC)"
@python3 $(MISC_DIR)/xcode.py release --platform tvos
@echo "$(GREEN)tvOS built successfully!$(NC)"
clean-archives: ## Remove all archives
@echo "$(YELLOW)Cleaning archives...$(NC)"
@rm -rf $(ARCHIVES_DIR)
@echo "$(GREEN)Archives cleaned successfully!$(NC)"
clean-exports: ## Remove all exports
@echo "$(YELLOW)Cleaning exports...$(NC)"
@rm -rf $(EXPORTS_DIR)
@echo "$(GREEN)Exports cleaned successfully!$(NC)"
clean: clean-archives clean-exports ## Remove archives and exports
@echo "$(GREEN)Cleaned archives and exports successfully!$(NC)"
bump: ## Increment CURRENT_PROJECT_VERSION and commit only the version file
@$(MISC_DIR)/bump.sh
major: ## Increment major version and commit only the version file
@$(MISC_DIR)/bump-version.sh major
minor: ## Increment minor version and commit only the version file
@$(MISC_DIR)/bump-version.sh minor
format: ## Format Swift files with swift-format
@echo "$(GREEN)Formatting Swift files...$(NC)"
@find . -name "*.swift" -not -path "./DerivedData/*" -not -path "./.build/*" -not -path "./packages/*" | xargs swift-format -i
@echo "$(GREEN)Formatted Swift files successfully!$(NC)"
localize: ## Sync Localizable.xcstrings from stringsdata
@echo "$(GREEN)Syncing Localizable.xcstrings from stringsdata...$(NC)"
@python3 $(MISC_DIR)/localize.py
@echo "$(GREEN)Sync localizable strings successfully!$(NC)"