Commit c197054d c197054dc521cb1dab7faf27ab3e48acbeba9a93 by Sergey Poznyakoff

Added rules for generating website documentation.

1 parent 14811c9e
...@@ -46,5 +46,126 @@ SUFFIXES=.c .inc ...@@ -46,5 +46,126 @@ SUFFIXES=.c .inc
46 .c.inc: 46 .c.inc:
47 sed '1{s/\/\*/@comment /;b};2,/.*\*\//{s/\*\///;s/^/@comment/;b};s/\([{}]\)/@\1/g' $< > $@ 47 sed '1{s/\/\*/@comment /;b};2,/.*\*\//{s/\*\///;s/^/@comment/;b};s/\([{}]\)/@\1/g' $< > $@
48 48
49 DISTCLEANFILES=*.pgs 49 DISTCLEANFILES=*.pgs
50 MAINTAINERCLEANFILES=$(INCFILES) 50 MAINTAINERCLEANFILES=$(INCFILES)
51
52 ## Web documentation
53 BASE_URL="http://www.gnu.org/software/mailutils/manual"
54 TEXI2HTML=${SHELL} `cd $(top_srcdir); pwd`/missing --run texi2html
55 DVIPS=${SHELL} `cd $(top_srcdir); pwd`/missing --run dvips
56 INFO=${SHELL} `cd $(top_srcdir); pwd`/missing --run info
57 EXTRA_DIST = index.html.in
58
59 html: html_mono html_node html_chapter
60
61 html_node:
62 texi2html="$(TEXI2HTML)";\
63 if ! test -d html_node; then mkdir html_node; fi; \
64 cd html_node; \
65 $$texi2html -menu -split_node ../mailutils.texi
66
67 html_chapter:
68 texi2html="$(TEXI2HTML)";\
69 if ! test -d html_chapter; then mkdir html_chapter; fi; \
70 cd html_chapter; \
71 $$texi2html -menu -split_chapter ../mailutils.texi
72
73 html_mono:
74 texi2html="$(TEXI2HTML)";\
75 if ! test -d html_mono; then mkdir html_mono; fi; \
76 cd html_mono; \
77 $$texi2html -menu -monolithic ../mailutils.texi
78
79 ps: mailutils.ps
80
81 mailutils.ps: mailutils.dvi
82 $(DVIPS) -omailutils.ps mailutils.dvi
83
84 text: mailutils.text
85
86 mailutils.text: mailutils.info
87 $(INFO) --node=Top --subnodes --out mailutils.text -f mailutils.info
88
89 mailutils.info.tar.gz:
90 tar cfz mailutils.info.tar.gz mailutils.info*
91
92 mailutils.dvi.gz: mailutils.dvi
93 gzip -c mailutils.dvi > mailutils.dvi.gz
94
95 mailutils.ps.gz: mailutils.ps
96 gzip -c mailutils.ps > mailutils.ps.gz
97
98 mailutils.texi.tar.gz:
99 tar cfz mailutils.texi.tar.gz *.texi
100
101 WEB_HTML=\
102 html_mono\
103 html_node\
104 html_chapter
105
106 WEB_BIN=\
107 mailutils.info.tar.gz\
108 mailutils.dvi.gz\
109 mailutils.ps.gz\
110 mailutils.texi.tar.gz\
111 mailutils.text
112
113 CLEANFILES = $(WEB_BIN)
114 clean-local:
115 rm -rf $(WEB_HTML)
116
117 WEBDOC=$(WEB_HTML) $(WEB_BIN)
118
119 webdocdir: $(WEBDOC) index.html
120 if ! test -d $(WEBDOCDIR); then mkdir $(WEBDOCDIR); fi; \
121 here=`cd $(srcdir) && pwd`; \
122 webdocdir=`cd $(WEBDOCDIR) && pwd`; \
123 for file in $(WEB_HTML) index.html; do \
124 if test -d $$here/$$file; then \
125 cp -pr $$here/$$file $$webdocdir/$$file; \
126 else \
127 test -f $$webdocdir/$$file \
128 || ln $$here/$$file $$webdocdir/$$file 2> /dev/null \
129 || cp -p $$here/$$file $$webdocdir/$$file || :; \
130 fi; \
131 done; \
132 if ! test -d $(WEBDOCDIR)/other; then mkdir $(WEBDOCDIR)/other; fi;\
133 for file in $(WEB_BIN); do \
134 if test -d $$here/$$file; then \
135 cp -pr $$here/$$file $$webdocdir/other/$$file; \
136 else \
137 test -f $$webdocdir/other/$$file \
138 || ln $$here/$$file $$webdocdir/other/$$file 2> /dev/null \
139 || cp -p $$here/$$file $$webdocdir/other/$$file || :; \
140 fi; \
141 done
142
143 index.html: index.html.in $(WEBDOC)
144 @echo "s^%BASE_URL%^$(BASE_URL)^;" > .webdoc
145 @echo "s/%DATE%/`date`/;" >> .webdoc
146 @echo "s/%UPDATED%/`date +'%B, %d'`/;" >> .webdoc
147 @echo "s/%PACKAGE_NAME%/$(PACKAGE_NAME)/" >> .webdoc
148 @echo "s/%PACKAGE%/$(PACKAGE)/" >> .webdoc
149 @echo "s/%VERSION%/$(VERSION)/" >> .webdoc
150 @for file in `sed -n 's,.*"other/%PACKAGE%\(.*\)".*,$(PACKAGE)\1,pg;s,.*"\(.*\)%PACKAGE%\(.*\)".*,\1$(PACKAGE)\2,pg' index.html.in`; \
151 do\
152 ls -sk $$file; \
153 done |\
154 $(AWK) -vPACKAGE=$(PACKAGE) \
155 'BEGIN { len = length(PACKAGE) } \
156 { gsub("\\.", "_", $$2); \
157 if (match($$2,"/")) \
158 $$2=substr($$2,RSTART+1); \
159 print "s/%" toupper(substr($$2,len+2)) "_SIZE%/" $$1 "/;" }' >> .webdoc
160 sed -f .webdoc index.html.in > index.html
161 rm -f .webdoc
162
163 webdocname=$(PACKAGE)-$(VERSION)-doc
164 WEBDOCDIR=$(webdocname)
165
166 webdoc: $(WEBDOC) index.html
167 $(MAKE) WEBDOCDIR=$(top_builddir)/doc/texinfo/$(webdocname) webdocdir
168 cd $(top_builddir)/doc/texinfo &&\
169 tar cfz $(webdocname).tar.gz $(webdocname) &&\
170 rm -r $(webdocname)
171 ## End of webdoc
......