2011-05-11 23:40:47 +04:00
# simple logging switch inspired by netch@'s advice:
# you can add plain $(LOG) to a rule recipe line to moderate it
# (logfile is automatically truncated during profile/init)
2022-11-23 12:39:50 +07:00
i f e q ( , $( MKIMAGE_PROFILES ) )
2011-10-06 11:46:31 +03:00
$( error this makefile is designed to be included in toplevel one )
e n d i f
2012-04-03 16:26:25 +03:00
# 1.3.22 fixes http://bugzilla.altlinux.org/26217
HSH_VER_OPTIMAL = 1.3.22
HSH_VERSION := $( shell hsh -V | sed -n 's/^.* version \([0-9.]\+\).*$$/\1/p' )
2012-11-29 15:52:43 +04:00
i f e q ( - , $( shell rpmvercmp $ ( HSH_VERSION ) $ ( HSH_VER_OPTIMAL ) | tr -d '[0-9]') )
2012-04-03 16:26:25 +03:00
$(info warning : hasher -$( HSH_VERSION ) is suboptimal , consider upgrading )
e n d i f
2012-04-18 22:22:29 +03:00
BUILDLOG ?= $( BUILDDIR) /$( BUILD_LOG)
2011-05-11 23:40:47 +04:00
2011-12-30 12:46:58 +02:00
# LOG holds a redirecting postprocessor
2022-11-23 12:39:50 +07:00
i f n e q ( , $( DEBUG ) )
2011-08-15 23:30:20 +03:00
# 1) makefile target; 2) also passed to script hooks
GLOBAL_DEBUG := debug
2011-05-11 23:40:47 +04:00
GLOBAL_VERBOSE ?= $( DEBUG)
i f e q ( 2 , $( DEBUG ) )
SHELL += -x
e n d i f
LOG = >>$( BUILDLOG) 2>& 1
2022-04-10 13:37:46 +07:00
LOG_STDERR = 2> >( tee -a $( BUILDLOG) >& 2) 1>>$( BUILDLOG)
2011-05-11 23:40:47 +04:00
e l s e
MAKE += -s
LOG = 2>>$( BUILDLOG) >/dev/null
2022-04-10 13:37:46 +07:00
LOG_STDERR = 2> >( tee -a $( BUILDLOG) >& 2) 1>/dev/null
2011-05-11 23:40:47 +04:00
e n d i f
2021-06-22 21:19:03 +07:00
i f e q ( , $( filter -out $ ( DIRECT_TARGETS ) ,$ ( MAKECMDGOALS ) ) )
LOG = >/dev/null 2>& 1
e n d i f
2011-11-04 13:26:31 +02:00
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
2011-07-15 00:00:46 +03:00
DATE = $( shell date +%Y%m%d)
2011-11-04 13:26:31 +02:00
TIME = ` date +%H:%M:%S`
2011-07-15 00:00:46 +03:00
2011-11-04 16:51:11 +02:00
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL