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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:01:09+00:00 2026-06-08T19:01:09+00:00

Change the environment variable `PATH’ in Makefile does NOT take effect with make in

  • 0

Change the environment variable `PATH’ in Makefile does NOT take effect with make in CLT, and it’s OK with the make util which I compiled from original source.

The simple Makefile

PATH := $(PATH):/opt/bin

export PATH

all:
      @cscope --version

My tests

/tmp $ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin
/tmp $ ls /opt/bin/cscope
/opt/bin/cscope
/tmp $ which make
/usr/bin/make
/tmp $ make
make: cscope: No such file or directory
make: *** [all] Error 1
/tmp $ ./_install/bin/make
cscope: version 15.7a
/tmp $ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


This program built for i386-apple-darwin11.3.0
/tmp $ ./_install/bin/make --version
GNU Make 3.82
Built for x86_64-apple-darwin12.0.0
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Can anyone help?

  • 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-08T19:01:11+00:00Added an answer on June 8, 2026 at 7:01 pm

    You are confusing make variables with shell variables. With your setup, the shell command that gets invoked is not influenced by the make variable PATH that you have set.

    You should set the PATH variable inside your recipe, like in

    all:
        @PATH=$(PATH):/opt/bin; cscope --version
    

    You have to to both on one line because every line in the recipe will be run in another shell, effectively losing the PATH setting that you just did. Or you can divide it over multiple lines by adding a backslash \ at the end of each line:

    all:
        @PATH=$(PATH):/opt/bin; \
        cscope --version
    

    Update

    Sorry, I missed the importance of your makefile working with make 3.82. I tried with both versions and indeed, 3.81 and 3.82 behave differently in this case.

    I did get this to work with 3.81 though by invoking make as follows:

    make SHELL="/bin/sh -c"
    

    or

    make SHELL=/bin/bash
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a command line implementation to change the PATH environment variable
Does VS have an environment variable for the path to the current solution? For
I need to change thw environment variable Environment.GetEnvironmentVariable(TMP) for a Windows service in .NET
I have found out that setting the PATH environment variable affects only the old
Is it possible to make a batch file which can make a persistent change
I had this console application. Now i have added Environment variable PATH to its
After using JDK if I use ruby, I have to change 'PATH' in Environment
When I change the colormap in the MatLab environment to grayscale with the line
My Environment Rails 3.2.1 ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] I want to change
Sometimes when I change my environment variables in Windows, and then use software the

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.