From: Felix <fx...@gm...> - 2004-03-26 22:37:53
|
On Fri, 26 Mar 2004 14:35:03 -0700 Brian Paul <bri...@tu...> wrote: > Felix K=FChling wrote: > > Wow, your makefile system managed to nearly hang my system. The default > > shell that is installed as /bin/sh on my box is "dash" which does not > > seem to have pushd and popd. Therefore the recursive make calls end up > > in the same directory and cause an endless recursion, filling up system > > memory pretty quickly. > >=20 > > Is there a reason why you use pushd/popd instead of plain cd or > > "make -C"? If you really have to use it you should make sure that it is > > executed in bash. At least in GNU make you could set the SHELL variable > > to /bin/bash (or just bash, assuming that it's somewhere in the PATH) > > for that purpose. >=20 > I'm not a shell expert, so please bear with me. Neither am I. Sometimes I am surprised by weird behaviour because many people assume that /bin/sh is in fact bash. dash is perfectly compatible with original Unix shell and more light-weight than bash. So it's good for shell scripts that don't need bash extensions. If they do then they should state that explicitly (e.g. #!/bin/bash). In (GNU) make you can choose the shell to use for executing the rules' commands by setting the SHELL variable. >=20 > I don't think make -C is a standard feature of most makes (IRIX's make=20 > doesn't support it, for example). I understand. >=20 > I thought pushd/popd was pretty much supported everywhere. Guess I'm=20 > wrong. I'll change the loops to something like this: >=20 > for dir in $(SUBDIRS) ; do \ > if [ -d $$dir ] ; then \ > (cd $$dir; make) ; \ > fi \ > done >=20 >=20 > I think that'll work just as well as pushd/popd. Yes, this looks safe. ;-) >=20 > -Brian >=20 Thanks, Felix |