commit f62b5eaacdb7adcbea14b55478a25d15f5073ffa
parent 58e331efae8389822915104c44d1d5190ff91cc7
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Wed, 25 Jun 2014 13:06:56 +0200
print dependencies in aat.awk
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/bin/aat.awk b/bin/aat.awk
@@ -27,9 +27,21 @@ function token(content) {
tok_n, type_names[tok_type], tok_contents[tok_n] >"/dev/stderr"
}
+# Print file dependencies for makefile usage
+function print_dep(str) {
+ if ("AAT_DEP" in ENVIRON) {
+ print str >>ENVIRON["AAT_DEP"]
+ } else {
+ print str >>"/dev/stderr"
+ }
+}
+
function call_macro(name, args) {
# Macro to recursively parse another template
if(name == "include"){
+ # TODO: resolve relative filenames
+ # TODO: include search path
+ print_dep(args)
while(getline <args) {
parse_line($0)
}
@@ -37,6 +49,7 @@ function call_macro(name, args) {
# Macro to insert another file as verbatim code
else if(name == "awk"){
+ print_dep(args)
tok_type=T_AWK
while(getline <args) {
token($0 "\n")
@@ -45,6 +58,7 @@ function call_macro(name, args) {
# Macro to insert another file as text
else if(name == "text"){
+ print_dep(args)
tok_type=T_TEXT
while(getline <args) {
token($0 "\n")