bug-bash
[Top][All Lists]
Advanced

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

Re: Could bash do what make does?


From: Charles Daffern
Subject: Re: Could bash do what make does?
Date: Tue, 29 Nov 2016 11:19:40 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 29/11/16 05:41, Robert Durkacz wrote:
> make has survived all this time but it is not very well accepted today
> with a lot of competing build systems trying to do better. bash is
> very secure and moreover the Bourne shell was there first. make is
> falling out of favour as far as I can see even though it has had a
> very good run: Kernighan and Pike in their book on Unix said to use it
> in preference to the shell for builds. That is the background to my
> asking was it really necessary after all to do give up on the shell
> for doing builds?
It seems a little perverse to me to have huge features added to bash for
social reasons. make does its job well, and in the majority of cases it
either shells out to bash or can be made to do so.
The Bourne shell may have a legacy but I don't think that means that
people will immediately adopt bash's make-like features if they ever
happen. (Besides, bash is not the Bourne shell, and the other Bourne
shell derivatives probably won't follow suit.)

Regardless of that, make does a lot more than just check file times. It
checks whole dependency trees and builds common dependencies just once,
and it can schedule build tasks in parallel safely (providing the
makefile is well-written). It can have generic rules defined which
determine how to build a filetype in general, and will follow those
rules when they're needed to build a dependency of another target. It
has a lot of helpful features you can see in its man page, and I'd hate
to see people ditching make for a simplified imitation built into a
popular shell.

Even then, if the implementation isn't simplified, and feature parity
with make is achieved, the resulting build system would rely on a weird
kind of makefile which is incompatible with systems running older
versions of bash. You might as well have written a proper makefile
instead. (That's to say nothing of how awkward it would be to specify a
non-deterministic ordering of jobs and a proper dependency tree in
bash's syntax.)

In short:
- make does its job very well.
- bash's popularity doesn't mean people will automatically adopt new
features. (Ever seen a shell script using "coproc" in the wild?)
- Reimplementing it is no mean feat.
- If you reimplement it, you just have make all over again, so just use
make.

If someone wants to build their project using waf or something instead,
that's their own prerogative. That kind of person would probably
overlook a native bash build system too, because I feel like there are a
lot of Python (/Ruby/etc.) programmers with a visceral disdain for shell
scripting. It'll take a lot to change that.

But I'm not related to the Bash project in any meaningful way, so
there's a chance that the regulars won't think the same.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]