#  $Id: Makefile.in 0.26 1996/07/16 00:02:06 tom Exp $
###############################################################################
#
#  Generic Makefile to create the Gcal documentation.
#
#  Copyright (C) 1994-1996      Thomas Esken            <esken@uni-muenster.de>
#                               Im Hagenfeld 84
#                               D-48147 M"unster
#                               GERMANY
#
#                               and the FREE SOFTWARE FOUNDATION
#
###############################################################################
#
#
#
#### Start of system configuration section. ####

PACKAGE = @PACKAGE@
VERSION = @VERSION@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

subdir = doc

@SET_MAKE@

doclang = @doclang@

MAKEINFO = @MAKEINFO@
MAKEINFOVERSION = @MAKEINFOVERSION@
TEXI2DVI = @TEXI2DVI@

SHAR = @SHAR@
ZIP = @ZIP@
ZOO = @ZOO@
LHA = @LHA@
TAR = @TAR@
GZIP = @GZIP@
COMPRESS = @COMPRESS@

PERL = @PERL@
AWK = @AWK@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

prefix = @prefix@

# Where to install the info files.
infodir = $(prefix)/info
# Extension (not including `.') for the installed manual page file names.
manext = 1
# Where to install the manual pages.
mandir = $(prefix)/man/man$(manext)

#### End of system configuration section. ####



#### Start of package specific make variable definition section. ####

SHELL = /bin/sh

#
# Other utility program flags.
#
MAKEINFOFLAGS = --output
#
# For text documentation files, makeinfo MUST be called exactly in this way!
#
MAKEINFOFLAGS2 = --no-split --no-headers $(MAKEINFOFLAGS)

#
# Standard names.
#

manDIR = man#
docscriptDIR = scripts#
texiDIR = texi#

docTEXINFO = texinfo.tex

docMISCFILES = Makefile.in $(docTEXINFO)

de = de#

$(de)-infoFILES = $(de)/gcal.info $(de)/gcal.info-1 $(de)/gcal.info-2 \
  $(de)/gcal.info-3 $(de)/gcal.info-4 $(de)/gcal.info-5 $(de)/gcal.info-6

$(de)-manFILES = $(de)/$(manDIR)/gcal.1 $(de)/$(manDIR)/txt2gcal.1 \
  $(de)/$(manDIR)/tcal.1

$(de)-docscriptFILES = $(de)/$(docscriptDIR)/2um-dvi.awk \
  $(de)/$(docscriptDIR)/2um-dvi.pl $(de)/$(docscriptDIR)/2um-info.awk \
  $(de)/$(docscriptDIR)/2um-info.pl

$(de)-texiFILES = $(de)/$(texiDIR)/gcal.texi $(de)/$(texiDIR)/isolatin1.tex

$(de)-txtFILES = $(de)/gcal.txt

en = en#

$(en)-infoFILES = $(en)/gcal.info $(en)/gcal.info-1 $(en)/gcal.info-2 \
  $(en)/gcal.info-3 $(en)/gcal.info-4 $(en)/gcal.info-5 $(en)/gcal.info-6

$(en)-manFILES = $(en)/$(manDIR)/gcal.1 $(en)/$(manDIR)/txt2gcal.1 \
  $(en)/$(manDIR)/tcal.1

$(en)-texiFILES = $(en)/$(texiDIR)/gcal.texi

$(en)-txtFILES = $(en)/gcal.txt

infoFILES = $($(de)-infoFILES) $($(en)-infoFILES)

man1FILES = $($(de)-manFILES) $($(en)-manFILES)

manFILES = gcal txt2gcal tcal

docscriptFILES = $($(de)-docscriptFILES)

texiFILES = $($(de)-texiFILES) $($(en)-texiFILES)

txtFILES = $($(de)-txtFILES) $($(en)-txtFILES)

DISTFILES = $(docMISCFILES) $(man1FILES) $(docscriptFILES) $(texiFILES)

ALLDIRS = $(infodir) $(mandir)

ALLDOCS = $(de) $(en)

#### End of package specific make variable definition section. ####



#### Start of default targets section. ####

default: gcal.txt gcal.info

all: default

check installbin install-strip ID id TAGS tags:
	@echo "Nothing to be done for \`$@'"

#### End of default targets section. ####



#
# If not exist, try to create the native language specific text documentation
# file for distribution (dist, dist-gcal, distzip, distzoo, distlha and
# distshar) from the native language specific `gcal.texi' file and remove all
# index entries.
#
# If the German language is selected, convert the German Texinfo file by
# `perl' (prefered) or `awk' to get the German "Umlaute" characters
# of the ISO-8859-1 character set.
#

$(txtFILES): $(texiFILES)
	for dir in $(ALLDOCS); \
	do \
	  if test ! -f "$$dir/gcal.txt"; \
	  then \
	    if test -n "$(ZIP)" || test -n "$(ZOO)" || test -n "$(LHA)" || test -n "$(SHAR)" \
	    || (test -n "$(TAR)" && (test -n "$(GZIP)" || test -n "$(COMPRESS)")); \
	    then \
	      if test -n "$(MAKEINFO)" && test -n "$(MAKEINFOVERSION)"; \
	      then \
	        echo "Creating distribution text documentation file \`$$dir/gcal.txt'"; \
	        echo "Please wait..."; \
	        case $$dir in \
	          $(de)) \
	            if test -n "$(PERL)"; \
	            then \
	              echo "$(PERL) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	              $(PERL) $$dir/$(docscriptDIR)/2um-info.pl $$dir/$(texiDIR)/gcal.texi > \
	              $$dir/gcal.texi; \
	            else \
	              if test -n "$(AWK)"; \
	              then \
	                echo "$(AWK) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	                $(AWK) -f $$dir/$(docscriptDIR)/2um-info.awk $$dir/$(texiDIR)/gcal.texi > \
	                $$dir/gcal.texi; \
	              else \
	                echo "$(doclang) Umlaute not converted, missing \`perl' / \`awk'"; \
	                cp -p $$dir/$(texiDIR)/gcal.texi $$dir/gcal.texi; \
	              fi; \
	            fi;; \
	          $(en)) \
	            cp -p $$dir/$(texiDIR)/gcal.texi $$dir/gcal.texi;; \
	          *) \
	            echo "Error, \`$$dir' is unsupported"; \
	            exit 1;; \
	        esac; \
	        $(MAKEINFO) $(MAKEINFOFLAGS2) gcal.txt $$dir/gcal.texi; \
	        rm -f $$dir/gcal.texi; \
	        case $$dir in \
	          $(de)) \
	            cat gcal.txt | \
	            sed -e 's/* Menu:/(entfernt)/g' \
	                -e 's/*note/*siehe/g' \
	                -e 's/*Note/*Siehe/g' \
	                -e 's/Footnotes/Fussnoten/g' \
	                -e '/^* /d' \
	                -e '/-DIR-/d' > $$dir/gcal.txt;; \
	          $(en)) \
	            cat gcal.txt | \
	            sed -e 's/* Menu:/(removed)/g' \
	                -e '/^* /d' \
	                -e '/-DIR-/d' > $$dir/gcal.txt;; \
	          *) \
	            echo "Error, \`$$dir' is unsupported"; \
	            exit 1;; \
	        esac; \
	        echo "\`$$dir/gcal.txt' created"; \
	        rm -f gcal.txt; \
	      else \
	        if test -z "$(MAKEINFO)"; \
	        then \
	          echo "Unable to create distribution text documentation file \`$$dir/gcal.txt', missing \`makeinfo'"; \
	        else \
	          echo "Unable to create distribution text documentation file \`$$dir/gcal.txt', \`makeinfo' out of date"; \
	        fi; \
	      fi; \
	    else \
	      echo "Distribution text documentation file \`$$dir/gcal.txt' not created because"; \
	      echo "archiver respectively compressor programs are missing"; \
	    fi; \
	  fi; \
	done

txt gcal.txt: $(txtFILES)

#
# If not exist, try to create the native language specific info documentation
# files for distribution (dist, dist-gcal, distzip, distzoo, distlha and
# distshar) from the native language specific `gcal.texi' file.
#
# If the German language is selected, convert the German Texinfo file by
# `perl' (prefered) or `awk' to get the German "Umlaute" characters
# of the ISO-8859-1 character set.
#

$(infoFILES): $(texiFILES)
	for dir in $(ALLDOCS); \
	do \
	  if test ! -f "$$dir/gcal.info"; \
	  then \
	    if test -n "$(MAKEINFO)"; \
	    then \
	      echo "Creating distribution info files \`$$dir/gcal.info*'"; \
	      echo "Please wait..."; \
	      case $$dir in \
	        $(de)) \
	          if test -n "$(PERL)"; \
	          then \
	            echo "$(PERL) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	            $(PERL) $$dir/$(docscriptDIR)/2um-info.pl $$dir/$(texiDIR)/gcal.texi > \
	            $$dir/gcal.texi; \
	          else \
	            if test -n "$(AWK)"; \
	            then \
	              echo "$(AWK) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	              $(AWK) -f $$dir/$(docscriptDIR)/2um-info.awk $$dir/$(texiDIR)/gcal.texi > \
	              $$dir/gcal.texi; \
	            else \
	              echo "$(doclang) Umlaute not converted, missing \`perl' / \`awk'"; \
	              cp -p $$dir/$(texiDIR)/gcal.texi $$dir/gcal.texi; \
	            fi; \
	          fi;; \
	        $(en)) \
	          cp -p $$dir/$(texiDIR)/gcal.texi $$dir/gcal.texi;; \
	        *) \
	          echo "Error, \`$$dir' is unsupported"; \
	          exit 1;; \
	      esac; \
	      $(MAKEINFO) $(MAKEINFOFLAGS) $$dir/gcal.info $$dir/gcal.texi; \
	      rm -f $$dir/gcal.texi; \
	      echo "\`$$dir/gcal.info*' created"; \
	    else \
	      echo "Unable to create distribution info files \`$$dir/gcal.info*', missing \`makeinfo'"; \
	    fi; \
	  fi; \
	done

info gcal.info: $(infoFILES)

#
# Try to create dvi documentation file according to selected native language.
#
# If the German language is selected, convert the German Texinfo file by
# `perl' (prefered) or `awk' to get the German "Umlaute" characters and 
# modify the `texinfo.tex' file of the package accordingly.
#

gcal.dvi: $(texiFILES) $(docTEXINFO)
	case $(doclang) in \
	  German) \
	    dir=$(de);; \
	  English) \
	    dir=$(en);; \
	  *) \
	    echo "Error, \`$(doclang)' is unsupported"; \
	    exit 1;; \
	esac; \
	if test ! -f "$$dir/$@"; \
	then \
	  if test -n "$(TEXI2DVI)"; \
	  then \
	    echo "Creating \`$$dir/$@' file for $(doclang) users"; \
	    echo "Please wait..."; \
	    cd $$dir; \
	    case $$dir in \
	      $(de)) \
	        if test -n "$(PERL)"; \
	        then \
	          echo "$(PERL) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	          mv $(texiDIR)/gcal.texi $(texiDIR)/gcal-$$dir.texi; \
	          $(PERL) $(docscriptDIR)/2um-dvi.pl $(texiDIR)/gcal-$$dir.texi > \
	          $(texiDIR)/gcal.texi; \
	        else \
	          if test -n "$(AWK)"; \
	          then \
	            echo "$(AWK) converts $(doclang) Umlaute of \`$$dir/$(texiDIR)/gcal.texi' ..."; \
	            mv $(texiDIR)/gcal.texi $(texiDIR)/gcal-$$dir.texi; \
	            $(AWK) -f $(docscriptDIR)/2um-dvi.awk $(texiDIR)/gcal-$$dir.texi > \
	            $(texiDIR)/gcal.texi; \
	          else \
	            echo "$(doclang) Umlaute not converted, missing \`perl' / \`awk'"; \
	            cp -p $(texiDIR)/gcal.texi $(texiDIR)/gcal-$$dir.texi; \
	          fi; \
	        fi; \
	        cat ../$(docTEXINFO) | \
	        sed -e 's/{Chapter}}/{Kapitel}}/' \
	            -e 's/{See}}/{Siehe}}/' \
	            -e 's/{see}}/{siehe}}/' \
	            -e 's/{file}}/{Datei}}/' \
	            -e 's/{page}}/{Seite}}/' \
	            -e 's/{section}}/{Abschnitt}}/' \
	            -e 's/{Section}}/{Abschnitt}}/' \
	            -e 's/{Table of Contents}}/{Inhaltsverzeichnis}}/' \
	            -e 's/{Short Contents}}/{Kurzinhalt}}/' \
	            -e 's/{Appendix}}/{Anhang}}/' > $(docTEXINFO); \
	        $(TEXI2DVI) $(texiDIR)/gcal.texi; \
	        rm -f $(texiDIR)/gcal.texi $(docTEXINFO); \
	        mv $(texiDIR)/gcal-$$dir.texi $(texiDIR)/gcal.texi;; \
	      $(en)) \
	        cp -p ../$(docTEXINFO) $(docTEXINFO); \
	        $(TEXI2DVI) $(texiDIR)/gcal.texi; \
	        rm -f $(docTEXINFO);; \
	    esac; \
	    echo "\`$@' file created in $(subdir)/$$dir directory"; \
	  else \
	    echo "Unable to create \`$$dir/$@' file, missing \`texi2dvi'"; \
	  fi; \
	else \
	  echo "Creation of \`$$dir/$@' file unnecessary,"; \
	  echo "already existent. You have to erase this file first"; \
	fi

dvi: gcal.dvi

#### End of actual build-related targets section. ####



#### Start of install section. ####

install: installdirs installman installinfo
	@echo "All installs in $(subdir) done"

installdirs: $(top_srcdir)/mkinstalldirs
	$(SHELL) $(top_srcdir)/mkinstalldirs $(ALLDIRS)

#
# If the German language is selected, convert the German `man' files by
# `perl' (prefered) or `awk' to get the German "Umlaute" characters
# of the ISO-8859-1 character set.
#

installman: installdirs $(man1FILES)
	case $(doclang) in \
	  German) \
	    dir=$(de);; \
	  English) \
	    dir=$(en);; \
	  *) \
	    echo "Error, \`$(doclang)' is unsupported"; \
	    exit 1;; \
	esac; \
	for file in $(manFILES); \
	do \
	  rm -f $(mandir)/$$file.$(manext); \
	  echo "Installing \`$$dir/$(manDIR)/$$file.1' for $(doclang) users to \`$(mandir)/$$file.$(manext)'"; \
	  case $$dir in \
	    $(de)) \
	      if test -n "$(PERL)"; \
	      then \
	        echo "$(PERL) converts $(doclang) Umlaute of \`$$dir/$(manDIR)/$$file.1' ..."; \
	        $(PERL) $$dir/$(docscriptDIR)/2um-info.pl $$dir/$(manDIR)/$$file.1 > \
	        $$dir/$$file.1; \
	      else \
	        if test -n "$(AWK)"; \
	        then \
	          echo "$(AWK) converts $(doclang) Umlaute of \`$$dir/$(manDIR)/$$file.1' ..."; \
	          $(AWK) -f $$dir/$(docscriptDIR)/2um-info.awk $$dir/$(manDIR)/$$file.1 > \
	          $$dir/$$file.1; \
	        else \
	          echo "$(doclang) Umlaute not converted, missing \`perl' / \`awk'"; \
	          cp -p $$dir/$(manDIR)/$$file.1 $$dir/$$file.1; \
	        fi; \
	      fi; \
	      $(INSTALL_DATA) $$dir/$$file.1 $(mandir)/$$file.$(manext); \
	      rm -f $$dir/$$file.1;; \
	    $(en)) \
	      $(INSTALL_DATA) $$dir/$(manDIR)/$$file.1 $(mandir)/$$file.$(manext);; \
          esac; \
	done
	@echo "$(doclang) manual pages installed"

#
# If `makeinfo' program exists, try to create the native language specific
# gcal.info* files and install them into the infodir.
#
installinfo: installdirs $(infoFILES)
	rm -f $(infodir)/gcal.info*
	case $(doclang) in \
	  German) \
	    dir=de;; \
	  English) \
	    dir=en;; \
	  *) \
	    echo "Error, \`$(doclang)' is unsupported"; \
	    exit 1;; \
	esac; \
	cd $$dir; \
	instfiles=`echo gcal.info*`; \
	cd ..; \
	for file in $$instfiles; \
	do \
	  echo "Installing \`$$dir/$$file' for $(doclang) users to \`$(infodir)/$$file'"; \
	  $(INSTALL_DATA) $$dir/$$file $(infodir)/$$file; \
	done; \
	if $(SHELL) -c 'install-info --version' > /dev/null 2>&1; \
	then \
	  install-info --infodir=$(infodir) $$dir/gcal.info; \
	else \
	  if $(SHELL) -c '$(top_srcdir)/install-info --version' > /dev/null 2>&1; \
	  then \
	    $(top_srcdir)/install-info --infodir=$(infodir) $$dir/gcal.info; \
	  else \
	    true; \
	  fi; \
	fi
	@echo "$(doclang) info files installed"

uninstall:
	@echo "Please wait..."
	for file in $(manFILES); \
	do \
	  rm -f $(mandir)/$$file.$(manext); \
	done
	rm -f $(infodir)/gcal.info*
	@echo "Documentation files of distribution uninstalled"

#### End of install section. ####



#### Start of clean section. ####

clean:
	rm -f core *~ *.tmp gcal.txt
	for dir in $(ALLDOCS); \
	do \
	  rm -f $$dir/$(docTEXINFO) $$dir/gcal.dvi \
	        $$dir/gcal.texi $$dir/$(texiDIR)/gcal-$$dir.texi \
	        $$dir/gcal.1 $$dir/txt2gcal.1 $$dir/tcal.1; \
	done

texclean:
	for dir in $(ALLDOCS); \
	do \
	  rm -f $$dir/*.ar  $$dir/*.ars $$dir/*.aux $$dir/*.bak $$dir/*.cp \
	        $$dir/*.cps $$dir/*.dvi $$dir/*.fn  $$dir/*.fns $$dir/*.ky \
	        $$dir/*.kys $$dir/*.log $$dir/*.pg  $$dir/*.pgs $$dir/*.toc \
	        $$dir/*.tp  $$dir/*.tps $$dir/*.vr  $$dir/*.vrs; \
	done

distclean: clean texclean
	rm -f Makefile

mostlyclean: distclean

realclean: distclean
	rm -f ID id TAGS tags

maintainer-clean: realclean
	@echo "This command is intended only for maintainers to use;"
	@echo "rebuilding the deleted files may require special tools."
	if test -n "$(MAKEINFO)" && test -n "$(MAKEINFOVERSION)"; \
	then \
	  for dir in $(ALLDOCS); \
	  do \
	    rm -f $$dir/gcal.txt $$dir/gcal.info*; \
	  done; \
	fi

#### End of clean section. ####



dist dist-gcal distzip distzoo distlha distshar: Makefile $(DISTFILES) $(txtFILES) $(infoFILES)

Makefile: Makefile.in ../config.status
	cd .. \
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
	       $(SHELL) ./config.status



# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

# End of file
