From cd6e9eb024d20594450fded6b4c4467944fb5e9c Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 27 Jul 2021 13:46:07 +0200 Subject: [PATCH 1/2] Fix the generation of nix3 manpages - Separate the generation of the manpages from their installation - Make sure that `make` generates the manpages - Make sure that `make install` installs them Fix #5051 --- doc/manual/local.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/manual/local.mk b/doc/manual/local.mk index 435301279..e2c732476 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk @@ -77,21 +77,29 @@ $(d)/builtins.json: $(bindir)/nix install: $(docdir)/manual/index.html # Generate 'nix' manpages. -install: $(mandir)/man1/nix3-build.1 +install: $(mandir)/man1/nix3-manpages +man: doc/manual/generated/man1/nix3-manpages +all: doc/manual/generated/man1/nix3-manpages + +$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-build.1 + @mkdir -p $$(dirname $@) + $(trace-install) install -m 0644 $$(dirname $<)/* $$(dirname $@) # Technically this rule generates all the `nix3-*` manpages, but since we don’t # know their list statically and they are all generated at once anyways, we can # just be dirty and only track one -$(mandir)/man1/nix3-build.1: $(d)/src/command-ref/new-cli +doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli + @mkdir -p $$(dirname $@) $(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \ name=$$(basename $$i .md); \ tmpFile=$$(mktemp); \ if [[ $$name = SUMMARY ]]; then continue; fi; \ printf "Title: %s\n\n" "$$name" > $$tmpFile; \ cat $$i >> $$tmpFile; \ - lowdown -sT man -M section=1 $$tmpFile -o $(mandir)/man1/$$name.1; \ + lowdown -sT man -M section=1 $$tmpFile -o $$(dirname $@)/$$name.1; \ rm $$tmpFile; \ done + touch $@ $(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(docdir)/manual From 441be5d59aa1d3c223979e257ed9bae5d7e3b093 Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 27 Jul 2021 13:48:19 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Remove=20dead=20code=20in=20doc=E2=80=99s?= =?UTF-8?q?=20local.mk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- doc/manual/local.mk | 9 +-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index ef0298417..1affd733d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,9 +12,10 @@ perl/Makefile.config /libtool # /doc/manual/ -/doc/manual/**/*.1 +/doc/manual/*.1 /doc/manual/*.5 /doc/manual/*.8 +/doc/manual/generated/* /doc/manual/nix.json /doc/manual/conf-file.json /doc/manual/builtins.json diff --git a/doc/manual/local.mk b/doc/manual/local.mk index e2c732476..dd1d5f0fa 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk @@ -1,9 +1,5 @@ ifeq ($(doc_generate),yes) -ALL_MD_FILES := $(call rwildcard, $(d)/src, *.md) -GENERATED_MD_FILES := $(call rwildcard, $(d)/src/command-ref/new-cli, *.md) -MANUAL_SRCS := $(filter-out $(GENERATED_MD_FILES), $(ALL_MD_FILES)) - # Generate man pages. man-pages := $(foreach n, \ nix-env.1 nix-build.1 nix-shell.1 nix-store.1 nix-instantiate.1 \ @@ -81,13 +77,10 @@ install: $(mandir)/man1/nix3-manpages man: doc/manual/generated/man1/nix3-manpages all: doc/manual/generated/man1/nix3-manpages -$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-build.1 +$(mandir)/man1/nix3-manpages: doc/manual/generated/man1/nix3-manpages @mkdir -p $$(dirname $@) $(trace-install) install -m 0644 $$(dirname $<)/* $$(dirname $@) -# Technically this rule generates all the `nix3-*` manpages, but since we don’t -# know their list statically and they are all generated at once anyways, we can -# just be dirty and only track one doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli @mkdir -p $$(dirname $@) $(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \