# ======================================================================
# Makefile.baseinit
# Copyright (c) Markus Kohm, 2002-2013
#
# This file is part of the LaTeX2e KOMA-Script bundle.
#
# This work may be distributed and/or modified under the conditions of
# the LaTeX Project Public License, version 1.3c of the license.
# The latest version of this license is in
#   http://www.latex-project.org/lppl.txt
# and version 1.3c or later is part of all distributions of LaTeX 
# version 2005/12/01 or later and of this work.
#
# This work has the LPPL maintenance status "author-maintained".
#
# The Current Maintainer and author of this work is Markus Kohm.
#
# This work consists of all files listed in manifest.txt.
# ----------------------------------------------------------------------
# Makefile.baseinit
# Copyright (c) Markus Kohm, 2002-2013
#
# Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
# Version 1.3c, verteilt und/oder veraendert werden.
# Die neuste Version dieser Lizenz ist
#   http://www.latex-project.org/lppl.txt
# und Version 1.3c ist Teil aller Verteilungen von LaTeX
# Version 2005/12/01 oder spaeter und dieses Werks.
#
# Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
# (allein durch den Autor verwaltet).
#
# Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
# 
# Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
# ======================================================================
# This is the basic initialization of environment, programm variables
# etc. You may overload each of the defined variables at Makefile.cfg.
# To do so, just copy the original definition to Makefile.cfg and change
# it there.
# ----------------------------------------------------------------------
# Hier finden Sie die Grundinitialisierung der Umgebungsvariablen,
# Programmvariablen usw. Sie können die Definition jeder dieser
# Variablen in Makefile.cfg überladen. Um dies zu tun, kopieren Sie
# einfach die Originaldefinition in Makefile.cfg und ändern die
# Definition dort entsprechend Ihrer Anforderungen.
# ======================================================================

# ----------------------------------------------------------------------
# KOMA-Script subfolder
KOMASCRIPTSUBDIR=/koma-script
# ----------------------------------------------------------------------
# The texmf-directory, where to install new stuff (see texmf.cnf)
# If you don't know what to do, search for directory texmf at /usr.
# With teTeX and linux often one of following is used:
#INSTALLTEXMF ?= /usr/TeX/texmf
#INSTALLTEXMF ?= /usr/local/TeX/texmf
#INSTALLTEXMF ?= /usr/share/texmf
#INSTALLTEXMF ?= /usr/local/share/texmf
# user tree:
#INSTALLTEXMF ?= $(HOME)/texmf
# Try to use user's tree known by kpsewhich:
#INSTALLTEXMF ?= $(shell kpsewhich -expand-var '$$HOMETEXMF')
# Try to use the local tree known by kpsewhich:
#INSTALLTEXMF ?= $(shell kpsewhich -expand-var '$$TEXMFLOCAL')
# But you may set INSTALLTEXMF to every directory you want.
# Use following, if you only want to test the installation:
#INSTALLTEXMF ?= /tmp/texmf
# Do a more complicate default:
ifneq ($(USER),root)
	INSTALLTEXMF ?= $(shell kpsewhich -expand-var='$$HOMETEXMF')
ifeq ($(INSTALLTEXMF),$$HOMETEXMF)
     INSTALLTEXMF :=
endif
ifeq ($(INSTALLTEXMF),)
	INSTALLTEXMF = $(shell kpsewhich -expand-var='$$TEXMFHOME')
ifeq ($(INSTALLTEXMF),$$TEXMFHOME)
     INSTALLTEXMF :=
endif
endif
endif

ifeq ($(INSTALLTEXMF),)
	INSTALLTEXMF = $(shell kpsewhich -expand-var='$$TEXMFLOCAL')
ifeq ($(INSTALLTEXMF),$$TEXMFLOCAL)
     INSTALLTEXMF :=
endif
endif

ifeq ($(INSTALLTEXMF),)
	INSTALLTEXMF = $(shell kpsewhich -expand-var='$$TEXMFMAIN')
ifeq ($(INSTALLTEXMF),$$TEXMFMAIN)
     INSTALLTEXMF :=
endif
endif
# ----------------------------------------------------------------------
# The directory, where to install *.cls, *.sty etc.
INSTALLCLSDIR ?= $(INSTALLTEXMF)/tex/latex$(KOMASCRIPTSUBDIR)
# ----------------------------------------------------------------------
# The directory, where to install generic *.tex files
INSTALLTEXDIR ?= $(INSTALLTEXMF)/tex/generic$(KOMASCRIPTSUBDIR)
# ----------------------------------------------------------------------
# The directory, where to install documentation
INSTALLDOCDIR ?= $(INSTALLTEXMF)/doc/latex$(KOMASCRIPTSUBDIR)
# ----------------------------------------------------------------------
# The directory, where to install the sources
INSTALLSRCDIR ?= $(INSTALLTEXMF)/source/latex$(KOMASCRIPTSUBDIR)
# ----------------------------------------------------------------------
# The directory, where to install demos
INSTALLDEMODIR ?= $(INSTALLDOCDIR)/demo
# ----------------------------------------------------------------------
# Extensions of files which are generated for generation
CLEANEXTS	= *.aux *.bbl *.blg *.glg *.glo *.gls *.glx *.idx \
		  *.ilg *.ind *.lof *.log *.lot *.out *.toc \
		  *.toc[0-9] *.toc[0-9][0-9] *.synctex.gz *.slnc \
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# The programms/commands, which are used
LATEX		= pdflatex
NONSTOPMODE	= \\nonstopmode
BATCHMODE	= \\batchmode
DVIOUTPUT	= \\pdfoutput=0\\let\\pdfoutput\\undefined\\input
PDFOUTPUT	= \\pdfoutput=1\\input

MKINDEX		= mkindex
TEXUNPACK       = tex

SILENT		= @
RM		= rm -f
SRM		= $(SILENT)$(RM)
RMDIR		= rm -fr
SRMDIR		= $(SILENT)$(RMDIR)
CP		= cp -f
SCP		= $(SILENT)$(CP)
CPALL		= cp -af
SCPALL		= $(SILENT)$(CPALL)
CD		= cd
SCD		= $(SILENT)$(CP)
SYMLINK		= ln -sf
SSYMLINK	= $(SILENT)$(SYMLINK)
INSTALL		= install -m 644
SINSTALL	= $(SILENT)$(INSTALL)
INSTALLEXECUTABLE = install -m 744
SINSTALLEXECUTABLE = $(SILENT)$(INSTALLEXECUTABLE)
MKDIR		= install -m 755 -d
SMKDIR		= $(SILENT)$(MKDIR)
MV              = mv -f
SMV		= $(SILENT)$(MV)
ECHO		= echo
SECHO		= $(SILENT)$(ECHO)
LL              = ls -l
SLL             = $(SILENT)$(LL)
TARGZ           = tar zc -f
STARGZ          = $(SILENT)$(TARGZ)
UNTARGZ         = tar zx -f
SUNTARGZ        = $(SILENT)$(UNTARGZ)
TARBZ           = tar jc -f
STARBZ          = $(SILENT)$(TARBZ)
ZIP             = zip -r9qy
SZIP            = $(SILENT)$(ZIP)
UNZIP		= unzip -q
SUNZIP		= $(SILENT)$(UNZIP)
GREP            = grep
CKSUM		= md5sum
HEAD		= head -n

ISODATE         = `date -I`
MKTEXLSR	= mktexlsr $(INSTALLTEXMF)
# ----------------------------------------------------------------------


# ======================================================================
# Do not copy and change any of the following lines:
# ======================================================================

# ----------------------------------------------------------------------
# Loading Makefile.cfg if it exists.
# Don't 
-include Makefile.cfg
# ----------------------------------------------------------------------

# ----------------------------------------------------------------------
# Do all variable tests
test_baseinit:
ifndef INSTALLTEXMF
	$(error You have to define variable INSTALLTEXMF at Makefile.cfg!)
endif
	$(SMKDIR) $(INSTALLTEXMF)
ifdef INSTALLSRCDIR
	$(SMKDIR) $(INSTALLSRCDIR)
else
	$(warning Sources will not be installed!)
endif
ifdef INSTALLDOCDIR
	$(SMKDIR) $(INSTALLDOCDIR)
else
	$(warning Documentation will not be installed!)
endif
#ifdef INSTALLDEMODIR
#	$(SMKDIR) $(INSTALLDEMODIR)
#else
#	$(warning Demos will not be installed!)
#endif
ifdef INSTALLCLSDIR
	$(SMKDIR) $(INSTALLCLSDIR)
else
	$(warning Classes, Packages, etc. will not be installed!)
endif
ifdef VERBOSE
	$(SECHO) ============================================================
	$(SECHO) Makefile.baseinit: variables and their values:
	$(SECHO) "  INSTALLTEXMF  =$(INSTALLTEXMF)"
	$(SECHO) "  INSTALLSRCDIR =$(INSTALLSRCDIR)"
	$(ECHO)  "  INSTALLTEXDIR =$(INSTALLTEXDIR)"
	$(SECHO) "  INSTALLDOCDIR =$(INSTALLDOCDIR)"
	$(SECHO) "  INSTALLDEMODIR=$(INSTALLDEMODIR)"
	$(SECHO) "  INSTALLCLSDIR =$(INSTALLCLSDIR)"
	$(SECHO) "  TEXINPUTS     =$(TEXINPUTS)"
	$(SECHO) "  CLEANEXTS     =$(CLEANEXTS)"
	$(SECHO) ============================================================
endif

# ----------------------------------------------------------------------

