# SPDX-License-Identifier: BSD-2-Clause BEGIN { if(!BUILD_AWK) { print "tmpl-depends.awk: you must set the BUILD_AWK variable" >"/dev/stderr" exit 1 } BAWK = BUILD_AWK " -v BUILD_AWK=\"" BUILD_AWK "\" " } /^@shebang/ {} /^@target/ { TARGET = $2 # FILENAME is a builtin variable containing the name of awk's # current input file print TARGET " : tmpl.awk " FILENAME } /^@include/ { fn = $2 print TARGET " : " fn # When we are trying to find dependencies, image.awk may well not # exist, and in any case it will never @include anything; so avoid # a fatal error by ignoring it. if(fn != "image.awk") { command = BAWK " -f tmpl-depends.awk -v TARGET=\"" TARGET "\" " fn while((command | getline) > 0) print } next }