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 8873827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:33:44+00:00 2026-06-14T18:33:44+00:00

How can I strip leading whitespace from parameters passed to user defined functions with

  • 0

How can I strip leading whitespace from parameters passed to user defined functions with gnu-make?

For example:

define FOO
# --- some build rules

# run the built target
/home/user/dir/bin/$(1)

endef

The following call works correctly, since there is no leading whitespace:

$(eval $(call FOO,my_test ) )

Unfortunately the following fails, because $(1) has a leadning space

$(eval $(call FOO, my_test ) )
                  ^
                Additional space to 'prettier' formatting

this ends up expanding to:

/home/user/dir/bin/ $(1)
                   ^
                 Leading whitespace

How can I strip leading whitespace from arguments passed to user defined functions?

Is it bad form to do this or should I simply assume that arguments are passed without leading whitespace?

  • 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-06-14T18:33:45+00:00Added an answer on June 14, 2026 at 6:33 pm

    Use the strip function:

    define FOO
    # ...
    /home/user/dir/bin/$(strip $(1))
    endef
    

    For details, see Text Functions. Because of this, and to avoid using strip everywhere, it is best to avoid spaces after commas when passing arguments to functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best method to strip html tags from the input? How can
In Python, we can use the .strip() method of a string to remove leading
Possible Duplicate: Strip Leading and Trailing Spaces From Java String When I import data
In Python, I can strip white-spaces, new lines or random characters from strings like
I would like to strip the leading slash and the querystring from a URL
How can i strip <h1>including this content</h1> I know you can use strip tags
I am using php to output some rich text. How can I strip out
Can anyone get me with the regular expression to strip multiline comments and single
I'm new to using regexp, can someone give me the regexp that will strip
I want to make a scrip through which i can grab the visitors cookis

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.