This repository has been archived by the owner on Aug 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (42 loc) · 1.95 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
.PHONY: all clean clean-all run run-pex install uninstall-most uninstall
all: surface-dtx-daemon.pex
surface-dtx-daemon.pex: $(wildcard dtx/*.py)
$(eval DEPS:=$(shell env PIPENV_VENV_IN_PROJECT=1 pipenv lock -r | grep -v '^-i'))
pex . ${DEPS} -e surface_dtx.daemon:run_app -o $@
clean:
@rm -rf dtx/__pycache__
@rm -rf surface_dtx.egg-info
clean-all: clean
@rm -rf .venv
@rm -f surface-dtx-daemon.pex
run:
./surface-dtx-daemon -c ./etc/surface-dtx.cfg
run-pex:
$(eval DEPS:=$(shell env PIPENV_VENV_IN_PROJECT=1 pipenv lock -r | grep -v '^-i'))
pex . ${DEPS} -e surface_dtx.daemon:run_app -- -c ./etc/surface-dtx.cfg
install: surface-dtx-daemon.pex
@echo "Installing app files to '${DESTDIR}/opt/surface-dtx/'."
@mkdir -p "${DESTDIR}/opt/surface-dtx/"
@cp "surface-dtx-daemon.pex" "${DESTDIR}/opt/surface-dtx/surface-dtx-daemon"
@cp "LICENSE" "${DESTDIR}/opt/surface-dtx/"
@cp "README.md" "${DESTDIR}/opt/surface-dtx/"
@chmod 644 "${DESTDIR}/opt/surface-dtx/LICENSE"
@chmod 644 "${DESTDIR}/opt/surface-dtx/README.md"
@chmod 755 "${DESTDIR}/opt/surface-dtx/surface-dtx-daemon"
@echo "Installing config files to '${DESTDIR}/etc/surface-dtx/'."
@mkdir -p "${DESTDIR}/etc/surface-dtx/"
@cp etc/* "${DESTDIR}/etc/surface-dtx/"
@chmod 644 "${DESTDIR}/etc/surface-dtx/surface-dtx.cfg"
@chmod 755 "${DESTDIR}/etc/surface-dtx/attach.sh"
@chmod 755 "${DESTDIR}/etc/surface-dtx/detach.sh"
@echo "Installing systemd unit file to '${DESTDIR}/usr/lib/systemd/system/surface-dtx.service'."
@mkdir -p "${DESTDIR}/usr/lib/systemd/system/"
@cp systemd/surface-dtx.service "${DESTDIR}/usr/lib/systemd/system/surface-dtx.service"
@chmod 644 "${DESTDIR}/usr/lib/systemd/system/surface-dtx.service"
@echo "Installation complete."
@echo " Don't forget to run 'systemctl enable surface-dtx.service'".
uninstall-core:
@rm -rf ${DESTDIR}/opt/surface-dtx
@rm -rf ${DESTDIR}/usr/lib/systemd/system/surface-dtx.service
uninstall: uninstall-core
@rm -rf ${DESTDIR}/etc/surface-dtx