I'm new to make and Makefiles, but I'm trying to create one for my next project and I'm running into PATH issues. I keep getting the error: "No such file or directory"
I've created a simple target called test that runs all my tests using mocha.
Mocha is installed as a local node module, so its executable can be found at ./node_modules/.bin/mocha. I'm altering my PATH as described in this make tutorial so I can refer to it as mocha instead of typing the full path, but something doesn't seem to be working.
Here's what I have so far:
export PATH := node_modules/.bin:$(PATH) test: which mocha mocha .PHONY: test When I run make test I get the following output:
which mocha node_modules/.bin/mocha mocha make: mocha: No such file or directory make: *** [test] Error 1 As you can see from the output, which mocha is correctly printing the path to the mocha executable, but when I simply run mocha, it can't find it.
What am I doing wrong? Is there bigger picture about variable scope or persistence in Makefiles that I'm missing?
P.S. If it's important, I'm using a Mac and the version of make that comes with the XCode developer tools. This is what I get when I run make -v
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
export PATH := node_modules/.bin:$(PATH)and run make like this : $ PATH=node_modules/.bin:$PATH make test Is it working ?