WilliamKF
WilliamKF

Reputation: 43149

Tricky makefile syntax with quotes

I have the following start on a makefile rule (thanks to help from others), but it doesn't quite work yet:

test_svn_version:
    @if [ $$(svn --version --quiet \ 
            perl -ne '@a=split(/\./); \
                      print $$a[0]*10000 + $$a[1]*100 + $$a[2]') \
          -lt 10600 ]; \
    then \
        echo >&2 "Svn version $$(svn --version --quiet) too old; upgrade to v1.6";
        false; \
    fi

It seems the single quote in the conditional is unmatched.

Please help correct the syntax. I've tried many variants, but none seem correct.

Thanks.

-William

Upvotes: 0

Views: 1309

Answers (1)

John Kugelman
John Kugelman

Reputation: 361645

You're missing a pipe | between svn and perl, and you're missing a backslash \ after the echo. This works for me:

test_svn_version:
    @if [ $$(svn --version --quiet | \
             perl -ne '@a=split(/\./); \
                       print $$a[0]*10000 + $$a[1]*100 + $$a[2]') \
          -lt 10600 ]; \
    then \
        echo >&2 "Svn version $$(svn --version --quiet) too old; upgrade to v1.6"; \
        false; \
    fi

Upvotes: 2

Related Questions