log.mk 1.07 KB
Newer Older
1 2 3 4
# 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)

5 6 7 8
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif

9 10 11 12
# 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')

13
ifeq (-,$(shell rpmvercmp $(HSH_VERSION) $(HSH_VER_OPTIMAL) | tr -d '[0-9]'))
14 15 16
$(info warning: hasher-$(HSH_VERSION) is suboptimal, consider upgrading)
endif

17
BUILDLOG ?= $(BUILDDIR)/$(BUILD_LOG)
18

19
# LOG holds a redirecting postprocessor
20
ifdef DEBUG
21 22
# 1) makefile target; 2) also passed to script hooks
GLOBAL_DEBUG := debug
23 24 25 26 27 28 29 30 31 32
GLOBAL_VERBOSE ?= $(DEBUG)
ifeq (2,$(DEBUG))
SHELL += -x
endif
LOG = >>$(BUILDLOG) 2>&1
else
MAKE += -s
LOG = 2>>$(BUILDLOG) >/dev/null
endif

33
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
34
DATE = $(shell date +%Y%m%d)
35
TIME = `date +%H:%M:%S`
36

37
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL