375 $(eval $(call SetupLogging)) |
375 $(eval $(call SetupLogging)) |
376 |
376 |
377 # This is to be called by all SetupFoo macros |
377 # This is to be called by all SetupFoo macros |
378 define LogSetupMacroEntry |
378 define LogSetupMacroEntry |
379 $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk)) |
379 $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk)) |
380 $(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 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) |
380 $(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 26,$(if $(strip $($i)),$(NEWLINE) $(strip [$i] $($i)))))) |
381 endef |
381 endef |
382 |
382 |
383 # Support macro for all SetupFoo macros. |
383 # Support macro for all SetupFoo macros. |
384 define EvalDebugWrapper |
384 define EvalDebugWrapper |
385 $(if $(DEBUG_$1), |
385 $(if $(DEBUG_$1), |
517 $$($$(strip $4)) |
517 $$($$(strip $4)) |
518 |
518 |
519 $3 += $2 |
519 $3 += $2 |
520 endef |
520 endef |
521 |
521 |
|
522 # Setup make rules for copying files, with an option to do more complex |
|
523 # processing instead of copying. |
|
524 # |
|
525 # Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
526 # and the targets generated are listed in a variable by that name. |
|
527 # |
|
528 # Remaining parameters are named arguments. These include: |
|
529 # SRC : Source root dir (defaults to dir of first file) |
|
530 # DEST : Dest root dir |
|
531 # FILES : List of files to copy with absolute paths, or path relative to SRC. |
|
532 # Must be in SRC. |
|
533 # FLATTEN : Set to flatten the directory structure in the DEST dir. |
|
534 # MACRO : Optionally override the default macro used for making the copy. |
|
535 # Default is 'install-file' |
|
536 |
522 define SetupCopyFiles |
537 define SetupCopyFiles |
523 # param 1 is for example COPY_MYFILES |
538 $(if $(16),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk)) |
524 # param 2,3,4,5 are named args. |
539 $(call EvalDebugWrapper,$(strip $1),$(call SetupCopyFilesInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))) |
525 # SRC : Source root dir (defaults to dir of first file) |
540 endef |
526 # DEST : Dest root dir |
541 |
527 # FILES : List of files to copy with absolute paths, or path relative to SRC. |
542 define SetupCopyFilesInner |
528 # Must be in SRC. |
543 $(foreach i,2 3 4 5 6, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE)) |
529 # FLATTEN : Set to flatten the directory structure in the DEST dir. |
|
530 # MACRO : Optionally override the default macro used for making the copy. |
|
531 # Default is 'install-file' |
|
532 $(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE)) |
|
533 $(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6) |
544 $(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6) |
534 $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles)) |
545 $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk)) |
535 |
546 |
536 ifeq ($$($1_MACRO), ) |
547 ifeq ($$($1_MACRO), ) |
537 $1_MACRO := install-file |
548 $1_MACRO := install-file |
538 endif |
549 endif |
539 |
550 |