How to change PATH for Makefile $(shell...) command?


user 541686

when i run

export PATH := mypath
$(error $(shell echo "$${PATH}"))

Nothing seems to PATHchange for my call shell.

Why is this happening and how do I actually change the PATHfor shellcall?

Florian Weimer

Is this GNU make? There's a long-standing GNU make feature request to use honoring exported variables$(shell …) . This is not specific at all PATH, it affects (or not) all exportvariables.

According to GNU make, this is difficult to achieve:

  /* Using a target environment for 'shell' loses in cases like:
       export var = $(shell echo foobie)
       bad := $(var)
     because target_environment hits a loop trying to expand $(var) to put it
     in the environment.  This is even more confusing when 'var' was not
     explicitly exported, but just appeared in the calling environment.

     See Savannah bug #10593.

  envp = target_environment (NULL);
  */

Related


How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to change the default shell for the at command

Covic It shows me exactly when I want to delay using to execute the programat warning: commands will be executed using /bin/sh How can I change this default shell bashto eg? and Check out this question posted on the Unix & Linux Stack Exchange . The first sen

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to change PATH for Makefile $(shell...) command?

user 541686 when i run export PATH := mypath $(error $(shell echo "$${PATH}")) Nothing seems to PATHchange for my call shell. Why is this happening and how do I actually change the PATHfor shellcall? Florian Weimer Is this GNU make? There's a long-standing GN

How to change PATH in shell script?

Eric Wilson I have several projects that need to change the version of Java/Grails/Maven. I'm trying to handle this with some scripts that can make changes. E.g: #!/bin/sh export JAVA_HOME=/cygdrive/c/dev/Java/jdk1.5.0_22 export PATH=$JAVA_HOME/bin:$PATH expo

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to change PATH in shell script?

Eric Wilson I have several projects that need to change the version of Java/Grails/Maven. I'm trying to handle this with some scripts that can make changes. E.g: #!/bin/sh export JAVA_HOME=/cygdrive/c/dev/Java/jdk1.5.0_22 export PATH=$JAVA_HOME/bin:$PATH expo

How to change the command path

Amarad I have a self-compiled program installed on my computer. Try removing it by deleting all folders and files including binaries located in usr/local/bin/. I reinstalled the program from the Ubuntu stable PPA, so now the binaries are in /usr/bin/. However,

How to pass target stemming to shell command in Makefile

dkn37 I'm writing a static pattern rule to generate a list of dependencies for targets matching the pattern. Dependencies are generated via shell commands (file contents provide information about dependencies). Here is an example of an explicit rule: f1.o: $(s

How to pass target stemming to shell command in Makefile

dkn37 I'm writing a static pattern rule to generate a list of dependencies for targets matching the pattern. Dependencies are generated via shell commands (file contents provide information about dependencies). Here is an example of an explicit rule: f1.o: $(s

How to change the path of vim command

Jack Thomson I have two versions installed on vimmacOS : default version /usr/bin/vim, and MacVim (via Homebrew) /usr/local/bin/vim. When entered vim, the default program will be invoked. I want to use MacVim every time I type vim. Do you know how? Do they bot

How to change PATH in shell script?

Eric Wilson I have several projects that need to change the version of Java/Grails/Maven. I'm trying to fix this with some scripting that can make changes. E.g: #!/bin/sh export JAVA_HOME=/cygdrive/c/dev/Java/jdk1.5.0_22 export PATH=$JAVA_HOME/bin:$PATH expor

How to use echo in shell command in Makefile?

w I have a GNU makefile . It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW it produces: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: line 0: `echo 2.0.4(0.287/5/3) | egrep -i -c "fc22.i686"' Th

How to change the default shell for the at command

Covic It shows me exactly when I want to delay using to execute the programat warning: commands will be executed using /bin/sh How can I change this default shell bashto eg? and Check out this question posted on the Unix & Linux Stack Exchange . The first sen

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to compare two shell command outputs in Makefile?

Kenorb Mine Makefileare: .PHONY: check check: ifneq $(shell echo 123), $(shell echo 123) $(error Not equal) endif When I run, I get the error: $ make Makefile:3: *** Not equal. Stop. However, this should only happen if they a

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to get variables in $(shell) command in Makefile?

red 888 ❯ make --version GNU Make 3.81 ❯ bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18) How can I pass a variable to $(shell) from inside a for loop? I can access the var outside of $(shell), but I don't know how to pass it to A_L

How to change the command path

Amarad I have a self-compiled program installed on my computer. Try removing it by deleting all folders and files including binaries located in usr/local/bin/. I reinstalled the program from the Ubuntu stable PPA, so now the binaries are in /usr/bin/. However,

How to change PATH in shell script?

Eric Wilson I have several projects that need to change the version of Java/Grails/Maven. I'm trying to handle this with some scripts that can make changes. E.g: #!/bin/sh export JAVA_HOME=/cygdrive/c/dev/Java/jdk1.5.0_22 export PATH=$JAVA_HOME/bin:$PATH expo

How to pass target stemming to shell command in Makefile

dkn37 I'm writing a static pattern rule to generate a list of dependencies for targets matching the pattern. Dependencies are generated via shell commands (file contents provide information about dependencies). Here is an example of an explicit rule: f1.o: $(s

How to use echo in shell command in Makefile?

w I have a GNU makefile . It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW it produces: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: line 0: `echo 2.0.4(0.287/5/3) | egrep -i -c "fc22.i686"' Th