162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci# 'info' prints the argument to stdout.
462306a36Sopenharmony_ci$(info,hello world 0)
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci# 'warning-if', if the first argument is y, sends the second argument to stderr,
762306a36Sopenharmony_ci# and the message is prefixed with the current file name and line number.
862306a36Sopenharmony_ci$(warning-if,y,hello world 1)
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci# 'error-if' is similar, but it terminates the parsing immediately.
1162306a36Sopenharmony_ci# The following is just no-op since the first argument is not y.
1262306a36Sopenharmony_ci$(error-if,n,this should not be printed)
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci# Shorthand
1562306a36Sopenharmony_ciwarning = $(warning-if,y,$(1))
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci# 'shell' executes a command, and returns its stdout.
1862306a36Sopenharmony_ci$(warning,$(shell,echo hello world 3))
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci# Every newline in the output is replaced with a space,
2162306a36Sopenharmony_ci# but any trailing newlines are deleted.
2262306a36Sopenharmony_ci$(warning,$(shell,printf 'hello\nworld\n\n4\n\n\n'))
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci# 'filename' is expanded to the currently parsed file name,
2562306a36Sopenharmony_ci# 'lineno' to the line number.
2662306a36Sopenharmony_ci$(warning,filename=$(filename))
2762306a36Sopenharmony_ci$(warning,lineno=$(lineno))
28