diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2022-02-23 01:23:25 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2022-02-23 01:50:46 +0100 |
commit | 733ed91162b02cd0fa5d7d1c443c780d3d4405e9 (patch) | |
tree | 8a73ed215a4f8dc9baaf79cf09aa68f9a4017bb9 /Makefile | |
parent | 79ef41e0b7565c2fed691f1492a1f239dd82e7b6 (diff) |
Makefile: Honor builddir=.
Defaulting to ‘build’. Also, remove BUILD_DOCDIR= (replaced with
‘$(builddir)/doc’).
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,10 +1,10 @@ srcdir ?= . -BUILD_DOCDIR ?= $(srcdir)/doc +builddir ?= build CSS ?= /usr/share/javascript/bootstrap4/css/bootstrap.css HTML_TEMPLATE ?= $(srcdir)/doc/template.html -HTML_FILES = $(addprefix $(BUILD_DOCDIR)/,$(patsubst $(srcdir)/doc/%.md,%.html,$(wildcard $(srcdir)/doc/*.md))) -MANUAL_FILES = $(addprefix $(BUILD_DOCDIR)/,$(patsubst $(srcdir)/doc/%.md,%,$(wildcard $(srcdir)/doc/*.[1-9].md))) +HTML_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%.html,$(wildcard $(srcdir)/doc/*.md)) +MANUAL_FILES = $(patsubst $(srcdir)/doc/%.md,$(builddir)/doc/%,$(wildcard $(srcdir)/doc/*.[1-9].md)) all: manual @@ -12,7 +12,8 @@ manual: $(MANUAL_FILES) html: $(HTML_FILES) # upper case the headers and remove the links -$(MANUAL_FILES): $(BUILD_DOCDIR)/%: $(srcdir)/doc/%.md +$(MANUAL_FILES): $(builddir)/doc/%: $(srcdir)/doc/%.md + @mkdir -vp $(dir $@) pandoc -f markdown -t json -- "$<" | $(srcdir)/pandoc2man.jq | pandoc -s -f json -t man -o "$@" test: @@ -37,8 +38,9 @@ release: -- Changelog interimap pullimap lib/Net/IMAP/InterIMAP.pm && \ git -C $(srcdir) tag -sm "Release version $$VERS" "v$$VERS" -## make html CSS="https://guilhem.org/static/css/bootstrap.min.css" BUILD_DOCDIR="$XDG_RUNTIME_DIR/Downloads" -$(HTML_FILES): $(BUILD_DOCDIR)/%.html: $(srcdir)/doc/%.md $(HTML_TEMPLATE) +## `make html CSS="https://guilhem.org/static/css/bootstrap.min.css" builddir="$XDG_RUNTIME_DIR/Downloads/interimap"` +$(HTML_FILES): $(builddir)/doc/%.html: $(srcdir)/doc/%.md $(HTML_TEMPLATE) + @mkdir -vp $(dir $@) mtime="$$(git -C $(srcdir) --no-pager log -1 --pretty="format:%ct" -- "$<" 2>/dev/null)"; \ [ -n "$$mtime" ] || mtime="$$(date +%s -r "$<")"; \ [ "$<" = "doc/index.md" ] && parent="" || parent="./index.html"; \ @@ -66,7 +68,7 @@ man1dir ?= $(mandir)/man1 install: all $(INSTALL_PROGRAM) -vDt $(DESTDIR)$(bindir) $(srcdir)/interimap $(srcdir)/pullimap $(INSTALL_DATA) -vDT $(srcdir)/lib/Net/IMAP/InterIMAP.pm $(DESTDIR)$(datarootdir)/perl5/Net/IMAP/InterIMAP.pm - -$(INSTALL_DATA) -vDt $(DESTDIR)$(man1dir) $(BUILD_DOCDIR)/interimap.1 $(BUILD_DOCDIR)/pullimap.1 + -$(INSTALL_DATA) -vDt $(DESTDIR)$(man1dir) $(builddir)/doc/interimap.1 $(builddir)/doc/pullimap.1 $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/pullimap $(srcdir)/pullimap.sample $(INSTALL_DATA) -vDt $(DESTDIR)$(datarootdir)/doc/interimap $(srcdir)/interimap.sample \ $(srcdir)/doc/getting-started.md $(srcdir)/doc/multi-account.md $(srcdir)/README @@ -80,5 +82,6 @@ uninstall: clean: rm -vf -- $(MANUAL_FILES) $(HTML_FILES) + -rmdir -vp --ignore-fail-on-non-empty -- $(builddir)/doc .PHONY: all manual html doc test release install uninstall clean |