Common makefile (gasp) stuff

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 14 12:07:11 PST 2015


On 1/14/15 8:50 AM, Mathias LANG wrote:
> IMO helpers (such as git helpers) are not part of the build process, so
> they should not be part of the build files. Few people care about make
> rebase. I'm not saying we should delete them (they obviously are useful
> to you), but moving them to tools might be a good start.

This is about scaling up and passing responsibility around. I could 
write a script and then tell whoever maintains dlang.org "first run that 
script then run make" etc.

With make it turns out it's dead simple to get parallel rebase going:

REBASE = git pull upstream master --rebase

rebase: rebase-dlang rebase-dmd rebase-druntime rebase-phobos
rebase-dlang: ; $(REBASE)
rebase-dmd: ; cd $(DMD_DIR) && $(REBASE)
rebase-druntime: ; cd $(DRUNTIME_DIR) && $(REBASE)
rebase-phobos: ; cd $(PHOBOS_DIR) && $(REBASE)

So I'm done in 6 lines and it's parallel automatically, no code needed. 
With zsh I'd probably go (untested)...

===========================
#/bin/zsh
set -e

function rebase() {
   ( cd $1 && git pull upstream master --rebase )
}

rebase . &&
rebase ../dmd &&
rebase ../druntime &&
rebase ../phobos &&

wait
===========================

But wait, there's less. The script:

* does not return nonzero if either subtask fails - and doing so needs 
e.g. temporary files and takes extra code. So I need to carefully look 
at the textual garbled output to make sure it all works.

* does not accept setting variables DMD_DIR etc. It can be made to, but 
that's yet more code.

* cannot run serially if I want to debug something, only parallel. It 
can be made do, but that's again more code!

So we're looking at an ideological response "don't use make, make sucks" 
to a pragmatic matter - I want to get work done, and we shouldn't use 
inferior/more intensive technical solutions on an ideological basis 
alone. I agree make sucks! But that doesn't suddenly eliminate my common 
sense.

> For druntime / phobos build... That's really a shame we don't have a
> standard D tool to build D code, cross platform.
> If we had, not only would we promote an even saner image of our tooling
> ('hey look, dogfooding'), we won't have to solve the same problems over
> and over again, so both druntime / phobos and the tool would benefit
> from this, but ofc it will require some initial work.
> If someone wants to get this project started, I have a suggestion for
> the name: dub
>
> Okay, sarcasms appart, would that be a possibility for us to switch to
> dub in the long run ? I'm not sure dub is ready for that ATM, but I'm
> confident it could be made ready without much work.

I'd be glad to switch to dub but I confess at this time I can't invest 
the time. I'm already spread too thin.


Andrei



More information about the Digitalmars-d mailing list