2f307ffffb
The former toplevel Makefile is now toplevel main.mk; this change allows for multi-target, multi-arch processing in the current toplevel Makefile. As the "build" symlink semantics change quite considerably when one is doing bulk builds (several pruned builddirs might be useful for comparison), BUILDDIR is now much more likely to be recreated: the cases when it will persist are when it's either a single-image build or when the prefix hasn't changed. There are some more or less subtle bugfixes and enhancements all over the map as well. Done within 20111230..20120102 timeframe, actually...
39 lines
1022 B
Makefile
39 lines
1022 B
Makefile
# 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)
|
|
|
|
ifndef MKIMAGE_PROFILES
|
|
$(error this makefile is designed to be included in toplevel one)
|
|
endif
|
|
|
|
BUILDLOG ?= $(BUILDDIR)/build.log
|
|
|
|
# LOG holds a redirecting postprocessor
|
|
ifdef DEBUG
|
|
# 1) makefile target; 2) also passed to script hooks
|
|
GLOBAL_DEBUG := debug
|
|
GLOBAL_VERBOSE ?= $(DEBUG)
|
|
ifeq (2,$(DEBUG))
|
|
SHELL += -x
|
|
endif
|
|
LOG = >>$(BUILDLOG) 2>&1
|
|
else
|
|
MAKE += -s
|
|
LOG = 2>>$(BUILDLOG) >/dev/null
|
|
endif
|
|
|
|
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
|
|
DATE = $(shell date +%Y%m%d)
|
|
TIME = `date +%H:%M:%S`
|
|
|
|
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
|
|
|
|
# brevity postprocessor; not exported, for toplevel use only
|
|
SHORTEN = $(shell \
|
|
echo -n "| sed"; \
|
|
if [ -s "$(SYMLINK)" ]; then \
|
|
echo -n " -e 's,$(BUILDDIR),$(SYMLINK),'"; \
|
|
fi; \
|
|
echo -n " -e 's,$(TMP),\$$TMP,' -e 's,$(HOME),~,'"; \
|
|
)
|