############################
# fcron-doc's Makefile  ####
############################

# doc/Makefile.  Generated from Makefile.in by configure.

# $Id: Makefile.in,v 1.26 2006/05/20 16:33:12 thib Exp thib $

# The following should not be edited manually (use configure options)
# If you must do it, BEWARE: some of the following is also defined
# in config.h, so you must modify config.h AND Makefile in order
# to set the same values in the two files.


SRCDIR		= .

prefix		= /usr
DESTMAN		= $(DESTDIR)/usr/share/man
DESTDOC		= $(DESTDIR)/usr/share/fcron/doc

INSTALL		= /usr/bin/ginstall -c
JADE 		= 
DB2MAN_BEFORE	= 
DB2MAN_AFTER	= 

ROOTNAME	= root
ROOTGROUP	= root

ANSWERALL	= 2

####################################
# Should not be changed under this #
####################################
STYLESHEET = stylesheets/fcron-doc.dsl
MODFILE = fcron-doc.mod
VERSION = 3.0.2
SGMLFILES = fcron-doc.sgml readme.sgml relnotes.sgml changes.sgml faq.sgml thanks.sgml todo.sgml fcron.8.sgml fcrontab.1.sgml install.sgml fcron.conf.5.sgml fcrontab.5.sgml fcrondyn.1.sgml fdl.sgml gpl.sgml 
TXTFILES = readme install thanks faq gpl todo relnotes changes
MANPAGES = fcron.8 fcron.conf.5 fcrontab.1 fcrontab.5 fcrondyn.1
LANGUAGES = en fr

# this is a regular expression:
# do not ci these files
RCSNOCI=.*\(bitstring.3\|fcron-doc.ced\|Makefile\|stylesheets/fcron-doc.dsl\|fcron-doc.mod\|HTML.*\|txt.*\|man\/.*\|CVS.*\)

all: doc

doc:
# Build all the HTML, text and manual pages in all the languages
	@(for i in $(LANGUAGES); \
	do \
		make $$i/HTML/index.html $$i/txt/readme.txt $$i/man/fcron.8 ; \
	done)

# man/fcron.8 means in fact "build *all* the man pages"
%/man/fcron.8: %/*.sgml fcron-doc.mod stylesheets/fcron-doc.dsl.in
	@(if test -z "$(DB2MAN_BEFORE)"; then \
	   echo "ERROR: cannot generate man pages." ; \
	   echo "  Please check if a db2man converter is installed, or if" \
	   echo "  nsgmls, sgmlspl are installed, and if configure's options" \
	   echo "  --with-db2man and --with-db2man-spec are correctly set." ; \
	   exit 1 ; \
	fi)
	@(echo ; echo "Building $(@D) manual pages..."; echo )
	@(cp -f bitstring.3 $(@D)/)
	@(cd $(@D)/../ ; \
	  ln ../fcron-doc.mod ./ ; \
	  for i in $(MANPAGES); do \
	    echo "  $(@D)/$$i..."; \
	    echo '<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [<!ENTITY % decl SYSTEM "fcron-doc.mod">%decl;]>' > _tmp_ ; \
            echo "&$$i;" >> _tmp_ ; \
            $(DB2MAN_BEFORE) _tmp_ $(DB2MAN_AFTER) > /dev/null 2>&1 ; \
	    rm -f _tmp_ ; \
	    mv `basename $$i .sgml` man/ ; \
          done ; \
	  rm fcron-doc.mod ; \
	  rm -f manpage.links manpage.refs)


# txt/readme.txt means in fact "build *all* the text pages"
%/txt/readme.txt: %/HTML/index.html
	@(echo ; echo "Building $(@D) files..."; echo )
	@(for i in $(TXTFILES); do \
	  echo "  $(@D)/$$i..."; \
	  lynx -dump -nolist $(@D)/../HTML/$$i.html > $(@D)/$$i.txt; done )

fcron-doc.mod: fcron-doc.mod.in ../configure.in
	@(echo ; echo "Building fcron-doc.mod")
	@(../script/gen-in.pl fcron-doc.mod.in fcron-doc.mod ../)

# HTML/index.html means in fact "build *all* the HTML pages"
%/HTML/index.html: %/*.sgml fcron-doc.mod stylesheets/fcron-doc.dsl.in
	@(echo ; echo "Building $(@D)...")
	@(rm -fR $(@D)/*.html)
	@(cd $(@D)/../ ; $(JADE) -D ../ -D ./ -t sgml -i html -d ../stylesheets/fcron-doc.dsl\#html fcron-doc.sgml)

install: clean
	@(echo "Installing man pages in $(DESTMAN)...")
	@(for l in $(LANGUAGES); do \
		if test "x$$l" = "xen"; then \
			DIR=$(DESTMAN); \
		else \
			DIR=$(DESTMAN)/$$l; \
		fi ; \
		for i in 1 3 5 8; do \
			if test ! -d $$DIR/man$$i; then \
	$(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/man$$i ; \
			 fi ; \
	$(INSTALL) -m 644 -o $(ROOTNAME) $(SRCDIR)/$$l/man/*.$$i $$DIR/man$$i ; \
		done ; \
	done )

	@(echo "Installing documentation files in $(DESTDOC)/fcron-$(VERSION)...")
	@(if test ! -d $(DESTDOC)/fcron-$(VERSION); then $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $(DESTDOC)/fcron-$(VERSION) ; fi)

	@(for l in $(LANGUAGES); do \
		DIR=$(DESTDOC)/fcron-$(VERSION) ; \
		if test ! -d $$DIR/$$l; then \
	$(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/$$l ; \
		fi ; \
		for i in txt HTML; do \
			if test ! -d $$DIR/$$l/$$i; then \
	$(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/$$l/$$i ; \
			 fi ; \
	$(INSTALL) -m 644 -o $(ROOTNAME) $$l/$$i/* $$DIR/$$l/$$i/ ;\
		done ; \
	done )

uninstall:
	rm -fR $(DESTDOC)/fcron-$(VERSION)
	@(echo "Removing man pages ...")
	@(for l in $(LANGUAGES); do \
		if test "x$$l" = "xen"; then \
			DIR=$(DESTMAN); \
		else \
			DIR=$(DESTMAN)/$$l; \
		fi ; \
		rm -f $$DIR/man1/fcrontab.1 ; \
		rm -f $$DIR/man1/fcrondyn.1 ; \
		rm -f $$DIR/man3/bitstring.3 ; \
		rm -f $$DIR/man5/fcrontab.5 ; \
		rm -f $$DIR/man5/fcron.conf.5 ; \
		rm -f $$DIR/man8/fcron.8 ; \
	done )


clean:
	@(cd $(SRCDIR) ; \
	  BASEDIR=`pwd` ; \
	  for i in stylesheets $(LANGUAGES) . ; do \
	    cd $$i ; \
	    echo "Cleaning: `pwd`"; \
            rm -f *~ *.html *.htm *.texi *.info *.refs manpage.links manpage.refs \
	        core *.tar.gz ; \
            cd $$BASEDIR ;  \
          done)

tarclean: clean
	rm -f Makefile stylesheets/fcron-doc.dsl fcron-doc.mod

vclean: clean
	rm -f */HTML/* */man/* */txt/*

ci: clean
# we run a "cd .." because it makes appear the path of the file ( ./doc/XXXX )
# during the ci-ing
# the symbolic links verX_X_X has been created since version 2.9.4
	@(cd ..; find ./doc/ -type f ! -regex '.*RCS.*' ! -regex "$(RCSNOCI)" \
             -exec ci -l -Nver`echo $(VERSION) | tr '.' '_'` {} \;)

tarhtmldoc: doc
	for i in $(LANGUAGES); do \
	  cd $$i ; \
	  mkdir fcron-$(VERSION)-doc-$$i-html ;\
	  cp HTML/*.html fcron-$(VERSION)-doc-$$i-html ;\
	  rm -f fcron-doc-$$i-html.tar.gz ;\
	  tar -czvf fcron-doc-$$i-html.tar.gz fcron-$(VERSION)-doc-$$i-html/* ;\
	  rm -fR fcron-$(VERSION)-doc-$$i-html ; \
	  cd .. ; \
	done
