[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Odd effects from setting SHELL?
From: |
Philip Guenther |
Subject: |
Re: Odd effects from setting SHELL? |
Date: |
Thu, 21 Jun 2007 14:43:05 -0600 |
On 6/21/07, Christian Convey <address@hidden> wrote:
...
When I just do this:
cd /lib_foo; make all
everything works just fine.
But when I do *this*:
cd /lib_foo; make SHELL=/bin/csh all
things *don't* work fine:
This is, in general, a Bad Idea. Makefiles should always be written
with /bin/sh syntax for portability and avoid the limitations in csh
syntax. (For example, a makefile rule written in csh can't loop using
csh's 'foreach', as that requires a real newline. sh's 'for' doesn't
have that problem.)
The "%.o: %.cpp" rule in make_lib.mk invokes gcc. When I don't
explicitly set SHELL, gcc's current working directory is /src/lib_foo
(which is what I want.) When I *do* set SHELL, gcc's working
directory is my home directory, /home/cjc/. gcc is then unable to
find the source code files, and fails.
Your .cshrc (or .tcshrc) is doing 'cd $HOME' or just 'cd'. "Don't do that".
P.S. The reason I'm setting SHELL at all is that some of the commands
within the makefiles need to redirect both stdout and stderr to
/dev/null. tcsh and bash have different ways of doing this, so I was
trying to force the use of some particular shell by our makefiles.
And you reason for not just using the portable /bin/sh syntax is....?
Philip Guenther
Re: Odd effects from setting SHELL?, Paul Smith, 2007/06/27