log.mk 765 Bytes
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
BUILDLOG ?= $(BUILDDIR)/build.log

Michael Shigorin's avatar
Michael Shigorin committed
11
# LOG holds a postprocessor
12
ifdef DEBUG
13 14
# 1) makefile target; 2) also passed to script hooks
GLOBAL_DEBUG := debug
15 16 17 18 19 20 21 22 23 24
GLOBAL_VERBOSE ?= $(DEBUG)
ifeq (2,$(DEBUG))
SHELL += -x
endif
LOG = >>$(BUILDLOG) 2>&1
else
MAKE += -s
LOG = 2>>$(BUILDLOG) >/dev/null
endif

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

29
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL