Re: make and PATH



Anders Christensen wrote:
Hi NG,

I have a problem with paths together with make.

I'd like my Makefile to execute a program in a specific working
directory.
My rule looks something like this
%.in %.out:
cd $(dir $*.in) && \
myprogram.exe $(notdir $*.in)

My test target looks something like this
test: wanted\path\mytarget.out wanted2\path2\mytarget2.out
wanted3\path3\mytarget3.out

For some reason myprogram.exe is unknown and I get this output when
running make:
cd wanted\path\ && \
myprogram.exe mytarget.in
'myprogram.exe' is not recognized as an internal or external command,
operable program or batch file.
make: *** [wanted\path\mytarget.out] Error 1

The path to myprogram.exe is in my PATH variable and I have no problem
running it if I manually navigate to wanted\path\ to execute it.

The strange thing is that there's no error if I change the Makefile to
%.IN %.OUT:
cd $(dir $*.IN)
myprogram.exe $(notdir $*.IN)

...but then the working directory for myprogram.exe is not wanted\path
\ as I want it to be.

What could be the problem? I'd appreciate any hint!

change the rule temporarily to run bash and check to see what is going on:

%.out : %.in
cd $(dir $*.in) && \
echo myprogram.exe $(notdir $*.in) ; bash

This will print the command and start a shell. You can then examine why it's not finding your exe.

What I normally do is put the entire path to the executable

MYPROGRAM=/usr/bin/myprogram

and then I use $(MYPROGRAM)



.



Relevant Pages

  • make and PATH
    ... I'd like my Makefile to execute a program in a specific working ... myprogram.exe $(notdir $*.in) ... My test target looks something like this ... The strange thing is that there's no error if I change the Makefile to ...
    (comp.unix.programmer)
  • Re: MAKEFILE - only the first command ever works
    ... Still not sure about how to execute a batch command though.... ... switch into project B's directory, execute its makefile, copy its output back ... %userprofile%\Visual Studio Projects\MyComponent1 ...
    (microsoft.public.vc.language)
  • Re: MAKEFILE - only the first command ever works
    ... Still not sure about how to execute a batch command though.... ... switch into project B's directory, execute its makefile, copy its output back ... %userprofile%\Visual Studio Projects\MyComponent1 ...
    (microsoft.public.win32.programmer.tools)
  • Re: Executing an external program.
    ... I will have to start looking at the debugging facilities. ... advice as to where I am going wrong ... to do is to execute the external command. ...
    (comp.lang.perl.tk)
  • Re: writing to a partition
    ... I'm not sure but I think the various labels in the Makefile ending ... When I simply imitate what the Makefile says, I execute: ... but gcc can't make sense of disk.o. ... the lilo boot process in a terminal window? ...
    (comp.os.linux.misc)