############################################################################### # # make fast target # # Copyright (C) Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # ############################################################################### .PHONY: fast fast_print fast_print_save_log # use $(_@) to hide echo commands etc (can be overriden if needed) # don't use $(_@) or $(_@) to hide real build commands -s will hide these commands _@=@ ifndef CAFE_MAKE_JOBS export CAFE_MAKE_JOBS=$(shell echo $$(($(NUMBER_OF_PROCESSORS)*4))) endif ifndef IN_FAST_BUILD define DO_FAST_BUILD $(info ------------------------------------------------------------------) $(_@) echo make $@ with $(CAFE_MAKE_JOBS) jobs: $(CURDIR) ; \ export IN_FAST_BUILD=1; \ _BUILD_START=`date +%s` ; \ $(MAKE) $(_SILENT) -j $$CAFE_MAKE_JOBS $(_TARGET) 2>&1 | tee .make_fast.txt ; \ MAKE_FAST_RESULT=$$PIPESTATUS ; \ $(CAFE_ROOT)/system/src/build/make/check_build_errors.sh .make_fast.txt ; \ _BUILD_TIME=$$((`date +%s`-$${_BUILD_START})) ; \ printf "make $(CURDIR) $(BUILD_TYPE) $(_TARGET) build time %01d:%02d:%02d $(CAFE_MAKE_JOBS) jobs.\n" $$(($${_BUILD_TIME}/3600)) $$(($$(($${_BUILD_TIME}%3600))/60)) $$(($${_BUILD_TIME}%60)) >> .make_fast.txt ; \ printf "make $(CURDIR) $(BUILD_TYPE) $(_TARGET) build time %01d:%02d:%02d $(CAFE_MAKE_JOBS) jobs.\n" $$(($${_BUILD_TIME}/3600)) $$(($$(($${_BUILD_TIME}%3600))/60)) $$(($${_BUILD_TIME}%60)) ; \ exit $$MAKE_FAST_RESULT endef else define DO_FAST_BUILD @echo -e "**** RECURSIVE MAKE FAST ****\nmake $@ with $(CAFE_MAKE_JOBS) jobs: $(CURDIR)" +$(_@)export IN_FAST_BUILD=1; \ _BUILD_START=`date +%s` ; \ $(MAKE) $(_SILENT) -j $$CAFE_MAKE_JOBS $(_TARGET) ; \ MAKE_FAST_RESULT=$$PIPESTATUS ; \ _BUILD_TIME=$$((`date +%s`-$${_BUILD_START})) ; \ printf "**** RECURSIVE MAKE FAST ****\nmake $(CURDIR) $(BUILD_TYPE) $(_TARGET) build time %01d:%02d:%02d\n" $$(($${_BUILD_TIME}/3600)) $$(($$(($${_BUILD_TIME}%3600))/60)) $$(($${_BUILD_TIME}%60)) ; \ exit $$MAKE_FAST_RESULT endef endif fast_print: _SILENT = _@= fast_print: _TARGET = default fast_print: $(DO_FAST_BUILD) # usage fast_target to call a parallel build "fast_print" # on a differnt target than default Write it like: # # cos: _TARGET = install_cos # cos: fast_target fast_target: _SILENT = _@= fast_target: $(DO_FAST_BUILD) fast: _SILENT = -s _@=@ fast: _TARGET = default fast: $(DO_FAST_BUILD) # For backwards compatibility: fast_print_save_log: fast_print mv -f .make_fast.txt make_fast_print_save_log.txt