PREFIX?= # Can be stack or cabal BUILDER?=stack build: keysafe keysafe: $(BUILDER) build if [ "$(BUILDER)" = stack ]; then \ ln -sf $$(find .stack-work/ -name keysafe -type f | grep build/keysafe/keysafe | tail -n 1) keysafe; \ else \ ln -sf dist/build/keysafe/keysafe keysafe; \ fi clean: rm -rf keysafe dist .stack-work install: install-files useradd --system keysafe chmod 700 $(PREFIX)/var/lib/keysafe chown keysafe:keysafe $(PREFIX)/var/lib/keysafe install-files: keysafe install -d $(PREFIX)/var/lib/keysafe install -d $(PREFIX)/usr/bin install -s -m 0755 keysafe $(PREFIX)/usr/bin/keysafe install -d $(PREFIX)/usr/share/man/man1 install -m 0644 keysafe.1 $(PREFIX)/usr/share/man/man1/keysafe.1 install -d $(PREFIX)/lib/systemd/system install -m 0644 keysafe.service $(PREFIX)/lib/systemd/system/keysafe.service install -d $(PREFIX)/usr/share/applications/ install -m 0644 keysafe.desktop $(PREFIX)/usr/share/applications/keysafe.desktop install -d $(PREFIX)/etc/xdg/autostart/ install -m 0644 keysafe.autostart $(PREFIX)/etc/xdg/autostart/keysafe.desktop .PHONY: keysafe