Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (34 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
45 lines (34 loc) · 1.7 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
APP := AppRec
DERIVED := build
PRODUCTS := $(DERIVED)/Build/Products
VERSION ?= $(shell git describe --tags --abbrev=0 --match 'v*' 2>/dev/null | sed 's/^v//')
XCODEBUILD := xcodebuild -quiet -project $(APP).xcodeproj -scheme $(APP) -derivedDataPath $(DERIVED) -destination 'platform=macOS,arch=$(shell uname -m)' $(if $(VERSION),MARKETING_VERSION=$(VERSION))
.PHONY: help build project release run install dist clean site
.DEFAULT_GOAL := help
SITE_PORT := 8000
help: ## List available commands
@awk 'BEGIN {FS = ":.*## "} /^[a-z]+:.*## / {printf " \033[1m%-9s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: project ## Build a debug version
$(XCODEBUILD) -configuration Debug build
project: ## Generate the Xcode project from project.yml
xcodegen generate --quiet
release: project ## Build a release version
$(XCODEBUILD) -configuration Release build
run: build ## Build and launch the debug app
-pkill -x "$(APP) Debug" && sleep 1
open "$(PRODUCTS)/Debug/$(APP) Debug.app"
install: release ## Build a release and install it to /Applications
-pkill -x $(APP) && sleep 1
rm -rf /Applications/$(APP).app
cp -R $(PRODUCTS)/Release/$(APP).app /Applications/
open /Applications/$(APP).app
dist: release ## Zip the release app to build/AppRec.zip for a GitHub release
rm -f $(DERIVED)/$(APP).zip
ditto -c -k --keepParent $(PRODUCTS)/Release/$(APP).app $(DERIVED)/$(APP).zip
@shasum -a 256 $(DERIVED)/$(APP).zip
clean: ## Remove build output
rm -rf $(DERIVED)
site: ## Serve the website from docs/ at http://localhost:8000
@echo "Serving docs/ at http://localhost:$(SITE_PORT) (Ctrl-C to stop)"
@(sleep 1 && open http://localhost:$(SITE_PORT)) &
python3 -m http.server $(SITE_PORT) --bind 127.0.0.1 --directory docs