From 4891206c071679f82d72ad9e81fca88527013051 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 5 Jan 2019 16:06:43 -0800 Subject: [PATCH] Added makefile for install/uninstall. --- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b457b26 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +PREFIX= + +all: + @echo "Nothing to build." + +install: + @prefix="$(PREFIX)"; \ + if [[ ! $$prefix ]]; then \ + read -p $$'\033[1mWhere do you want to install? (default: /usr/local) \033[0m' prefix; \ + fi; \ + if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \ + mkdir -pv $$prefix/bin $$prefix/share/man/man1 \ + && cp -v nowopen $$prefix/bin/ \ + && cp -v doc/nowopen.1 $$prefix/share/man/man1/; + +uninstall: + @prefix="$(PREFIX)"; \ + if [[ ! $$prefix ]]; then \ + read -p $$'\033[1mWhere do you want to uninstall from? (default: /usr/local) \033[0m' prefix; \ + fi; \ + if [[ ! $$prefix ]]; then prefix="/usr/local"; fi; \ + echo "Deleting..."; \ + xdg_data_home=$$XDG_DATA_HOME; \ + if [[ ! $$xdg_data_home ]]; then $$xdg_data_home = "~/.local/share"; fi; \ + for f in $$xdg_data_home/nowopen ~/.businesshours; do \ + if [[ -f $$f || -d $$f ]]; then \ + read -p "Do you want to delete $$f? (Y/n) " confirm; \ + if [[ confirm -ne "n" ]]; then rm -rvf $$f; fi; \ + fi; \ + done; \ + rm -rvf $$prefix/bin/nowopen $$prefix/share/man/man1/doc/nowopen.1; +