Makefile in zach/leaf

Makefile 39 lines · 1.1 KB · makefile
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 target/release/leaf-settings $(APP)/Contents/MacOS/leaf-settings
20
	cp macos/Info.plist $(APP)/Contents/Info.plist
21
	cp macos/Leaf.icns $(APP)/Contents/Resources/Leaf.icns
22
	cp shell/leaf.zsh $(APP)/Contents/Resources/leaf.zsh
23
24
install: app
25
	rm -rf /Applications/Leaf.app
26
	cp -R $(APP) /Applications/Leaf.app
27
	touch /Applications/Leaf.app
28
29
# Regenerates macos/Leaf.icns from a font glyph, e.g.
30
#   make icon FONT=$$HOME/Downloads/Yarndings20-Regular.ttf GLYPH=h
31
GLYPH ?= h
32
icon:
33
	@test -n "$(FONT)" || (echo "usage: make icon FONT=path/to/font.ttf [GLYPH=h]" && exit 2)
34
	rm -rf target/Leaf.iconset
35
	swift macos/make-icon.swift "$(FONT)" "$(GLYPH)" target/Leaf.iconset
36
	iconutil -c icns target/Leaf.iconset -o macos/Leaf.icns
37
38
clean:
39
	cargo clean