Common makefile (gasp) stuff

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 14 00:29:44 PST 2015


"Andrei Alexandrescu"  wrote in message 
news:m94vfk$2gdh$1 at digitalmars.com...

> Hmmm... I wonder why the distinction.

OS detection is required to build successfully, a rebase shortcut is not.

> The problem is basic code duplication with its known liabilities. I'm 
> looking at stuff like this:
>
> Three's a charm. That code is relatively verbose (required newlines). I 
> trust it doesn't need updates often, but it occupies real estate in a 
> readily accessible position (beginning of file).
>
> The real issue here is that acquiescing to such duplication discourages 
> attempts at uniformization before they occur. I'm thinking of simpler, 
> clearer naming conventions and uniform ways of doing the same things (such 
> as unittesting or documentation).

The problem here is really that make sucks, right?  And makefiles suck. 
Maybe we should start seriously looking at replacing them with D scripts.

> Getting back to REBASE 
> (https://github.com/D-Programming-Language/dlang.org/blob/master/posix.mak#L37), 
> it greatly simplifies my building the entire website in a way I trust is 
> nice:
>
>    make rebase -j && make clean && make rsync -j
>
> (Sadly make clean is necessary because of dub, which makes the process 
> take a lot longer than it should; with luck, somebody will improve on that 
> soon.)
>
> Now "make rebase" is really useful for druntime and phobos as well. But 
> between duplicating more code or just doing it by hand, one may as well 
> give up and choose the latter.

Honestly I don't think automating rebase is a good idea, because it 
discourages actually learning how to do it.

eg if all you're trying to do is get the current branch rebased on top of 
upstream's master, you can do this:

git pull upstream master --rebase

> I'd also like to define "make rebase-dirty" based on this:
>
> REBASE_DIRTY = MYBRANCH=`git rev-parse --abbrev-ref HEAD` &&\
>   git stash &&\
>   git co master &&\
>   git pull --ff-only upstream master &&\
>   git co $$MYBRANCH &&\
>   git rebase master &&\
>   git stash pop
>
> which is useful because it lets me rebase on top of work in progress. 
> Again the prospect of duplicating this other macro across 3-4 projects is 
> fairly unattractive.

I've managed to get by fine with using shell scripts for stuff like this. 



More information about the Digitalmars-d mailing list