# Note: Makefile is built automatically from Makefile.in
#
# $Id: GNUmakefile.in,v 1.7 2002/09/16 06:04:34 hal9 Exp $
#
# Location: doc/source/Makefile.in
# Purpose: Build documentation
#
# Written by and Copyright (C) 2002 the Privoxy
# team. http://www.privoxy.org/
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# The GNU General Public License should be included with
# this file. If not, you can view it at
# http://www.gnu.org/copyleft/gpl.html
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#############################################################################
# Set make command correctly
#############################################################################
@SET_MAKE@
#############################################################################
# Version number (for RPM)
#############################################################################
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_POINT = @VERSION_POINT@
CODE_STATUS = @CODE_STATUS@
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
# Whatever the most recent stable version is.
STABLE = 3.0.0
#############################################################################
# Build tools
#############################################################################
PROGRAM = privoxy@EXEEXT@
ECHO = echo
INSTALL = @INSTALL@
RM = rm -fr
SED = sed
CAT = cat
MV = mv -f
WDUMP = @WDUMP@ -dump
JADECAT = @JADECAT@
JADEBIN = @JADEBIN@
DOC_STATUS = @DOC_STATUS@
MAN2HTML = @MAN2HTML@
DKPREFIX = @DKPREFIX@
# Note: Please make sure that -d ldp.dsl\#html stays the last option to
# $(JADEBIN), because for some targets "-notoc" will be appended
# to it (--> "ldp.dsl\#html-notoc").
DB = $(JADEBIN) $(JADECAT) $(DOC_STATUS) -ihtml -t sgml -D.. -d ldp.dsl\#html
G2H_CMD = groff -mandoc -Thtml
TARGET_OS = @host@
PERL = perl
DOC_DIR = .
DOC_TMP = $(DOC_DIR)/tmp
ROOT = ../..
UTILS = $(ROOT)/utils
DOK_WEB_USEM=$(ROOT)/webserver/user-manual
DOC_FILES = $(ROOT)/AUTHORS $(ROOT)/LICENSE $(ROOT)/README $(ROOT)/INSTALL $(ROOT)/ChangeLog \
`find ../text/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS"` \
`find ../webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html"` \
`find ../webserver/ -name "*.css"` \
$(ROOT)/privoxy.1
#############################################################################
# Phony targets
#############################################################################
.PHONY: all dok webserver doc-webserver clean doc-clean clobber ensure-wdump \
ensure-jadebin ensure-dkprefix user doc-user devel doc-devel faq doc-faq \
readme doc-readme authors doc-authors index doc-index webserver doc-webserver \
man doc-man man2html manuals doc-release doc-pdf doc-shtml announce config-file
#############################################################################
#
# Documentation
#
# converts *.sgml into html, pdf, text and man pages
#
#############################################################################
#############################################################################
# Build the Manuals, etc #########################################
# This does not build _all_ targets #########################################
all: $(DOC_DIR)/doc_version.tmp doc-user doc-devel doc-faq doc-webserver doc-index doc-readme doc-authors doc-man doc-clean
@$(ECHO) Documentation created.
#############################################################################
# Shortcuts. Use these targets if building docs selectively (ie not 'all').
#
# Both index pages (index.html and privoxy-index.html)
index: $(DOC_DIR)/doc_version.tmp doc-webserver doc-index doc-clean
# Just index.html
webserver: $(DOC_DIR)/doc_version.tmp doc-webserver doc-clean
# User Manual html and text
user: $(DOC_DIR)/doc_version.tmp doc-user doc-clean
# Developer Manual html and text
devel: $(DOC_DIR)/doc_version.tmp doc-devel doc-clean
# FAQ html and text
faq: $(DOC_DIR)/doc_version.tmp doc-faq doc-clean
# All formal manuals (html and text).
manuals: $(DOC_DIR)/doc_version.tmp doc-user doc-devel doc-faq doc-clean
# README and INSTALL
readme: $(DOC_DIR)/doc_version.tmp doc-readme doc-clean
# man page and html man page
man: $(DOC_DIR)/doc_version.tmp doc-man doc-clean
# AUTHORS file only.
authors: $(DOC_DIR)/doc_version.tmp doc-authors doc-clean
# PDF version of manuals.
pdf: $(DOC_DIR)/doc_version.tmp doc-pdf
# doh.
clean: doc-clean
# backward compatibility targets
dok-user: user
dok-faq: faq
dok-devel: devel
dok-index: index
dok-man: man
dok-readme: readme
dok: all
# 3 checks to make sure docs will be generated
ensure-wdump:
ifeq (@WDUMP@,false)
@$(ECHO)
@$(ECHO) "Cannot build docs; one of w3m, links, or lynx must be installed."
@$(ECHO) "You should install the appropriate package and rerun ./configure"
@exit 1
endif
ensure-jadebin:
ifeq (@JADEBIN@,false)
@$(ECHO)
@$(ECHO) "Cannot build docs; one of openjade or jade must be installed"
@$(ECHO) "You should install the appropriate package and rerun ./configure"
@exit 1
endif
ensure-dkprefix:
ifeq (@DKPREFIX@,false)
@$(ECHO)
@$(ECHO) "Cannot build docs; cannot find docbook-dsssl stylesheets"
@$(ECHO) "You should install the appropriate package and rerun ./configure"
@exit 1
endif
# Update release info, so it can be read by Docbook/jade, and run other
# checks.
$(DOC_DIR)/doc_version.tmp: ensure-dkprefix ensure-jadebin ensure-wdump doc-release
# Write VERSION and CODE_STATUS to tmp files so they can be read into the doc
# processing. This needs to go before any doc building (doh).
doc-release:
@$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
$(MAKE) doc-clean
mkdir -p $(DOC_TMP)
$(ECHO) -n $(VERSION) > $(DOC_DIR)/doc_version.tmp
$(ECHO) -n $(CODE_STATUS) > $(DOC_DIR)/doc_status.tmp
$(ECHO) -n $(STABLE) > $(DOC_DIR)/doc_stable.tmp
# user manual
doc-user:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd $(DOC_TMP) && $(RM) * && $(DB) -iuser-man ../user-manual.sgml && cd .. && \
$(RM) ../webserver/user-manual/*.html && cp $(DOC_TMP)/*.html ../webserver/user-manual/
$(DB) -iuser-man -V nochunks user-manual.sgml > tmp.html && $(WDUMP) tmp.html > ../text/user-manual.txt
# developer manual
doc-devel:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd $(DOC_TMP) && $(RM) * && $(DB) ../developer-manual.sgml && cd .. && \
$(RM) ../webserver/developer-manual/*.html && cp -f $(DOC_TMP)/*.html ../webserver/developer-manual/
$(DB) -V nochunks developer-manual.sgml > tmp.html && $(WDUMP) tmp.html > ../text/developer-manual.txt
# faq
doc-faq:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd $(DOC_TMP) && $(RM) * && $(DB) ../faq.sgml && cd .. && \
$(RM) ../webserver/faq/*.html && cp $(DOC_TMP)/*.html ../webserver/faq/
$(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) tmp.html > ../text/faq.txt
# Build README and INSTALL files.
doc-readme:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
$(DB)-notoc -V nochunks readme.sgml > tmp.html &&\
$(WDUMP) tmp.html > $(ROOT)/README ;\
$(DB)-notoc -V nochunks install.sgml > tmp.html &&\
$(WDUMP) tmp.html > $(ROOT)/INSTALL ;\
$(RM) tmp.*
# index.sgml is used to create both the Home Page, and a local index
# for documentation (privoxy-index.html), etc.
#
# index.html for webserver:
doc-webserver:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd webserver && $(DB)-notoc -ip-homepage -V nochunks index.sgml > index.html ;\
$(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
s/<\/HEAD/\n<\/HEAD/;\
s/<\/HEAD/\n<\/HEAD/;\
s/\.\d\. //' index.html ;\
$(MV) index.html ../../webserver ;\
$(RM) *.html *.bak
# privoxy-index.html for bundling with locally installed documentation:
doc-index:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd webserver && $(DB)-notoc -ip-index -V nochunks index.sgml > privoxy-index.html ;\
$(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
s/<\/HEAD/\n<\/HEAD/;\
s/<\/HEAD/\n<\/HEAD/;\
s/\.\d\. //' privoxy-index.html ;\
$(MV) privoxy-index.html ../../webserver ;\
$(RM) *.html *.bak
## Make AUTHORS file
doc-authors:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
$(DB) -V nochunks authors.sgml > tmp.html && $(WDUMP) \
tmp.html > ../../AUTHORS
# Make a man page, and then HTML version. Uses docbook2man (short perl script)
# in utils dir.
doc-man:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
cd $(DOC_TMP) && $(RM) * &&\
nsgmls $(DOC_STATUS) ../privoxy-man-page.sgml | sgmlspl ../../../utils/docbook2man/docbook2man-spec.pl &&\
perl -pi.bak -e 's/ //; s/\[ /\[/g' privoxy.1
# cd $(DOC_TMP) && $(DB) ../privoxy-man-page.sgml &&\
# $(MV) -f index.html privoxy-man-page.html
# This html is not used. See make man2html.
$(MV) -f $(DOC_TMP)/privoxy.1 $(ROOT)/privoxy.1
$(MAKE) man2html
$(MAKE) clean
# For those with man2html ala RH7s.
man2html:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
mkdir -p ../webserver/man-page
ifneq ($(MAN2HTML),false)
$(MAN2HTML) $(ROOT)/privoxy.1 |grep -v "^Content-type" > tmp.html
$(PERL) -pi.bak -e 's///; s//man2html/' tmp.html
$(PERL) -pi.bak -e 's/(<\/HEAD>)/<\/HEAD>/' tmp.html
# Twice because my version of man2html is pulling in commas and periods in URLs.
$(PERL) -pi.bak -e 's/()/$$1$$2/g' tmp.html
$(PERL) -pi.bak -e 's,\.">,">,g' tmp.html
# Get rid of spurious from conversion. (How to do this with perl?)
$(SED) -e 's///g' tmp.html > ../webserver/man-page/privoxy-man-page.html && $(RM) tmp.*
else
$(MAKE) groff2html
endif
# Otherwise we get plain groff conversion.
groff2html:
$(G2H_CMD) $(ROOT)/privoxy.1 | $(SED) -e 's@@@' >\
../webserver/man-page/privoxy-man-page.html
# Make pdf docs from single page html. Requires htmldoc, see
# (http://www.easysw.com/htmldoc/). Note: 1.8.20 has a TOC bug.
# PDF docs are uploaded to webserver as zip archive.
doc-pdf: doc-shtml
@$(ECHO) -n "starting htmldoc version: "; htmldoc --version
cd $(UTILS)/ldp_print && $(RM) *html *bak *jpg *tmp *pdf *zip
cp -f $(DOC_TMP)/*html ../webserver/images/*jpg $(UTILS)/ldp_print
cd $(UTILS)/ldp_print ;\
$(PERL) -pi.bak -e 's/\.\.\/images\///; s/(<\/?)SUB/$$1small/i;\
s/\.\.\/user-manual\/index\.html/privoxy-user-manual.pdf/;\
s/\.\.\/developer-manual\/index\.html/privoxy-developer-manual.pdf/;\
s/\.\.\/faq\/index\.html/privoxy-faq.pdf/' *.html ;\
for i in developer-manual user-manual faq; do \
./ldp_print privoxy-$$i.html ;\
$(ECHO) DONE: privoxy-$$i.pdf ;\
done ;\
$(MV) *.pdf ../../doc/pdf ;\
$(RM) *html *bak *jpg *pdf *zip
$(RM) $(DOC_TMP)
# Generate single page html. Used only for creating pdf docs (ATM).
doc-shtml:
test -f $(DOC_DIR)/doc_version.tmp || exit 1
$(DB) -iuser-man -V nochunks user-manual.sgml > $(DOC_TMP)/privoxy-user-manual.html
$(DB) -V nochunks developer-manual.sgml > $(DOC_TMP)/privoxy-developer-manual.html
$(DB) -V nochunks faq.sgml > $(DOC_TMP)/privoxy-faq.html
# Create release announcement in text and html, with short and long versions.
# This is a standalone target, and must be invoked directly.
announce: $(DOC_DIR)/doc_version.tmp
cd $(DOC_TMP) && $(DB) -iannounce-big ../announce.sgml &&\
mv -f index.html announce.html && $(WDUMP) announce.html > announce.txt
cd $(DOC_TMP) && $(DB) ../announce.sgml &&\
mv -f index.html announce-mini.html && $(WDUMP) announce-mini.html > announce-mini.txt &&\
mv -f *html *txt $(ROOT)
$(MAKE) doc-clean
@$(ECHO) Announce texts are done. Please check them. Some hand editing
@$(ECHO) may be required.
# The main Privoxy config file, generated from sgml sources.
# NOTE: This will require some hand editing. The new file is outputted
# as config.new so that problem sections can be compared to previous
# version. This is hardcored to w3m for html/text conversion. Also,
# requires the shell util 'fmt'.
config-file: $(DOC_DIR)/doc_version.tmp
$(DB)-notoc -iconfig-file -V nochunks config.sgml > tmp.html &&\
w3m -dump tmp.html |fmt -w 70 > $(ROOT)/config.new && $(RM) tmp.*
$(PERL) -pi.bak -e 's/^1\. \@\@TITLE\@\@/ /i;\
/^\d\.\d\.\s+/ && tr/[a-z]/[A-Z]/;\
$$header_len=0 unless $$hit_header;\
if ($$hit_header) {\
print "# ";\
for ($$i=1; $$i < $$header_len; $$i++) {print "=";}\
print "\n";\
};\
$$hit_header=0;\
$$hit_header=1 if m/^(\d\.)(\d\.)(\d\.)?\s/ && s/^(\d\.)//;\
$$header_len = length($$_);\
s/^/# /; /^# #{12,}/ && s/^# #/####/;\
s/^.*$$// if $$hit_option;\
$$hit_option=0;\
s/^\n//; s/^#\s*-{20,}//;\
$$hit_option=1 if s/^#\s+@@//;' $(ROOT)/config.new
$(RM) $(ROOT)/*.bak *.tmp tmp.* $(DOC_TMP)
@$(ECHO) "****************************************************"
@$(ECHO) "The output file is config.new."
@$(ECHO) "Now -- you need to hand edit the results!!!"
@$(ECHO) "In particular, check the Debug levels, the"
@$(ECHO) "permit-access, forward & socks examples and the"
@$(ECHO) "various user-manual examples, which all"
@$(ECHO) "probably got hammered."
@$(ECHO) "****************************************************"
# config file, alternate verison using lynx (perl stuff unfinished). Lynx
# does not do so good a job.
config-file-alt: doc-release ensure-wdump
$(ECHO) -e ".h2 JUSTIFY\\nJUSTIFY:FALSE" > tmp.lynx_cfg &&\
$(DB)-notoc -iconfig-file -V nochunks config.sgml > tmp.html &&\
lynx -cfg=tmp.lynx_cfg -width=78 -dump tmp.html > ../../config.new && $(RM) tmp.*
$(PERL) -pi -e 's/^( )//;\
s/:$\/:\n/' $(ROOT)/config.new
# This is mostly to catch cruft from build failures
doc-clean:
$(RM) $(DOC_TMP) *.html `find $(ROOT) -name "tmp.*" -o -name "*.tmp" -o -name "*.bak" -o -name "*.fot"`
tidy:
$(RM) doc_* `find . -name "*~"` `find . -name ".\#*"`
clobber: tidy clean
$(RM) GNUmakefile ldp.dsl
distclean: clobber
coffee:
@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,\
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,\
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,\
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,\
193,51,228,11,1,0,0);'|zcat
#############################################################################
# $Log: GNUmakefile.in,v $
# Revision 1.7 2002/09/16 06:04:34 hal9
# Improved $(VERSION) handling, and related cleanups, with minor changes to most
# targets. Renamed all dok-* targets to doc-*, and added some backward
# compatibility targets.
#
# Revision 1.6 2002/09/06 01:58:28 hal9
# Create a separate INSTALL file, and remove install instructions from README.
# INSTALL is built from dok-readme target.
#
# Revision 1.5 2002/09/05 23:12:04 hal9
# Updated Makefile with 3.0 changes (pdf and man targets, etc). Revise comments
# in privoxy-man-page.sgml to remove out of date comments.
#
# Revision 1.4 2002/08/08 01:02:26 hal9
# Update pdf2 target to dok-shtml (for single page html)
#
# Revision 1.3 2002/06/07 00:27:04 hal9
# Fixing man2html quirk that pulls in punctuation, and breaks URLs.
#
# Revision 1.2 2002/06/05 04:17:19 hal9
# Add dok-man-test target as temp workaround for docbook2man ignoring -i command
# line option.
#
# Revision 1.1 2002/06/05 00:28:28 hal9
# Moving all doc building to doc/source. Rewrite all targets (not well tested).
# Docs are now built without touching sgml source.
#