-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (42 loc) · 1.26 KB
/
Makefile
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
APPLICATION=otptray
VERSION=0.0.1
PACKAGE_DIR=$(APPLICATION)_$(VERSION)_amd64
DEB_DIR=deb
DEB=$(PACKAGE_DIR).deb
BIN=target/release/$(APPLICATION)
MACOS=macos
MACOS_APP=OTPTray.app
RUST_SOURCES := $(shell find src -name '*.rs')
UBUNTU_FOCAL_PKG=$(PACKAGE_DIR)_focal.deb
UBUNTU_HIRSUTE_PKG=$(PACKAGE_DIR)_hirsute.deb
$(UBUNTU_FOCAL_PKG):
vagrant up focal64-build
vagrant ssh focal64-build -c 'cd /vagrant && make deep_clean all'
mv $(DEB) $@
focal: $(UBUNTU_FOCAL_PKG)
$(UBUNTU_HIRSUTE_PKG):
vagrant up hirsute64-build
vagrant ssh hirsute64-build -c 'cd /vagrant && make deep_clean all'
mv $(DEB) $@
hirsute: $(UBUNTU_HIRSUTE_PKG)
all: $(DEB)
$(BIN): $(RUST_SOURCES)
cargo build --release
$(PACKAGE_DIR): $(BIN)
mkdir -p $(PACKAGE_DIR)/DEBIAN
mkdir -p $(PACKAGE_DIR)/usr/bin
cp $(DEB_DIR)/control $(PACKAGE_DIR)/DEBIAN
cp $(BIN) $(PACKAGE_DIR)/usr/bin
cp -rv share $(PACKAGE_DIR)/usr/share
$(DEB): $(PACKAGE_DIR)
dpkg-deb --build $(PACKAGE_DIR)
$(MACOS_APP): $(BIN)
mkdir -p $(MACOS_APP)/Contents/MacOS
mkdir -p $(MACOS_APP)/Contents/Resources
cp $(BIN) $(MACOS_APP)/Contents/MacOS
cp $(MACOS)/Info.plist $(MACOS_APP)/Contents/Info.plist
clean:
rm -rf $(PACKAGE_DIR) *.deb $(MACOS_APP)
deep_clean: clean
cargo clean
.PHONY: clean deep_clean all hirsute focal