Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:50:48+00:00 2026-05-25T12:50:48+00:00

In my Makefile, I need to test if the current directory is an SVN

  • 0

In my Makefile, I need to test if the current directory is an SVN repo or not and if it is not I want to indicate an error using the $(error) directive in Makefile.

So I plan to use the return value of $(shell svn info .) but I’m not sure how to get this value from within the Makefile.

Note: I’m not trying to get the return value in a recipe, but rather in the middle of the Makefile.

Right now I’m doing something like this, which works just because stdout is blank when it is an error:

SVN_INFO := $(shell svn info . 2> /dev/null)
ifeq ($(SVN_INFO),)
    $(error "Not an SVN repo...")
endif

I’d still like to find out if it is possible to get the return value instead within the Makefile.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:50:48+00:00Added an answer on May 25, 2026 at 12:50 pm

    This worked fine for me – based on @eriktous’ answer with a minor modification of redirecting stdout as well to skip the output from svn info on a valid svn repo.

    SVN_INFO := $(shell svn info . 1>&2 2> /dev/null; echo $$?)
    ifneq ($(SVN_INFO),0)
        $(error "Not an SVN repo...")
    endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use a Makefile to run individual test files or a combined
I want to write a Makefile which would run tests. Test are in a
I have both a target test in my Makefile and a directory called test
CONTEXT: I want to use an OS 10.6.8 system to test some patches to
I need to detect whether my Makefile is running under valgrind (indirectly, using valgrind
I need a little nmake makefile for my build process. The file types are
I need to create a special makefile rule, which is best explained by an
I need to put the xcodeprojfile in the same dir as the Makefile for
I have a makefile for compiling Arduino programs . I need to add some
I need to have a makefile work under Windows and Cygwin. I having problems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.