diff --git a/Makefile b/Makefile index c867eb6..0b71c42 100644 --- a/Makefile +++ b/Makefile @@ -26,14 +26,14 @@ ifndef version_test $(error GNU Make version $(MAKE_VERSION); version >= 3.82 is needed) endif -# Paranoia ifeq (,$(filter install uninstall,$(MAKECMDGOALS))) ifeq (0,$(shell id --user)) -$(error Root only can make "(un)install" targets) +$(error Root only can make "(un)install" targets) endif -SUDO := else -SUDO := sudo +ifneq (0,$(shell id --user)) +$(error Only root can make "(un)install" targets) +endif endif ######################################################################## @@ -86,9 +86,10 @@ SHELL := /bin/bash # Warning: only `dnf`! Use this rule as template to your own script. setup: @rpm -q --quiet general-purpose-preprocessor || sudo dnf -y install general-purpose-preprocessor - @rpm -q --quiet jq || sudo dnf -y install jq + @test -e /usr/bin/jq || test -e /usr/local/bin/jq || sudo dnf -y install jq @rpm -q --quiet pandoc || sudo dnf -y install pandoc - @test -d /usr/share/doc/PyYAML || sudo dnf -y install PyYAML + @rpm -q --quiet python2-pyyaml || sudo dnf -y install python2-pyyaml + @echo Done! # Default target all: check @@ -106,19 +107,19 @@ clobber: clean install: [[ -e jqt.1.gz ]] || { cd docs && make ../jqt.1.gz; } - test -d $(bindir) || $(SUDO) mkdir --verbose --parents $(bindir) - test -d $(datadir)/$(PROJECT) || $(SUDO) mkdir --verbose --parents $(datadir)/$(PROJECT) - test -d $(mandir)/man1 || $(SUDO) mkdir --verbose --parents $(mandir)/man1 - $(SUDO) install --verbose --compare --mode 555 bin/* $(bindir) - $(SUDO) install --verbose --compare --mode 644 share/* $(datadir)/$(PROJECT) - $(SUDO) install --verbose --compare --mode 644 jqt.1.gz $(mandir)/man1 - $(SUDO) sed -i -e "s#DATADIR='.*'#DATADIR='$(datadir)'#" $(bindir)/jqt + test -d $(bindir) || mkdir --verbose --parents $(bindir) + test -d $(datadir)/$(PROJECT) || mkdir --verbose --parents $(datadir)/$(PROJECT) + test -d $(mandir)/man1 || mkdir --verbose --parents $(mandir)/man1 + install --verbose --compare --mode 555 bin/* $(bindir) + install --verbose --compare --mode 644 share/* $(datadir)/$(PROJECT) + install --verbose --compare --mode 644 jqt.1.gz $(mandir)/man1 + sed -i -e "s#DATADIR='.*'#DATADIR='$(datadir)'#" $(bindir)/jqt uninstall: - $(SUDO) rm --verbose --force -- $(addprefix $(prefix)/,$(wildcard bin/*)) - $(SUDO) rm --verbose --force -- $(mandir)/man1/jqt.1.gz - test -d $(datadir)/$(PROJECT) \ - && $(SUDO) rm --verbose --force --recursive $(datadir)/$(PROJECT) \ + rm --verbose --force -- $(addprefix $(prefix)/,$(wildcard bin/*)) + rm --verbose --force -- $(mandir)/man1/jqt.1.gz + test -d $(datadir)/$(PROJECT) \ + && rm --verbose --force --recursive $(datadir)/$(PROJECT) \ || true # Show targets diff --git a/README.md b/README.md index ee53ed1..c41716e 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ $ sudo dnf -y install make general-purpose-preprocessor jq pandoc PyYAML ``` To install _jqt_ simply run `make install` on the _jqt_ repository top -directory. If don’t like to install into the `/usr/local` system directory you +directory. If you don’t like to install into the `/usr/local` system directory you can change the destination directory: ```zsh diff --git a/docs/config.yaml b/docs/config.yaml index ee947d6..93925d2 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -41,7 +41,7 @@ menu: - structure - content - data - - blog/index +# - blog/index # Default values defaults: diff --git a/docs/make.d/prelude.make b/docs/make.d/prelude.make index 77b75c8..81003af 100644 --- a/docs/make.d/prelude.make +++ b/docs/make.d/prelude.make @@ -28,9 +28,10 @@ ifeq (,$(filter install uninstall,$(MAKECMDGOALS))) ifeq (0,$(shell id --user)) $(error Root only can make "(un)install" targets) endif -SUDO := else -SUDO := sudo +ifneq (0,$(shell id --user)) +$(error Only root can make "(un)install" targets) +endif endif # Target 'clobber' must be alone diff --git a/docs/project.make b/docs/project.make index fe55f86..1baa83c 100644 --- a/docs/project.make +++ b/docs/project.make @@ -1,11 +1,18 @@ ######################################################################## # -# Specific makefile for this web site +# Specific makefile for this web site. +# This should be the only file to edit by hand! # -# Defined rules for: +# Variables imported: +# Content +# Metadata +# JQTFLAGS +# +# Define new rules for: # $(ManPage) # /tmp/help -# Defined targets: +# +# Add double-colon recipes for targets: # all # clean # clobber @@ -14,6 +21,7 @@ # Build pages options ######################################################################## +# Append parameters to: JQTFLAGS += -msnippets:$(Metadata)/snippets.json # Pandoc options