Create a separate INSTALL file, and remove install instructions from README.
[privoxy.git] / doc / source / GNUmakefile.in
1 # Note:  Makefile is built automatically from Makefile.in
2 #
3 # $Id: GNUmakefile.in,v 1.5 2002/09/05 23:12:04 hal9 Exp $
4 #
5 # Location: doc/source/Makefile.in 
6 # Purpose: Build documentation
7 #
8 # Written by and Copyright (C) 2002 the Privoxy
9 # team. http://www.privoxy.org/
10 #
11 # This program is free software; you can redistribute it 
12 # and/or modify it under the terms of the GNU General
13 # Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at
15 # your option) any later version.
16 #
17 # This program is distributed in the hope that it will
18 # be useful, but WITHOUT ANY WARRANTY; without even the
19 # implied warranty of MERCHANTABILITY or FITNESS FOR A
20 # PARTICULAR PURPOSE.  See the GNU General Public
21 # License for more details.
22 #
23 # The GNU General Public License should be included with
24 # this file.  If not, you can view it at
25 # http://www.gnu.org/copyleft/gpl.html
26 # or write to the Free Software Foundation, Inc., 59
27 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28 #
29
30 #############################################################################
31 # Set make command correctly
32 #############################################################################
33 @SET_MAKE@
34
35 #############################################################################
36 # Version number (for RPM)
37 #############################################################################
38
39 VERSION_MAJOR = @VERSION_MAJOR@
40 VERSION_MINOR = @VERSION_MINOR@
41 VERSION_POINT = @VERSION_POINT@
42 CODE_STATUS   = @CODE_STATUS@
43 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
44 # Whatever the most recent stable version is.
45 STABLE      =  3.0.0
46
47 #############################################################################
48 # Build tools
49 #############################################################################
50
51 PROGRAM    = privoxy@EXEEXT@
52 ECHO       = echo
53 INSTALL    = @INSTALL@
54 RM         = rm -fr
55 SED           = sed
56 CAT        = cat
57 MV            = mv -f
58 WDUMP      = @WDUMP@ -dump
59 JADECAT    = @JADECAT@
60 JADEBIN    = @JADEBIN@
61 DOC_STATUS = @DOC_STATUS@
62 MAN2HTML   = @MAN2HTML@
63 # Note: Please make sure that -d ldp.dsl\#html stays the last option to
64 #       $(JADEBIN), because for some targets "-notoc" will be appended
65 #       to it (--> "ldp.dsl\#html-notoc"). 
66 DB         = $(JADEBIN) $(JADECAT) $(DOC_STATUS) -ihtml -t sgml  -D.. -d ldp.dsl\#html
67 G2H_CMD    = groff -mandoc -Thtml
68 TARGET_OS  = @host@
69 PERL       = perl
70 DOC_DIR    = .
71 DOC_TMP    = $(DOC_DIR)/tmp
72 ROOT             = ../..
73 UTILS    = $(ROOT)/utils
74 DOK_WEB_USEM=$(ROOT)/webserver/user-manual
75
76 DOC_FILES = AUTHORS LICENSE README ChangeLog \
77                 `find ../text/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS"` \
78                 `find ../webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html"` \
79                 `find ../webserver/ -name "*.css"` \
80                 $(ROOT)/privoxy.1
81
82 #############################################################################
83 # Phony targets
84 #############################################################################
85 .PHONY: all dok webserver dok-webserver clean dok-clean clobber ensure-wdump \
86 ensure-jadebin ensure-dkprefix user dok-user devel dok-devel faq dok-faq \
87 readme dok-readme authors dok-authors index dok-index webserver dok-webserver \
88 man dok-man man2html manuals dok-release dok-pdf dok-shtml announce config-file
89 #############################################################################
90 #
91 # Documentation
92 #
93 # converts *.sgml into html, pdf, text and man pages
94 #
95 #############################################################################
96 #
97 # Build the Manuals, etc            #########################################
98 # This does not build _all_ targets #########################################
99 all: dok-release dok-user dok-devel dok-faq dok-webserver dok-index dok-readme dok-authors dok-man dok-clean
100         @$(ECHO) Documentation created.
101
102 # Shortcuts. Use these targets.
103 clean: dok-clean
104 index: dok-release dok-webserver dok-index dok-clean
105 user: dok-release dok-user dok-clean
106 devel: dok-release dok-devel dok-clean
107 faq: dok-release dok-faq dok-clean
108 manuals: dok-release dok-user dok-devel dok-faq dok-clean
109 readme: dok-release dok-readme dok-clean
110 webserver: dok-release dok-webserver dok-clean
111 man: dok-release dok-man dok-clean
112 authors: dok-release dok-authors dok-clean
113 pdf: dok-release dok-pdf
114
115 # 3 checks to make sure docs will be generated
116 ensure-wdump:
117 ifeq (@WDUMP@,false)
118         @$(ECHO)
119         @$(ECHO) "Cannot build docs; one of w3m, links, or lynx must be installed."
120         @$(ECHO) "You should install the appropriate package and rerun ./configure"
121         @exit 1
122 endif
123
124 ensure-jadebin:
125 ifeq (@JADEBIN@,false)
126         @$(ECHO)
127         @$(ECHO) "Cannot build docs; one of openjade or jade must be installed"
128         @$(ECHO) "You should install the appropriate package and rerun ./configure"
129         @exit 1
130 endif
131
132 ensure-dkprefix:
133 ifeq (@DKPREFIX@,false)
134         @$(ECHO)
135         @$(ECHO) "Cannot build docs; cannot find docbook-dsssl stylesheets"
136         @$(ECHO) "You should install the appropriate package and rerun ./configure"
137         @exit 1
138 endif
139
140 # user manual
141 dok-user: ensure-dkprefix ensure-jadebin ensure-wdump
142         cd $(DOC_TMP) && $(RM) * && $(DB) -iuser-man ../user-manual.sgml && cd .. && \
143         $(RM) ../webserver/user-manual/*.html && cp $(DOC_TMP)/*.html ../webserver/user-manual/
144         $(DB) -iuser-man -V nochunks user-manual.sgml > tmp.html && $(WDUMP) tmp.html > ../text/user-manual.txt
145
146 # developer manual
147 dok-devel: ensure-dkprefix ensure-jadebin ensure-wdump
148         cd $(DOC_TMP) && $(RM) * && $(DB) ../developer-manual.sgml && cd .. && \
149         $(RM) ../webserver/developer-manual/*.html && cp -f $(DOC_TMP)/*.html ../webserver/developer-manual/
150         $(DB) -V nochunks developer-manual.sgml > tmp.html && $(WDUMP) tmp.html > ../text/developer-manual.txt
151
152 # faq
153 dok-faq: ensure-dkprefix ensure-jadebin ensure-wdump
154         cd $(DOC_TMP) && $(RM) * && $(DB) ../faq.sgml && cd .. && \
155         $(RM) ../webserver/faq/*.html && cp $(DOC_TMP)/*.html ../webserver/faq/
156         $(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) tmp.html > ../text/faq.txt 
157
158 # Build README and INSTALL files.
159 dok-readme: dok-release ensure-dkprefix ensure-jadebin ensure-wdump
160         $(DB)-notoc -V nochunks readme.sgml > tmp.html &&\
161         $(WDUMP) tmp.html > $(ROOT)/README ;\
162         $(DB)-notoc -V nochunks install.sgml > tmp.html &&\
163         $(WDUMP) tmp.html > $(ROOT)/INSTALL ;\
164         $(RM) tmp.*
165
166 # index.sgml is used to create both the Home Page, and a local index
167 # for documentation (privoxy-index.html), etc.
168 #
169 # index.html for webserver:
170 dok-webserver: ensure-dkprefix ensure-jadebin ensure-wdump
171         cd webserver && $(DB)-notoc -ip-homepage -V nochunks index.sgml > index.html ;\
172         $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
173      s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps consumers reduce unwanted junk email and protect their privacy from direct marketing companies.\"><\/HEAD/;\
174         s/<\/HEAD/\n<meta name="MSSmartTagsPreventParsing" content="TRUE"><\/HEAD/;\
175         s/\.\d\. //' index.html ;\
176         $(MV) index.html ../../webserver ;\
177         $(RM) *.html *.bak
178
179 # privoxy-index.html for bundling with locally installed documentation:
180 dok-index: ensure-dkprefix ensure-jadebin ensure-wdump
181         cd webserver && $(DB)-notoc -ip-index -V nochunks index.sgml > privoxy-index.html ;\
182         $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
183      s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps consumers reduce unwanted junk email and protect their privacy from direct marketing companies.\"><\/HEAD/;\
184         s/<\/HEAD/\n<meta name="MSSmartTagsPreventParsing" content="TRUE"><\/HEAD/;\
185         s/\.\d\. //' privoxy-index.html ;\
186         $(MV) privoxy-index.html ../../webserver ;\
187         $(RM) *.html *.bak
188
189 ## Make AUTHORS file
190 dok-authors: ensure-dkprefix ensure-jadebin ensure-wdump
191         $(DB) -V nochunks authors.sgml > tmp.html && $(WDUMP) \
192           tmp.html > ../../AUTHORS
193
194 # Make a man page, and then HTML version. Uses docbook2man (short perl script)
195 # in utils dir. 
196 dok-man: ensure-dkprefix ensure-jadebin dok-release
197         cd $(DOC_TMP) && $(RM) * &&\
198         nsgmls $(DOC_STATUS) ../privoxy-man-page.sgml  | sgmlspl ../../../utils/docbook2man/docbook2man-spec.pl &&\
199         perl -pi.bak -e 's/ <URL:.*>//; s/\[ /\[/g' privoxy.1
200 #       cd $(DOC_TMP) && $(DB) ../privoxy-man-page.sgml &&\
201 #       $(MV) -f index.html privoxy-man-page.html
202      # This html is not used. See make man2html.
203         $(MV) -f $(DOC_TMP)/privoxy.1 $(ROOT)/privoxy.1
204         $(MAKE) man2html
205         $(MAKE) clean
206
207 # For those with man2html ala RH7s.
208 man2html: ensure-dkprefix ensure-jadebin ensure-wdump
209         mkdir -p ../webserver/man-page
210 ifneq ($(MAN2HTML),false)
211         $(MAN2HTML) $(ROOT)/privoxy.1 |grep -v "^Content-type" > tmp.html
212         $(PERL) -pi.bak -e 's/<A .*Contents<\/A>//; s/<A .*man2html<\/A>/man2html/' tmp.html
213         $(PERL) -pi.bak -e 's/(<\/HEAD>)/<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"..\/p_doc.css\"><\/HEAD>/' tmp.html
214 # Twice because my version of man2html is pulling in commas and periods in URLs.
215         $(PERL) -pi.bak -e 's/(<A.*),(">)/$$1$$2/g' tmp.html
216         $(PERL) -pi.bak -e 's,\.">,">,g' tmp.html
217 # Get rid of spurious \a from conversion. (How to do this with perl?)
218         $(SED) -e 's/\a//g' tmp.html > ../webserver/man-page/privoxy-man-page.html && $(RM) tmp.*
219 else
220         $(MAKE) groff2html
221 endif
222
223 # Otherwise we get plain groff conversion.
224 groff2html:
225         $(G2H_CMD) $(ROOT)/privoxy.1 | $(SED) -e 's@</head>@<link REL="STYLESHEET" TYPE="text/css" HREF="../p_doc.css"></head>@' >\
226         ../webserver/man-page/privoxy-man-page.html
227
228 # Write VERSION and CODE_STATUS to tmp files so they can be read into the doc
229 # processing. This needs to go before any doc building (doh).
230 dok-release:
231         @$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
232         $(MAKE) dok-clean
233         mkdir -p $(DOC_TMP)
234         $(ECHO) -n $(VERSION) > $(DOC_DIR)/doc_version.tmp
235         $(ECHO) -n $(CODE_STATUS) > $(DOC_DIR)/doc_status.tmp
236         $(ECHO) -n $(STABLE) > $(DOC_DIR)/doc_stable.tmp
237
238 # Make pdf docs from single page html. Requires htmldoc, see
239 # (http://www.easysw.com/htmldoc/). Note: 1.8.20 has a TOC bug.
240 # PDF docs are uploaded to webserver as zip archive.
241 dok-pdf: dok-shtml
242         @$(ECHO) -n "starting htmldoc version: "; htmldoc --version
243         cd $(UTILS)/ldp_print && $(RM) *html *bak *jpg *tmp *pdf *zip
244         cp -f $(DOC_TMP)/*html ../webserver/images/*jpg  $(UTILS)/ldp_print
245         cd $(UTILS)/ldp_print ;\
246         $(PERL) -pi.bak -e 's/\.\.\/images\///; s/(<\/?)SUB/$$1small/i;\
247                             s/\.\.\/user-manual\/index\.html/privoxy-user-manual.pdf/;\
248                                         s/\.\.\/developer-manual\/index\.html/privoxy-developer-manual.pdf/;\
249                                         s/\.\.\/faq\/index\.html/privoxy-faq.pdf/' *.html ;\
250         for i in developer-manual user-manual faq; do \
251                 ./ldp_print privoxy-$$i.html ;\
252                 $(ECHO) DONE: privoxy-$$i.pdf ;\
253         done ;\
254         $(MV) *.pdf  ../../doc/pdf ;\
255         $(RM) *html *bak *jpg *pdf *zip 
256         $(RM)  $(DOC_TMP)
257
258
259 # Generate single page html. Used only for creating pdf docs (ATM).
260 dok-shtml: dok-release ensure-dkprefix ensure-jadebin ensure-wdump
261         $(DB) -iuser-man -V nochunks user-manual.sgml > $(DOC_TMP)/privoxy-user-manual.html
262         $(DB) -V nochunks developer-manual.sgml > $(DOC_TMP)/privoxy-developer-manual.html
263         $(DB) -V nochunks faq.sgml > $(DOC_TMP)/privoxy-faq.html
264
265 # Create release announcement in text and html, with short and long versions.
266 # This is a standalone target, and must be invoked directly.
267 announce: dok-release ensure-wdump
268         cd $(DOC_TMP) && $(DB) -iannounce-big ../announce.sgml &&\
269         mv -f index.html announce.html && $(WDUMP) announce.html > announce.txt
270         cd $(DOC_TMP) && $(DB) ../announce.sgml &&\
271         mv -f index.html announce-mini.html && $(WDUMP) announce-mini.html > announce-mini.txt &&\
272         mv -f *html *txt $(ROOT) 
273         $(MAKE) dok-clean
274         @$(ECHO) Announce texts are done. Please check them. Some hand editing
275         @$(ECHO) may be required.
276
277 # The main Privoxy config file, generated from sgml sources. 
278 # NOTE: This will require some hand editing. The new file is outputted 
279 # as config.new so that problem sections can be compared to previous
280 # version. This is hardcored to w3m for html/text conversion. Also, 
281 # requires the shell util 'fmt'.
282 config-file: ensure-dkprefix ensure-jadebin ensure-wdump dok-release
283         $(DB)-notoc -iconfig-file -V nochunks config.sgml > tmp.html &&\
284         w3m -dump tmp.html |fmt -w 70 > $(ROOT)/config.new && $(RM) tmp.*
285         $(PERL) -pi.bak -e 's/^1\. \@\@TITLE\@\@/     /i;\
286                      /^\d\.\d\.\s+/ && tr/[a-z]/[A-Z]/;\
287                      $$header_len=0 unless $$hit_header;\
288                      if ($$hit_header) {\
289                         print "#  ";\
290                         for ($$i=1; $$i < $$header_len; $$i++) {print "=";}\
291                         print "\n";\
292                      };\
293                      $$hit_header=0;\
294                      $$hit_header=1 if m/^(\d\.)(\d\.)(\d\.)?\s/ && s/^(\d\.)//;\
295                      $$header_len = length($$_);\
296                                  s/^/#  /;  /^#  #{12,}/ && s/^#  #/####/;\
297                      s/^.*$$// if $$hit_option;\
298                      $$hit_option=0;\
299                      s/^\n//;  s/^#\s*-{20,}//;\
300                      $$hit_option=1 if s/^#\s+@@//;'   $(ROOT)/config.new
301         $(RM) $(ROOT)/*.bak *.tmp tmp.* $(DOC_TMP)
302         @$(ECHO)  "****************************************************"
303         @$(ECHO)  "The output file is config.new."
304         @$(ECHO)  "Now -- you need to hand edit the results!!!"
305         @$(ECHO)  "In particular, check the Debug levels, and the"
306         @$(ECHO)  "permit-access, forward & socks examples. They"
307         @$(ECHO)  "probably got hammered."
308         @$(ECHO)  "****************************************************"
309
310 # config file, alternate verison using lynx (perl stuff unfinished). Lynx
311 # does not do so good a job.
312 config-file-alt: dok-release ensure-wdump
313         $(ECHO) -e ".h2 JUSTIFY\\nJUSTIFY:FALSE" > tmp.lynx_cfg &&\
314         $(DB)-notoc -iconfig-file -V nochunks config.sgml > tmp.html &&\
315         lynx -cfg=tmp.lynx_cfg -width=78 -dump tmp.html > ../../config.new && $(RM) tmp.*
316         $(PERL) -pi -e 's/^(   )//;\
317                         s/:$\/:\n/' $(ROOT)/config.new
318
319 # This is mostly to catch cruft from build failures
320 dok-clean:
321         $(RM) $(DOC_TMP) *.html `find $(ROOT) -name "tmp.*" -o -name "*.tmp" -o -name "*.bak" -o -name "*.fot"`
322
323 tidy:
324         $(RM) `find . -name "*~"` `find . -name ".\#*"`
325
326 clobber: tidy clean
327         $(RM) GNUmakefile ldp.dsl
328
329 distclean: clobber
330
331 coffee:
332          @perl -e 'print pack "C*", (31,139,8,8,153,63,226,60,2,3,99,111,102,102,101,101,0,109,143,205,13,192,32,8,133,\
333                   239,78,241,110,234,1,28,160,171,152,208,53,26,117,247,22,165,73,137,125,9,1,62,126,2,128,169,5,243,143,\
334                   13,139,49,164,65,100,149,152,102,73,141,88,73,178,116,205,100,69,253,36,102,81,49,83,236,19,225,171,131,\
335                   214,172,163,73,4,168,123,115,71,126,247,122,94,128,178,227,95,154,12,86,215,122,197,249,146,187,54,220,125,\
336                   193,51,228,11,1,0,0);'|zcat
337
338 #############################################################################
339
340 # $Log: GNUmakefile.in,v $
341 # Revision 1.5  2002/09/05 23:12:04  hal9
342 # Updated Makefile with 3.0 changes (pdf and man targets, etc). Revise comments
343 # in privoxy-man-page.sgml to remove out of date comments.
344 #
345 # Revision 1.4  2002/08/08 01:02:26  hal9
346 # Update pdf2 target to dok-shtml (for single page html)
347 #
348 # Revision 1.3  2002/06/07 00:27:04  hal9
349 # Fixing man2html quirk that pulls in punctuation, and breaks URLs.
350 #
351 # Revision 1.2  2002/06/05 04:17:19  hal9
352 # Add dok-man-test target as temp workaround for docbook2man ignoring -i command
353 # line option.
354 #
355 # Revision 1.1  2002/06/05 00:28:28  hal9
356 # Moving all doc building to doc/source. Rewrite all targets (not well tested).
357 # Docs are now built without touching sgml source.
358 #