Since automake/autoconf are responsible for generating Makefiles, we could add 
something like:

val.%:
        @$(if $(filter undefined,$(origin $*)),\
                echo "$* undefined" >&2, \
                echo '$(subst ','"'"',$($*))' \
        )

var.%:
        @$(if $(filter undefined,$(origin $*)),\
                echo "$* undefined" >&2, \
                echo "$*='"'$(subst ','"'\"'\"'"',$($*))'"'" \
        )

toward the bottom.  Then if we found a line matching /\$(\([^)]+\))/ then we 
could look up “val.\1” from the match, and substitute that back in.  Obviously 
the more matches, the more iterations and the more “make -s val.\1” lookups.  
But at least it would work.

If we used a Perl helper, we could find ALL of the matches, and do ALL of the 
lookups at once in make for more constant time, since we’d do one make process 
per line regardless of how many substitutions were required.




Reply via email to