Start of man-pages-NEXT: Move Changes to Changes.old
[man-pages.git] / lib / build-html.mk
blob412a1f6b0b17d89d756c7d84223399d199970150
1 ########################################################################
2 # Copyright (C) 2021, 2022 Alejandro Colomar <alx.manpages@gmail.com>
3 # SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0
4 ########################################################################
7 ifndef MAKEFILE_BUILD_HTML_INCLUDED
8 MAKEFILE_BUILD_HTML_INCLUDED := 1
11 include $(srcdir)/lib/build.mk
12 include $(srcdir)/lib/cmd.mk
13 include $(srcdir)/lib/src.mk
16 htmlext := .html
17 _HTMLDIR := $(builddir)/html
20 DEFAULT_MAN2HTMLFLAGS :=
21 EXTRA_MAN2HTMLFLAGS :=
22 MAN2HTMLFLAGS := $(DEFAULT_MAN2HTMLFLAGS) $(EXTRA_MAN2HTMLFLAGS)
23 MAN2HTML := man2html
26 _HTMLPAGES := $(patsubst $(MANDIR)/%,$(_HTMLDIR)/%.html,$(MANPAGES))
27 _HTMLDIRS := $(patsubst $(MANDIR)/%,$(_HTMLDIR)/%/.,$(MANDIRS))
30 # Use with
31 # make MAN2HTMLFLAGS=whatever html
32 # The sed removes the lines "Content-type: text/html\n\n"
33 $(_HTMLPAGES): $(_HTMLDIR)/%.html: $(MANDIR)/% | $$(@D)/.
34 $(info MAN2HTML $@)
35 $(MAN2HTML) $(MAN2HTMLFLAGS) $< \
36 | $(SED) -e 1,2d >$@
38 $(_HTMLDIRS): %/.: | $$(dir %). $(_HTMLDIR)/.
41 .PHONY: build-html html
42 build-html html: $(_HTMLPAGES) | builddirs-html
45 .PHONY: builddirs-html
46 builddirs-html: $(_HTMLDIRS)
50 endif # MAKEFILE_BUILD_HTML_INCLUDED