[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Quoting shell command lines in Makefiles



Further Reading of The Fine Manual reveals that that way to quote $ in a makefile is to say "$$":

test: testexec
	for test in $(TESTS); do ./$$test ; done

I'm using CPPUnit (http://cppunit.sourceforge.net/cppunit-wiki) to make
unit tests for each class in my C++ program.  I can say "make test" to
have them all built and executed.
...
I thought I'd be clever and use the shell "for" control construct to
execute all the tests that are named in $(TESTS) rather than listing
them explicitly.  But it doesn't work because make sees the $ and
expands it before passing the command line to the shell:

test: testexec
        for test in $(TESTS); do ./$test; done

--
Mike Crawford
crawford@goingware.com

   Read "GoingWare's Bag of Programming Tricks" at:



Reply to: