1 # -*- mode: makefile;-*-
3 # Copyright (C) 2020 Apple Inc. All rights reserved.
5 # MakeInc.color defines macros used to enable
6 # colored output of the build log.
9 define _setup_build_log_colors
10 ifeq ($${XNU_LOGCOLORS},y)
13 ifeq ($$(LOGCOLORS),y)
14 # Get a nice list of device code names associated with the build platform
16 #ifdef EMBEDDED_DEVICE_MAP
17 # export CDevs := $$(shell $$(EMBEDDED_DEVICE_MAP) -db $$(EDM_DBPATH) -query "SELECT DISTINCT TargetType FROM Targets WHERE KernelPlatform = '$$(CURRENT_MACHINE_CONFIG_LC)'" | tr '[\r\n]' ':' | sed 's,:$$$$,,')
21 export _MACHINE := $$(CURRENT_MACHINE_CONFIG_LC)
22 ifeq ($$(CURRENT_MACHINE_CONFIG),NONE)
23 export _MACHINE := $$(subst OSX,,$$(PLATFORM))
25 export MACHINE_PFX := $$(shell __A="$$(CURRENT_ARCH_CONFIG_LC)"; \
26 __As=$$$$((6-$$$${\#__A})); \
27 printf "%-.6s%*.*s %9.9s" \
29 $$$${__As} $$$${__As} " " \
32 override LOG_PFX_LEN := 30
33 override LOG_PFX_LEN_ADJ := $$(shell __TMP="$$(MACHINE_PFX)"; \
34 printf "%d" $$$$(($$(LOG_PFX_LEN) - $$$${\#__TMP} - 3)))
35 MACHINE_PFX_COL = $$(shell printf "\\033[1m%s\\033[m" "$$(MACHINE_PFX)")
36 # Turn off colored output
37 Color0:=$$(shell printf "\\033[m")
38 # Start a host command: bold text
39 ColorH:=$$(shell printf "\\033[1m")
40 # Start a compilation-related command: blue text
41 ColorC:=$$(shell printf "[$$(MACHINE_PFX_COL)] \\033[1;34m")
42 # Start a MIG command: green text
43 ColorM:=$$(shell printf "[$$(MACHINE_PFX_COL)] \\033[1;32m")
44 # Start a linking command: purple text
45 ColorL:=$$(shell printf "[$$(MACHINE_PFX_COL)] \\033[1;35m")
47 ColorF:=$$(shell printf "")
48 # Start a linked file name: italic text
49 ColorLF:=$$(shell printf "\\033[3m")
50 # Error strings: red text
51 ColorErr:=$$(shell printf "\033[31m")