forked from lix-project/lix
Cleanup the generation of the nix3 manpages
Use a dedicated make target for the man page rather than bundling the generation as part of `install`. Also make sure that `make install` is a fixpoint by - Removing the generated markdown files from `MANUAL_SRCS` - Not having the manpage generation write in its source directory so as to not update its timestamp (it would run each time otherwise)
This commit is contained in:
parent
db4d4cf4ba
commit
c5f5d615a6
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,7 +12,7 @@ perl/Makefile.config
|
||||||
/libtool
|
/libtool
|
||||||
|
|
||||||
# /doc/manual/
|
# /doc/manual/
|
||||||
/doc/manual/*.1
|
/doc/manual/**/*.1
|
||||||
/doc/manual/*.5
|
/doc/manual/*.5
|
||||||
/doc/manual/*.8
|
/doc/manual/*.8
|
||||||
/doc/manual/nix.json
|
/doc/manual/nix.json
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
ifeq ($(doc_generate),yes)
|
ifeq ($(doc_generate),yes)
|
||||||
|
|
||||||
MANUAL_SRCS := $(call rwildcard, $(d)/src, *.md)
|
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.
|
# Generate man pages.
|
||||||
man-pages := $(foreach n, \
|
man-pages := $(foreach n, \
|
||||||
|
@ -75,13 +77,20 @@ $(d)/builtins.json: $(bindir)/nix
|
||||||
install: $(docdir)/manual/index.html
|
install: $(docdir)/manual/index.html
|
||||||
|
|
||||||
# Generate 'nix' manpages.
|
# Generate 'nix' manpages.
|
||||||
install: $(d)/src/command-ref/new-cli
|
install: $(mandir)/man1/nix3-build.1
|
||||||
|
|
||||||
|
# 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
|
||||||
$(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \
|
$(trace-gen) for i in doc/manual/src/command-ref/new-cli/*.md; do \
|
||||||
name=$$(basename $$i .md); \
|
name=$$(basename $$i .md); \
|
||||||
|
tmpFile=$$(mktemp); \
|
||||||
if [[ $$name = SUMMARY ]]; then continue; fi; \
|
if [[ $$name = SUMMARY ]]; then continue; fi; \
|
||||||
printf "Title: %s\n\n" "$$name" > $$i.tmp; \
|
printf "Title: %s\n\n" "$$name" > $$tmpFile; \
|
||||||
cat $$i >> $$i.tmp; \
|
cat $$i >> $$tmpFile; \
|
||||||
lowdown -sT man -M section=1 $$i.tmp -o $(mandir)/man1/$$name.1; \
|
lowdown -sT man -M section=1 $$tmpFile -o $(mandir)/man1/$$name.1; \
|
||||||
|
rm $$tmpFile; \
|
||||||
done
|
done
|
||||||
|
|
||||||
$(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
|
$(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
|
||||||
|
|
Loading…
Reference in a new issue