Makefile default shell

This one is a bit of a gotcha that I encountered in the ieee80211 and ipw3945 source. The make files used some convoluted shell syntax to check the state of the kernel. The problem is that it uses particular non bourne-shell isms, such as the [[ syntax, which simply doesn’t work in bourne, because it’s so bloody simple.
The short solution was to put SHELL=/bin/bash at the start of the Makefile, which causes the shell that is used to be bash instead of sh. This is of course one of the regular issues between the different versions of Linux that float around. Some use bash as sh, which technically speaking is a bit of an evilness. It can hit you time and again in writing rc scripts as well, where the choice of shell is not generally determined by the magical ‘#!’ on the first line, but by the rcX script (X is generally S, 1, 2, 3, …).

Again, the quantity of run levels is determined by the provenance of the Operating System – for example the machine I’m currently working on(Ubuntu) claims a run-level of 2, while the fedora core desktop I’ve just checked claims a run-level of 5. Solaris makes thing really fun by informing you that tour run-level is a legacy state that you should stop considering to be useful, after all it’s about the services that you have enabled, not the run-level.

One Reply to “Makefile default shell”

  1. And Ubuntu is moving to a SMF type mechanism. Though rather that adopt SMF they’re reinventing the wheel. Now why am I getting red underlines with ‘SMF’ ? Oh, right, firefox’s new spell checker. Doesn’t get ‘firefox’ either. I could go on, but I’ll stop now.

Comments are closed.