# Copyright (C) 2001-2010, Parrot Foundation.
# $Id: docs.in 46265 2010-05-04 02:45:24Z gerd $

# Setup of some commands
PERL    = @perl@
CHMOD   = @chmod@
MKPATH  = @mkpath@
TOUCH   = @touch@
RM_F    = @rm_f@
RM_RF   = @rm_rf@
PERLDOC_BIN = @perldoc@
VERSION = @VERSION@@DEVEL@

# long list of .pod files
POD = @TEMP_pod@

#
# Targets
#

# The default target
all: packfile-c.pod $(POD)

# This is a listing of all targets, that are meant to be called by users
# Most of them are proxied in the root makefile parrot/Makefile
help :
	@echo ""
	@echo "Following targets are available to the user:"
	@echo ""
	@echo "  all:               Generate documentation from .pod files or from the sources."
	@echo "                     This is the default target."
	@echo "  clean:             Remove the generated documentation."
	@echo "  html:              Generate HTML documentation."
	@echo "  html-clean:        Remove the generated HTML documentation."
	@echo ""

$(POD): doc-prep

doc-prep:
	$(MKPATH) ops
	$(TOUCH) doc-prep

packfile-c.pod: ../src/packfile.c
#IF(new_perldoc):	$(PERLDOC_BIN) -ud packfile-c.pod ../src/packfile.c
#ELSE:	$(PERLDOC_BIN) -u ../src/packfile.c > packfile-c.pod

clean:
	$(RM_F) packfile-c.pod $(POD) doc-prep

html: all
	$(PERL) -I../lib ../tools/docs/write_docs.pl --silent --version=$(VERSION)

# The pdf target is to generate a parrot PDF document.
# If you are missing the command 'pdflatex' then you have first to install a
# LaTeX distribution with it. For Windows and UNIX downloads are for example
# available from: http://miktex.org, http://tug.org/texlive or
# http://www.ctan.org
pdf: ../tools/docs/filename_and_chapter.pl
	$(MKPATH) build/modified_pod
	$(PERL) ../tools/docs/filename_and_chapter.pl
	cd build && pdflatex parrot-book.tex && pdflatex parrot-book.tex

#pdf-release: build/parrot-book.pdf
#	cp build/parrot-book.pdf build/parrot-book-$$(date +"%Y.%m").pdf

pdf-clean:
	$(RM_RF) build

html-clean:
	$(RM_RF) html

htmlhelp: html
#IF(win32):	cd .. && $(PERL) tools/docs/mk_chm.pl
#IF(win32):	-cd html && hhc parrot.hhp

htmlhelp-clean:
#IF(win32):	$(RM_F) "html/*.hhc" "html/*.hhk" "html/*.hhp" "html/*.chm"

@TEMP_pod_build@

# Local variables:
#   mode: makefile
# End:
# vim: ft=make:
