2018-09-05 21:58:54 +02:00
|
|
|
DESTDIR ?= /
|
|
|
|
PREFIX ?= /usr
|
|
|
|
SYSCONFDIR ?= /etc
|
|
|
|
|
2019-06-15 18:00:17 +02:00
|
|
|
USR = $(DESTDIR)/$(PREFIX)
|
|
|
|
BIN = $(USR)/bin/
|
|
|
|
ETC = $(DESTDIR)/etc/
|
|
|
|
SHARE = $(USR)/share/
|
|
|
|
SYSTEMD_UNITS = $(ETC)/systemd/system/
|
|
|
|
|
2019-06-14 20:50:37 +02:00
|
|
|
all: gpio-wait pydoorlock/Protocol.py
|
2019-06-14 21:29:27 +02:00
|
|
|
|
|
|
|
package:
|
2018-09-05 21:58:54 +02:00
|
|
|
sed -i -r -e "s@(^SYSCONFDIR = ').*('$$)@\1$(SYSCONFDIR)\2@" doorlockd
|
|
|
|
sed -i -r -e "s@(^PREFIX = ').*('$$)@\1$(PREFIX)\2@" doorlockd
|
2018-10-16 21:23:52 +02:00
|
|
|
sed -i -r -e "s@(^__version__ = ').*('$$)@\1$(shell cat VERSION)\2@" doorlockd
|
2018-09-05 21:58:54 +02:00
|
|
|
|
2019-06-14 20:50:37 +02:00
|
|
|
pydoorlock/Protocol.py: avr-code/protocol.h
|
|
|
|
./scripts/gen_protocol.sh $^ > $@
|
|
|
|
|
2018-10-07 01:37:31 +02:00
|
|
|
gpio-wait: gpio-wait.c
|
|
|
|
|
2018-09-05 21:58:54 +02:00
|
|
|
install:
|
2019-06-15 18:00:17 +02:00
|
|
|
mkdir -p $(BIN)
|
|
|
|
mkdir -p $(SHARE)
|
|
|
|
mkdir -p $(SYSTEMD_UNITS)
|
|
|
|
mkdir -p $(ETC)
|
2018-09-05 21:58:54 +02:00
|
|
|
|
2019-06-15 18:00:17 +02:00
|
|
|
install doorlockd gpio-wait doorstate $(BIN)
|
|
|
|
install doorlockd-passwd $(BIN)
|
|
|
|
install -m 0644 doorlockd.cfg $(ETC)
|
|
|
|
install -m 0644 systemd/doorlockd.service systemd/doorstate.service $(SYSTEMD_UNITS)
|
2018-09-05 21:58:54 +02:00
|
|
|
|
2018-10-16 21:34:45 +02:00
|
|
|
pip install --upgrade --force-reinstall --root=$(DESTDIR) .
|
|
|
|
|
2019-06-15 18:00:17 +02:00
|
|
|
cp -av share/* $(SHARE)
|
2019-06-14 21:34:45 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f gpio-wait
|
|
|
|
rm -rf pydoorlock/__pycache__
|
2019-06-14 20:50:37 +02:00
|
|
|
rm -f pydoorlock/Protocol.py
|