xref: /libCEED/common.mk (revision 777ff853944a0dbc06f7f09486fdf4674828e728)
1*777ff853SJeremy L Thompson# Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*777ff853SJeremy L Thompson# Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*777ff853SJeremy L Thompson# All Rights reserved. See files LICENSE and NOTICE for details.
4*777ff853SJeremy L Thompson#
5*777ff853SJeremy L Thompson# This file is part of CEED, a collection of benchmarks, miniapps, software
6*777ff853SJeremy L Thompson# libraries and APIs for efficient high-order finite element and spectral
7*777ff853SJeremy L Thompson# element discretizations for exascale applications. For more information and
8*777ff853SJeremy L Thompson# source code availability see http://github.com/ceed.
9*777ff853SJeremy L Thompson#
10*777ff853SJeremy L Thompson# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*777ff853SJeremy L Thompson# a collaborative effort of two U.S. Department of Energy organizations (Office
12*777ff853SJeremy L Thompson# of Science and the National Nuclear Security Administration) responsible for
13*777ff853SJeremy L Thompson# the planning and preparation of a capable exascale ecosystem, including
14*777ff853SJeremy L Thompson# software, applications, hardware, advanced system engineering and early
15*777ff853SJeremy L Thompson# testbed platforms, in support of the nation's exascale computing imperative.
16*777ff853SJeremy L Thompson
17*777ff853SJeremy L Thompson# Output using the 216-color rules mode
18*777ff853SJeremy L Thompsonrule_file = $(notdir $(1))
19*777ff853SJeremy L Thompsonrule_path = $(patsubst %/,%,$(dir $(1)))
20*777ff853SJeremy L Thompsonlast_path = $(notdir $(patsubst %/,%,$(dir $(1))))
21*777ff853SJeremy L Thompsonansicolor = $(shell echo $(call last_path,$(1)) | cksum | cut -b1-2 | xargs -IS expr 2 \* S + 17)
22*777ff853SJeremy L Thompsonemacs_out = @printf "  %10s %s/%s\n" $(1) $(call rule_path,$(2)) $(call rule_file,$(2))
23*777ff853SJeremy L Thompsoncolor_out = @if [ -t 1 ]; then \
24*777ff853SJeremy L Thompson				printf "  %10s \033[38;5;%d;1m%s\033[m/%s\n" \
25*777ff853SJeremy L Thompson					$(1) $(call ansicolor,$(2)) \
26*777ff853SJeremy L Thompson					$(call rule_path,$(2)) $(call rule_file,$(2)); else \
27*777ff853SJeremy L Thompson				printf "  %10s %s\n" $(1) $(2); fi
28*777ff853SJeremy L Thompson# if TERM=dumb, use it, otherwise switch to the term one
29*777ff853SJeremy L Thompsonoutput = $(if $(TERM:dumb=),$(call color_out,$1,$2),$(call emacs_out,$1,$2))
30*777ff853SJeremy L Thompson
31*777ff853SJeremy L Thompson# if V is set to non-nil, turn the verbose mode
32*777ff853SJeremy L Thompsonquiet = $(if $(V),$($(1)),$(call output,$1,$@);$($(1)))
33