-HTMLFILES = paging.html
-PHONY =
+HTMLFILES = memory.10.html
+PHONY = clean
all: $(HTMLFILES)
clean:
- rm -f $(HTMLFILES)
+ rm -f $(HTMLFILES) *.png
.PHONY: $(PHONY)
-%.html: %.9
- groff -mandoc -Thtml $< > $@
+%.0.html: %.0
+ groff -mandoc -tbl -Thtml $< > $@
+ ./linkify.sh $@
+
+%.9.html: %.9
+ groff -mandoc -tbl -Thtml $< > $@
+ ./linkify.sh $@
+
+%.10.html: %.10
+ groff -mandoc -tbl -Thtml $< > $@
+ ./linkify.sh $@
--- /dev/null
+#!/bin/bash
+
+# collect the name of all pages
+pages=()
+
+while read -r page; do
+ pages+=("$(basename "$page")")
+done < <(find . -name "*.0" -or -name "*.9" -or -name "*.10" -type f)
+
+# Iterate over all pages, inserting links to those pages that actually exist. I used a simple
+# regex for this at first, but this would also insert links for pages that don't exist, which
+# is not what we want since there is stuff like "hoge(0)" and references to not-yet-existing
+# articles.
+
+for ((i=1; i<="$#"; i++)); do
+ manpage="${!i}"
+
+ for page in "${pages[@]}"; do
+ pn=$(echo "$page" | cut -d '.' -f 1)
+ ps=$(echo "$page" | cut -d '.' -f 2)
+
+ sed -i -e "s|<b>$pn</b>($ps)|<a href=\"$pn.$ps.html\"><b>$pn</b>($ps)</a>|g" "$manpage"
+ done
+done
+
+exit 0