automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ylwrap removes too many directories from output


From: Nikolai Weibull
Subject: ylwrap removes too many directories from output
Date: Thu, 10 May 2012 14:03:57 +0200

Hi!

If Automake is used in non-recursive mode and one of the inputs is a
yacc file, for example, src/grammar.y, ylwrap will remove too many
directories from the output file when it adjusts the paths in it.
This results in #line directives referring to grammar.y instead of
src/grammar.y.

This is a result of input_rx simply taking all the directory
components of the absolute input path and removing them.

One solution is to store the path passed to ylwrap and replace input_rx with it:

--- build/ylwrap.old    2012-05-10 13:59:19.495291713 +0200
+++ build/ylwrap        2012-05-10 13:59:24.579351693 +0200
@@ -67,6 +67,8 @@
 # The input.
 input="$1"
 shift
+input_orgdir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
+input_sub=`echo "$input_orgdir" | sed 's,\\\\,\\\\\\\\,g'`
 case "$input" in
   [\\/]* | ?:[\\/]*)
     # Absolute path; do nothing.
@@ -175,7 +177,7 @@
             -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
             -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`

-      sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
+      sed -e "/^#/!b" -e "s,$input_rx,$input_sub," -e "s,$from,$2," \
           -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?

       # Check whether header files must be updated.

I’m sure that there’s a much better way of doing this, but this seems to work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]