common/makefiles/MakeBase.gmk

changeset 673
2ef28c12d649
parent 670
3b8ffb80db0f
child 725
03e60e87d92a
equal deleted inserted replaced
672:2f43964043c2 673:2ef28c12d649
326 $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\ 326 $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\
327 $(ECHO) $1/$(HGTIP_FILENAME) 327 $(ECHO) $1/$(HGTIP_FILENAME)
328 endef 328 endef
329 329
330 define SetupLogging 330 define SetupLogging
331 ifeq ($$(LOG), trace) 331 ifeq ($$(LOG_LEVEL),trace)
332 # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make 332 # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
333 # For each target executed, will print 333 # For each target executed, will print
334 # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer) 334 # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
335 # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin). 335 # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin).
336 OLD_SHELL:=$$(SHELL) 336 OLD_SHELL:=$$(SHELL)
337 WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL) 337 WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
338 SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) 338 SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
339 endif 339 endif
340 # Never remove warning messages; this is just for completeness 340 # Never remove warning messages; this is just for completeness
341 LOG_WARN= 341 LOG_WARN=
342 ifneq ($$(findstring $$(LOG),info debug trace),) 342 ifneq ($$(findstring $$(LOG_LEVEL),info debug trace),)
343 LOG_INFO= 343 LOG_INFO=
344 else 344 else
345 LOG_INFO=> /dev/null 345 LOG_INFO=> /dev/null
346 endif 346 endif
347 ifneq ($$(findstring $$(LOG),debug trace),) 347 ifneq ($$(findstring $$(LOG_LEVEL),debug trace),)
348 LOG_DEBUG= 348 LOG_DEBUG=
349 else 349 else
350 LOG_DEBUG=> /dev/null 350 LOG_DEBUG=> /dev/null
351 endif 351 endif
352 ifneq ($$(findstring $$(LOG),trace),) 352 ifneq ($$(findstring $$(LOG_LEVEL),trace),)
353 LOG_TRACE= 353 LOG_TRACE=
354 else 354 else
355 LOG_TRACE=> /dev/null 355 LOG_TRACE=> /dev/null
356 endif 356 endif
357 endef 357 endef
360 $(eval $(call SetupLogging)) 360 $(eval $(call SetupLogging))
361 361
362 # This is to be called by all SetupFoo macros 362 # This is to be called by all SetupFoo macros
363 define LogSetupMacroEntry 363 define LogSetupMacroEntry
364 $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk)) 364 $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
365 $(if $(findstring $(LOG),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) 365 $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
366 endef 366 endef
367 367
368 # Make directory without forking mkdir if not needed 368 # Make directory without forking mkdir if not needed
369 define MakeDir 369 define MakeDir
370 ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)) 370 ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))

mercurial