summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-03-30 17:47:40 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2021-03-30 17:47:40 +0200
commit9d53d4b9550d1107d785680c7175ed618ca378c2 (patch)
treed70fe1fc95f6abee9f5e2c73f4301b1eb66a5d15
parent689be120a6d9fb403fd8fe056a8d66aa89b30080 (diff)
Makefile: Add rules to build html pages
Some projects don have them (such as man-pages-posix). Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--Makefile36
1 files changed, 33 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d9f40d4..3170a88 100644
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,11 @@
DESTDIR =
prefix = /usr/local
sysconfdir = $(prefix:/usr=)/etc
+MANDIR_ = $(CURDIR)/src/man-pages/
+htmlbuilddir = $(CURDIR)/tmp/html
srvdir = /srv
wwwdir = $(srvdir)/www
+htmlext = .html
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
@@ -81,13 +84,40 @@ digest:
submodules:
git submodule init && git submodule update;
+.PHONY: html
+html: | builddirs-html
+ cd $(MANDIR_)/ && \
+ find man?/ -type f \
+ |while read f; do \
+ man2html -r "$$f" \
+ |sed -e '1,2d' \
+ >"$(htmlbuilddir)/$${f}$(htmlext)" \
+ || exit $$?; \
+ done;
+
+.PHONY: builddirs-html
+builddirs-html:
+ cd $(MANDIR_)/ && \
+ find man?/ -type d \
+ |while read d; do \
+ $(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
+ done;
+
.PHONY: man
-man:
- $(MAKE) -C src/man-pages/ html HTOPTS='-r';
+man: man-pages man-pages-posix
+
+
+.PHONY: man-pages
+man-pages:
+ $(MAKE) html MANDIR_='$(CURDIR)/src/$@';
+
+.PHONY: man-pages-posix
+man-pages-posix:
+ $(MAKE) html MANDIR_='$(CURDIR)/src/$@';
.PHONY: clean-man
clean-man:
- $(MAKE) -C src/man-pages/ clean;
+ rm -rf "$(htmlbuilddir)/";
.PHONY: clean
clean: clean-man