--- ./Makefile 2023-03-15 07:34:14.000000000 -0400 +++ ./Makefile 2023-03-15 07:38:07.000000000 -0400 @@ -1,12 +1,12 @@ +DESTDIR ?= PREFIX ?= /usr/local BASH_COMPLETION_DIR ?= $(shell pkg-config --silence-errors --variable=completionsdir bash-completion) -USERDIR ?= $(HOME) # The @ symbols make the output silent. install: @if [ $(BASH_COMPLETION_DIR) ]; then \ - cp notes.bash_completion "$(BASH_COMPLETION_DIR)/notes"; \ + cp notes.bash_completion "$(DESTDIR)/$(BASH_COMPLETION_DIR)/notes"; \ else \ printf \ "Bash completion was not installed, because the directory was not found. \ @@ -15,31 +15,17 @@ to manually install it.\n\n"; \ fi # Small test for bash completion support - @install -m755 -d $(PREFIX)/bin/ - @install -m755 notes $(PREFIX)/bin/ - @install -d $(PREFIX)/share/man/man1/ - @install notes.1 $(PREFIX)/share/man/man1/ + @install -m755 -d $(DESTDIR)/$(PREFIX)/bin/ + @install -m755 notes $(DESTDIR)/$(PREFIX)/bin/ + @install -d $(DESTDIR)/$(PREFIX)/share/man/man1/ + @install notes.1 $(DESTDIR)/$(PREFIX)/share/man/man1/ + @install -d $(DESTDIR)/$(PREFIX)/share/notes/examples + @install -m444 config $(DESTDIR)/$(PREFIX)/share/notes/examples/ @mandb 1>/dev/null 2>&1 || true # Fail silently if we don't have a mandb @printf "Notes has been installed to $(PREFIX)/bin/notes.\n" - @if [ ! -f $(USERDIR)/.config/notes/config ]; then \ - install -m777 -d $(USERDIR)/.config/notes/; \ - install -m777 config $(USERDIR)/.config/notes/; \ - printf \ -"A configuration file has also been created at $(USERDIR)/.config/notes/config, \ -which you can edit if you'd like to change the default settings.\n"; \ - fi # install default config file if non present - @printf \ "\nGet started now by running 'notes new my-note' \ or you can run 'notes help' for more info.\n"; \ - -uninstall: - rm -f $(PREFIX)/bin/notes - rm -f $(PREFIX)/share/man/man1/notes.1 - rm -f $(BASH_COMPLETION_DIR)/notes - rm -f $(USERDIR)/.config/notes/config.example - - @printf "\nNotes has now been uninstalled.\n"