Log in
Makefile 37 lines · 984 B · makefile Blame
1
APP := target/release/Leaf.app
2
3
.PHONY: build run test app install icon clean
4
5
build:
6
	cargo build --release
7
8
run:
9
	cargo run --release
10
11
test:
12
	cargo test
13
14
# A macOS app bundle, so leaf can live in /Applications and the Dock.
15
app: build
16
	rm -rf $(APP)
17
	mkdir -p $(APP)/Contents/MacOS $(APP)/Contents/Resources
18
	cp target/release/leaf $(APP)/Contents/MacOS/leaf
19
	cp macos/Info.plist $(APP)/Contents/Info.plist
20
	cp macos/Leaf.icns $(APP)/Contents/Resources/Leaf.icns
21
22
install: app
23
	rm -rf /Applications/Leaf.app
24
	cp -R $(APP) /Applications/Leaf.app
25
	touch /Applications/Leaf.app
26
27
# Regenerates macos/Leaf.icns from a font glyph, e.g.
28
#   make icon FONT=$$HOME/Downloads/Yarndings20-Regular.ttf GLYPH=h
29
GLYPH ?= h
30
icon:
31
	@test -n "$(FONT)" || (echo "usage: make icon FONT=path/to/font.ttf [GLYPH=h]" && exit 2)
32
	rm -rf target/Leaf.iconset
33
	swift macos/make-icon.swift "$(FONT)" "$(GLYPH)" target/Leaf.iconset
34
	iconutil -c icns target/Leaf.iconset -o macos/Leaf.icns
35
36
clean:
37
	cargo clean