1# -*- mode: makefile;-*- 2# 3# Copyright (C) 2020 Apple Inc. All rights reserved. 4# 5# MakeInc.color defines macros used to enable 6# colored output of the build log. 7# 8 9define _setup_build_log_colors 10ifeq ($${XNU_LOGCOLORS},y) 11 LOGCOLORS ?= y 12endif 13ifeq ($$(LOGCOLORS),y) 14 # Get a nice list of device code names associated with the build platform 15 ifndef CDevs 16 #ifdef EMBEDDED_DEVICE_MAP 17 # export CDevs := $$(shell $$(EMBEDDED_DEVICE_MAP) -db $$(EDM_DBPATH) -list -query "SELECT DISTINCT TargetType FROM Targets WHERE KernelPlatform = '$$(CURRENT_MACHINE_CONFIG_LC)'" | tr '[\r\n]' ':' | sed 's,:$$$$,,') 18 #endif 19 endif 20 ifndef MACHINE_PFX 21 export _MACHINE := $$(CURRENT_MACHINE_CONFIG_LC) 22 ifeq ($$(CURRENT_MACHINE_CONFIG),NONE) 23 export _MACHINE := $$(subst OSX,,$$(PLATFORM)) 24 endif 25 export MACHINE_PFX := $$(shell __A="$$(CURRENT_ARCH_CONFIG_LC)"; \ 26 __As=$$$$((6-$$$${\#__A})); \ 27 printf "%-.6s%*.*s %9.9s" \ 28 "$$$${__A}" \ 29 $$$${__As} $$$${__As} " " \ 30 "$$(_MACHINE)") 31 endif 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") 46 # Start a filename 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") 52endif 53endef 54 55# vim: set ft=make: 56