Makefile: propagate up the docs prerequisites

This commit is contained in:
Michele Guerini Rocco 2024-11-09 12:27:05 +01:00
parent fd175ad0da
commit 68358ac506
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
3 changed files with 14 additions and 9 deletions

View File

@ -130,18 +130,16 @@ endif
## Targets ## Targets
## ##
.PHONY: all clean check install-bin install-doc install docs .PHONY: all
# Don't update archives in parallel, it's unsupported
.NOTPARALLEL: $(LIBDIR)/libgray.a
all: $(BINARIES) $(LIBRARIES) all: $(BINARIES) $(LIBRARIES)
# Remove all generated files # Remove all generated files
.PHONY: clean
clean: clean:
rm -r $(BUILDDIR) rm -r $(BUILDDIR)
# Run all tests # Run all tests
.PHONY: check
check: $(shell python -Bm tests --list-cases) check: $(shell python -Bm tests --list-cases)
# Run a test case # Run a test case
@ -149,11 +147,13 @@ tests.%: $(GRAY)
python -Bm tests '$@' --binary '$(GRAY)' --buffer python -Bm tests '$@' --binary '$(GRAY)' --buffer
# Install libraries, binaries and documentation # Install libraries, binaries and documentation
.PHONY: install-bin
install-bin: $(BINARIES) $(LIBRARIES) install-bin: $(BINARIES) $(LIBRARIES)
mkdir -p $(PREFIX)/{bin,lib} mkdir -p $(PREFIX)/{bin,lib}
install -m555 -t $(PREFIX)/bin $(BINDIR)/* install -m555 -t $(PREFIX)/bin $(BINDIR)/*
install -m555 -t $(PREFIX)/lib $(LIBDIR)/* install -m555 -t $(PREFIX)/lib $(LIBDIR)/*
.PHONY: install-doc
install-doc: $(SHAREDIR)/doc $(MANPAGES) install-doc: $(SHAREDIR)/doc $(MANPAGES)
mkdir -p $(PREFIX)/share/{doc/res,man/man{1,5}} mkdir -p $(PREFIX)/share/{doc/res,man/man{1,5}}
install -m644 -t $(PREFIX)/share/doc $(SHAREDIR)/doc/manual.* install -m644 -t $(PREFIX)/share/doc $(SHAREDIR)/doc/manual.*
@ -161,6 +161,7 @@ install-doc: $(SHAREDIR)/doc $(MANPAGES)
install -m644 -t $(PREFIX)/share/man/man1 $(SHAREDIR)/*.1 install -m644 -t $(PREFIX)/share/man/man1 $(SHAREDIR)/*.1
install -m644 -t $(PREFIX)/share/man/man5 $(SHAREDIR)/*.5 install -m644 -t $(PREFIX)/share/man/man5 $(SHAREDIR)/*.5
.PHONY: install
install: install-bin install-doc install: install-bin install-doc
# dependencies # dependencies
@ -182,6 +183,9 @@ $(LIBDIR)/libgray.so: $(MODULES) | $(LIBDIR)
$(LIBDIR)/libgray.a($(MODULES)): | $(LIBDIR) $(LIBDIR)/libgray.a($(MODULES)): | $(LIBDIR)
$(LIBDIR)/libgray.a: $(LIBDIR)/libgray.a($(MODULES)) $(LIBDIR)/libgray.a: $(LIBDIR)/libgray.a($(MODULES))
# Don't update archives in parallel, it's unsupported
.NOTPARALLEL: $(LIBDIR)/libgray.a
# GRAY static library when compiling from JETTO # GRAY static library when compiling from JETTO
-include ../include.mk -include ../include.mk
$(JLIBDIR)/libgray.a: $(LIBDIR)/libgray.a $(JLIBDIR)/libgray.a: $(LIBDIR)/libgray.a
@ -189,11 +193,12 @@ $(JLIBDIR)/libgray.a: $(LIBDIR)/libgray.a
install -m755 '$<' '$@' install -m755 '$<' '$@'
# All documentation # All documentation
.PHONY: doc
docs: $(SHAREDIR)/doc $(MANPAGES) docs: $(SHAREDIR)/doc $(MANPAGES)
.PHONY: $(SHAREDIR)/doc
$(SHAREDIR)/doc: | $(SHAREDIR) $(SHAREDIR)/doc: | $(SHAREDIR)
+make -C doc +make -C doc
cp -r doc/build/* $(SHAREDIR)
# Generated man pages # Generated man pages
$(SHAREDIR)/gray.1: $(GRAY) doc/man/gray.1 | $(SHAREDIR) $(SHAREDIR)/gray.1: $(GRAY) doc/man/gray.1 | $(SHAREDIR)

View File

@ -56,7 +56,7 @@ in
# fonts needed for the PDF manual # fonts needed for the PDF manual
FONTCONFIG_FILE = pkgs.makeFontsConf { FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = with pkgs; [ fira-mono libertinus ]; fontDirectories = with pkgs; [ libertinus julia-mono ];
}; };
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -14,7 +14,7 @@ HTML_FLAGS = --standalone --katex$(KATEX_URL) --lua-filter filters/add-anchors.l
.EXTRA_PREREQS += Makefile .EXTRA_PREREQS += Makefile
# User manual # User manual
DOCDIR = build/doc DOCDIR = ../build/share/doc
SECTIONS = $(wildcard [0-9].*.md) SECTIONS = $(wildcard [0-9].*.md)
MANUALS = $(addprefix $(DOCDIR)/,manual.html manual.pdf res) MANUALS = $(addprefix $(DOCDIR)/,manual.html manual.pdf res)
@ -33,7 +33,7 @@ $(DOCDIR)/manual.html: $(SECTIONS) res | $(DOCDIR)
pandoc $(FLAGS) $(HTML_FLAGS) $(filter %.md, $^) -o '$@' pandoc $(FLAGS) $(HTML_FLAGS) $(filter %.md, $^) -o '$@'
$(DOCDIR)/res: res | $(DOCDIR) $(DOCDIR)/res: res | $(DOCDIR)
cp -r $^ '$@' cp -Tfr $^ '$@'
$(DOCDIR)/manual.pdf: $(SECTIONS) | $(DOCDIR) $(DOCDIR)/manual.pdf: $(SECTIONS) | $(DOCDIR)
pandoc $(FLAGS) $(PDF_FLAGS) $^ -o '$@' pandoc $(FLAGS) $(PDF_FLAGS) $^ -o '$@'