# GNUmakefile --
#
#	This GNUmakefile requires GNU make. It builds the HTML version
#	of the Tix man pages. You normally do not need to use this
#	GNUmakefile, as all the HTML man pages are already included in
#	the Tix source distribution.
#
#	You need to use this file when you are create a Tix source
#	distribution from the Tix CVS tree. See
#	../docs/MakeSrcDist.txt for more information.
#
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: GNUmakefile,v 1.3 2001/02/27 06:44:32 ioilam Exp $

#
# Put your config of TCLSH and HTMLDOC into ./config.gmk, so that you
# don't have to edit this file.
#
ifeq ("$(shell test -f config.gmk && echo 1)", "1")
include config.gmk
endif

ifndef TCLSH
TCLSH		= tclsh
endif

ifndef HTMLDOC
HTMLDOC		= //c/Program\ Files/HTMLDOC/htmldoc.exe
endif

MAN2HTML	= ../tools/tix-man2html.tcl
UPDATEIDX	= ../tools/man2html-fixindex.tcl
PDFFIX		= ../tools/man2html-pdffix.tcl
NROFF_SRCS	= $(shell echo *.n *.1)
PDFDOC		= pdf/Tix_Reference_Manual.pdf
DEPENDS		= ${NROFF_SRCS} ${MAN2HTML} GNUmakefile

#
# This target generates HTML and PDF of all Tix man pages as well as
# a small subset of Tcl/Tk pages that are referenced by the Tix pages.
#
all: htmldoc pdfdoc

htmldoc: html/contents.htm

pdfdoc: ${PDFDOC}

html/contents.htm: ${DEPENDS} ${UPDATEIDX}
	${TCLSH} ${MAN2HTML} --htmldir=html --srcdir=../..
	${TCLSH} ${UPDATEIDX} html

pdf/about.htm: html/about.htm
	grep -v '[<][!]--' $< > $@

pdf/copyright.htm: html/copyright.htm
	grep -v '[<][!]--' $< > $@

pdf:
	mkdir pdf

${PDFDOC}: ${DEPENDS} ${PDFFIX} pdf pdf/about.htm pdf/copyright.htm  
	$(MAKE) pdfsrcs
	$(MAKE) pdffix
	$(MAKE) runhtmldoc

pdfsrcs:
	${TCLSH} ${MAN2HTML} --htmldir=pdf --srcdir=../..

pdffix:
	${TCLSH} ${PDFFIX} pdf

runhtmldoc:
	${HTMLDOC} \
		--book -f ${PDFDOC} \
		--toclevels 2 --no-numbered \
		--title html/pdftitle.html \
		--titleimage ../demos/bitmaps/tix.gif \
		--footer ... \
		--firstpage c1 \
		`cat pdf/files.txt`
	ls -l ${PDFDOC}

distclean:
	-cd html; rm -rf contents.htm *~ Keywords UserCmd
	-cd html; rm -rf TclCmd TclLib
	-cd html; rm -rf TkCmd  TkLib
	-cd html; rm -rf TixCmd TixLib
	rm -rf pdf *~
#
# This target rebuilds only a small portion of the HTML pages for testing
#
test:
	env TEST_ONLY=true $(MAKE) all

#
# This target generate HTML and PDF docs for all of Tix, Tcl and Tk man
# pages
#
full:
	env WITH_TCL_TK=true $(MAKE) all


