Lorenzo Colitti | 313379e | 2013-07-11 01:07:11 +0900 | [diff] [blame] | 1 | SGMLFILES=$(shell echo *.sgml) |
| 2 | HTMLFILES=$(subst .sgml,.html,$(SGMLFILES)) index.html |
| 3 | MANFILES=$(subst .sgml,.8,$(SGMLFILES)) |
| 4 | |
| 5 | all: html |
| 6 | |
| 7 | html: $(HTMLFILES) iputils.html |
| 8 | |
| 9 | man: $(MANFILES) |
| 10 | |
| 11 | # docbook scripts are incredibly dirty in the sense that they leak |
| 12 | # lots of some strange temporary junk directories and files. |
| 13 | # So, scope it to a temporary dir and clean all after each run. |
| 14 | |
| 15 | $(HTMLFILES): index.db |
| 16 | @-rm -rf tmp.db2html |
| 17 | @mkdir tmp.db2html |
| 18 | @set -e; cd tmp.db2html; docbook2html ../$< ; mv *.html .. |
| 19 | @-rm -rf tmp.db2html |
| 20 | |
| 21 | iputils.html: iputils.db |
| 22 | @-rm -rf tmp.db2html |
| 23 | @mkdir tmp.db2html |
| 24 | @set -e; cd tmp.db2html; docbook2html -u -o html ../$< ; mv html/$@ .. |
| 25 | @-rm -rf tmp.db2html |
| 26 | |
| 27 | # docbook2man produces utterly ugly output and I did not find |
| 28 | # any way to customize this but hacking backend perl script a little. |
| 29 | # Well, hence... |
| 30 | |
| 31 | $(MANFILES): index.db |
| 32 | @-mkdir tmp.db2man |
| 33 | @set -e; cd tmp.db2man; nsgmls ../$< | sgmlspl ../docbook2man-spec.pl ; mv $@ .. |
| 34 | @-rm -rf tmp.db2man |
| 35 | |
| 36 | clean: |
| 37 | @rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html tmp.db2man |
| 38 | |
| 39 | snapshot: |
| 40 | @date "+%y%m%d" > snapshot.db |
| 41 | |
| 42 | |
| 43 | $(MANFILES): $(SGMLFILES) |
| 44 | |
| 45 | $(HTMLFILES): $(SGMLFILES) |
| 46 | |
| 47 | |