# $Id: brief2.kmk 3121 2017-10-31 10:58:59Z bird $
## @file
# kBuild Message Style - 'brief'
#

#
# Copyright (c) 2007-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
#
# This file is part of kBuild.
#
# kBuild is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# kBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kBuild; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#
# As a special exception you are granted permission to include this file, via
# the kmk include directive, as you wish without this in itself causing the
# resulting makefile, program or whatever to be covered by the GPL license.
# This exception does not however invalidate any other reasons why the makefile,
# program, whatever should not be covered the GPL.
#
#

# Indent the messages, drop the kBuild: prefix, and shorten paths.
ifndef KBUILD_VERBOSE
 ifndef MSG_L1
  MSG_L1 = @$(PRINTF) "  %-7s %s\n" \
	"$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))" \
	"$(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$2))))"
 endif
 ifndef MSG_L1I
  MSG_L1I = @$(PRINTF) "  %-7s %s\n" "$1" "$2"
 endif
else
 MSG_L1 ?= @$(ECHO) "  $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1 $2))))"
 MSG_L1I?= @$(ECHO) "  $1 $2"
 MSG_L2 ?= @$(ECHO) "  $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))"
endif

## Fetch starting.
# @param 1     Target name.
MSG_FETCH    ?= $(call MSG_L1,FTCH,$1...)
## Re-fetch starting.
# @param 1     Target name.
MSG_REFETCH  ?= $(call MSG_L1,RFTCH,$1...)
## Downloading a fetch component.
# @param 1     Target name.
# @param 2     The source URL.
# @param 3     The destination file name.
MSG_FETCH_DL ?= $(call MSG_L1,GET,$1 - $2,=> $3)
## Checking a fetch component.
# @param 1     Target name.
# @param 2     The source URL.
# @param 3     The destination file name.
MSG_FETCH_CHK?= $(call MSG_L1,CHK,$1 - $3, ($2))
## Unpacking a fetch component.
# @param 1     Target name.
# @param 2     The archive file name.
# @param 3     The target directory.
MSG_FETCH_UP ?= $(call MSG_L1,UNPK,$1 - $2,=> $3)
## Fetch completed.
# @param 1     Target name.
MSG_FETCH_OK ?= $(call MSG_L1,DONE,$1)
## Unfetch a fetch target.
# @param 1     Target name.
MSG_UNFETCH  ?= $(call MSG_L1,RM,$1...)
## Compiling a source file.
# @param 1     Target name.
# @param 2     The source filename.
# @param 3     The primary link output file name.
# @param 4     The source type (CXX,C,AS,RC,++).
MSG_COMPILE  ?= $(call MSG_L1,$4,$1 - $2,=> $3)
## Tool
# @param 1     The tool name (bin2c,...)
# @param 2     Target name.
# @param 3     The source filename.
# @param 4     The primary output file name.
MSG_TOOL     ?= $(call MSG_L1,$1,$2 - $3,=> $4)
## Generate a file, typically a source file.
# @param 1     Target name if applicable.
# @param 2     Output file name.
# @param 3     What it's generated from
MSG_GENERATE ?= $(call MSG_L1,GEN,$2)
## Linking a bldprog/dll/program/sysmod target.
# @param 1     Target name.
# @param 2     The primary link output file name.
# @param 3     The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
MSG_LINK     ?= $(call MSG_L1I,$(if $(eq $3,LINK_LIBRARY),AR,LD),$1 => $2,)
## Merging a library into the target (during library linking).
# @param 1     Target name.
# @param 2     The output library name.
# @param 3     The input library name.
MSG_AR_MERGE ?= $(NO_SUCH_VARIABLE)
## Creating a directory (build).
# @param 1     Directory name.
MSG_MKDIR    ?= $(call MSG_L2,DIR,$1)
## Cleaning.
MSG_CLEAN    ?= $(call MSG_L1,CLEAN)
## Nothing.
MSG_NOTHING  ?= $(call MSG_L1,NOTHING $(CURDIR))
## Installing a bldprog/lib/dll/program/sysmod target.
# @param 1     Target name.
# @param 2     The source filename.
# @param 3     The destination file name.
MSG_INST_TRG ?= $(call MSG_L1I,INST,$1 => $3)
## Installing a file (install target).
# @param 1     The source filename.
# @param 2     The destination filename.
MSG_INST_FILE?= $(call MSG_L1I,IFIL,$2,(<= $1))
## Installing a symlink.
# @param 1     Symlink
# @param 2     Link target
MSG_INST_SYM ?= $(call MSG_L1I,ISYM,$1,=> $2)
## Installing a directory.
# @param 1     Directory name.
MSG_INST_DIR ?= $(call MSG_L1I,IDIR,$1)

