Why is this regular expression for sed interrupted inside the makefile?

I am using GNU Make 3.81, and I have the following rule in the Makefile:

jslint :
    java org.mozilla.javascript.tools.shell.Main jslint.js mango.js \
    | sed 's/Lint at line \([0-9]\+\) character \([0-9]\+\)/mango.js:\1:\2/'

This works fine if I type it directly on the command line, but the regex doesn't match if I run it using "make jslint". However, it works if I replace \+with \{1,\}in in the Makefile:

jslint :
    java org.mozilla.javascript.tools.shell.Main jslint.js mango.js \
    | sed 's/Lint at line \([0-9]\{1,\}\) character \([0-9]\{1,\}\)/mango.js:\1:\2/'

Is there any special meaning for \+the Makefile, or is this a bug?

+3
source share
1 answer

\+doesn't really matter. Also, there is nothing wrong with GNU Make, I suppose.

The expressions probably coincide even in the first case, but probably the fact is that either

  • make jslnit, jslint . , . , echo , Make got :

    jslint :
        echo I got here
        java org.mozilla.javascript.tools.shell.Main jslint.js mango.js \
        | sed 's/Lint at line \([0-9]\+\) character \([0-9]\+\)/mango.js:\1:\2/'
    
  • java (, ?)

  • ( , . ) , Make ( /bin/sh) ) , ( ), - , . , sed sed , \+ \{1,\}.
+2

Source: https://habr.com/ru/post/1739870/


All Articles