Skip to content

Commit

Permalink
make: Move service generation into install target (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvaiya committed Jul 28, 2024
1 parent f0b5f12 commit 393d341
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ endif
all:
-mkdir bin
cp scripts/keyd-application-mapper bin/
sed -e 's#@PREFIX@#$(PREFIX)#' keyd.service.in > keyd.service
sed -e 's#@PREFIX@#$(PREFIX)#' src/vkbd/usb-gadget.service.in > src/vkbd/usb-gadget.service
$(CC) $(CFLAGS) -O3 $(COMPAT_FILES) src/*.c src/vkbd/$(VKBD).c -lpthread -o bin/keyd $(LDFLAGS)
debug:
CFLAGS="-g -fsanitize=address -Wunused" $(MAKE)
Expand All @@ -49,14 +47,17 @@ man:
scdoc < "$$f" | gzip > "$$target"; \
done
install:

@if [ -e /run/systemd/system ]; then \
sed -e 's#@PREFIX@#$(PREFIX)#' keyd.service.in > keyd.service; \
mkdir -p $(DESTDIR)$(PREFIX)/lib/systemd/system/; \
install -Dm644 keyd.service $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd.service; \
else \
echo "NOTE: systemd not found, you will need to manually add keyd to your system's init process."; \
fi

@if [ "$(VKBD)" = "usb-gadget" ]; then \
sed -e 's#@PREFIX@#$(PREFIX)#' src/vkbd/usb-gadget.service.in > src/vkbd/usb-gadget.service; \
install -Dm644 src/vkbd/usb-gadget.service $(DESTDIR)$(PREFIX)/lib/systemd/system/keyd-usb-gadget.service; \
install -Dm755 src/vkbd/usb-gadget.sh $(DESTDIR)$(PREFIX)/bin/keyd-usb-gadget.sh; \
fi
Expand Down

0 comments on commit 393d341

Please sign in to comment.