#!/bin/bash
# mkit - simple install helper
# See LICENSE file for copyright and license details.

die() {
    echo "$@" && exit 9
}


#
# Bump size (for vbump_? and release_?)
#
MKIT_BUMPSIZE=${MKIT_BUMPSIZE:-1}

#
# Debug mode (true|false)
#
MKIT_DEBUG=${MKIT_DEBUG:-false}

#
# Default deploy mode for files
#
MKIT_DEFAULT_MODE="644"

#
# Path to MKit dir (where 'include' is)
#
MKIT_DIR=${MKIT_DIR:-$(dirname "$0")}

#
# Dry mode (true|false)
#
# Set to true to not install anything. Implies MKIT_DEBUG.
#
MKIT_DRY=${MKIT_DRY:-false}

#
# Path to mkit.ini
#
MKIT_INI=${MKIT_INI:-mkit.ini}

#
# Limit ini expansion depth
#
# To avoid endless loops, this value is subtracted each
# time ini() expands a reference; when zero is reached,
# no more expansions happen.
#
MKIT_INI_EXPAND=2

#
# Path to MKit local config and temp
#
# Typically hidden in project root, here MKit can
# save its temporary lists.
#
MKIT_LOCAL=${MKIT_LOCAL:-.mkit}

#
# Package name
#
# Used as base for tarball and in some default tokens.
#
MKIT_PROJ_PKGNAME=""

#
# This MKit version
#
MKIT_VERSION=0.0.18


. "$MKIT_DIR/include/mkit.sh" || die "failed to init; check if MKIT_DIR is set properly: $MKIT_DIR"

case "$1" in
    --version-semver) echo "$MKIT_VERSION"; exit 0 ;;
    --version)        echo "Mkit (Simple Makefile target helper) $MKIT_VERSION"
                      exit 0 ;;
esac

mkit_init

route "$@"