1*9ba83ac0SJeremy L Thompson# Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors. 25aed82e4SJeremy L Thompson# All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3777ff853SJeremy L Thompson# 45aed82e4SJeremy L Thompson# SPDX-License-Identifier: BSD-2-Clause 5777ff853SJeremy L Thompson# 65aed82e4SJeremy L Thompson# This file is part of CEED: http://github.com/ceed 7777ff853SJeremy L Thompson 8777ff853SJeremy L Thompson# Output using the 216-color rules mode 9777ff853SJeremy L Thompsonrule_file = $(notdir $(1)) 10777ff853SJeremy L Thompsonrule_path = $(patsubst %/,%,$(dir $(1))) 11777ff853SJeremy L Thompsonlast_path = $(notdir $(patsubst %/,%,$(dir $(1)))) 12777ff853SJeremy L Thompsonansicolor = $(shell echo $(call last_path,$(1)) | cksum | cut -b1-2 | xargs -IS expr 2 \* S + 17) 13777ff853SJeremy L Thompsonemacs_out = @printf " %10s %s/%s\n" $(1) $(call rule_path,$(2)) $(call rule_file,$(2)) 14777ff853SJeremy L Thompsoncolor_out = @if [ -t 1 ]; then \ 15777ff853SJeremy L Thompson printf " %10s \033[38;5;%d;1m%s\033[m/%s\n" \ 16777ff853SJeremy L Thompson $(1) $(call ansicolor,$(2)) \ 17777ff853SJeremy L Thompson $(call rule_path,$(2)) $(call rule_file,$(2)); else \ 18777ff853SJeremy L Thompson printf " %10s %s\n" $(1) $(2); fi 19777ff853SJeremy L Thompson# if TERM=dumb, use it, otherwise switch to the term one 20777ff853SJeremy L Thompsonoutput = $(if $(TERM:dumb=),$(call color_out,$1,$2),$(call emacs_out,$1,$2)) 21777ff853SJeremy L Thompson 22777ff853SJeremy L Thompson# if V is set to non-nil, turn the verbose mode 23777ff853SJeremy L Thompsonquiet = $(if $(V),$($(1)),$(call output,$1,$@);$($(1))) 246b5c14f7SJed Brown 256b5c14f7SJed Brown# make-4.3 allows string literals like "#include" in variables, but older versions need "\#include". Specifically, the following code: 266b5c14f7SJed Brown# 276b5c14f7SJed Brown# X := $(shell echo "#foo") 286b5c14f7SJed Brown# 296b5c14f7SJed Brown# works with make-4.3, but fails with previous versions: 306b5c14f7SJed Brown# 316b5c14f7SJed Brown# Makefile:1: *** unterminated call to function 'shell': missing ')'. Stop. 326b5c14f7SJed Brown# 336b5c14f7SJed Brown# Older versions work if you spell it "\#foo", but 4.3 will include the backslash. We define $(HASH), which works consistently across versions. 346b5c14f7SJed BrownHASH := \# 35