-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
101 lines (86 loc) · 2.28 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
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
.PHONY: verify-asdf-installed
verify-asdf-installed:
@echo "Verifying asdf is installed..."
@asdf --version > /dev/null \
|| ( \
echo "\n\nPlease visit https://asdf-vm.com/guide/getting-started.html#_1-install-dependencies for installation instructions.\n\n" \
&& exit 1 \
)
@echo "asdf is installed."
@echo
.PHONY: verify-asdf-configured
verify-asdf-configured: verify-asdf-installed
@echo "Verifying asdf is configured..."
@asdf current | grep -qP "nodejs +\d+.\d+.\d+" \
|| ( \
echo "\n\nasdf is not configured. Run 'make setup-asdf' to configure it.\n\n" \
&& exit 1 \
)
@echo "asdf is configured."
@echo
.PHONY: verify-pnpm-installed
verify-pnpm-installed:
@echo "Verifying pnpm is installed..."
@pnpm --version > /dev/null \
|| ( \
echo "\n\npnpm is not installed. Run 'make setup-pnpm' to install it.\n\n" \
&& exit 1 \
)
@echo "pnpm is installed."
@echo
.PHONY: verify-mosquitto
verify-mosquitto:
@echo "Verifying mosquitto executable exists..."
@bin/mosquitto --help | grep "mosquitto version" > /dev/null \
|| ( \
echo "\n\nmosquitto executable does not exist. Run 'make build-mosquitto' to build it.\n\n" \
&& exit 1 \
)
@echo "mosquitto executable exists."
@echo
.PHONY: add-asdf-plugins
add-asdf-plugins: verify-asdf-installed
@echo "Adding nodejs asdf plugin..."
@asdf plugin-add nodejs
@echo
.PHONY: setup-asdf
setup-asdf: add-asdf-plugins
@echo "Installing nodejs..."
@asdf install
@echo
.PHONY: teardown-asdf
teardown-asdf:
@echo "Uninstalling nodejs"
@asdf plugin remove nodejs
@echo
.PHONY: setup-pnpm
setup-pnpm: verify-asdf-configured
@echo "Installing pnpm..."
@npm install -g pnpm
@echo
.PHONY: setup-dev-dependencies
setup-dev-dependencies: verify-asdf-configured verify-pnpm-installed verify-mosquitto add-mosquitto-to-electron
@echo "Installing dev dependencies..."
@pnpm install
@echo
.PHONY: clean
clean:
@echo "Cleaning up..."
@rm -rf node_modules \
bin \
dist-electron
@echo
.PHONY: dev
dev:
@echo "Starting dev env..."
@pnpm run dev
.PHONY: build-mosquitto
build-mosquitto:
@echo "Building mosquitto..."
@./scripts/build_mosquitto.sh
.PHONY: add-mosquitto-to-electron
add-mosquitto-to-electron:
@echo "Adding mosquitto to electron..."
@mkdir -p dist-electron
@cp bin/mosquitto dist-electron
@echo