Phobos posix.mak -> D file using reggae: round 2

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 29 11:02:23 PDT 2016


On Monday, 18 April 2016 at 15:15:26 UTC, Atila Neves wrote:
> Here's[1] another attempt at converting the Makefile for POSIX 
> systems to D using reggae[2]. I first tried my hand at writing 
> a parser for Makefiles using Pegged and machine translating to 
> D. I learned a lot about parsing and GNU make in the process 
> and also that:
>
> 1. It was about two orders of magnitude more work than I 
> thought to support the subset of GNU make used by posix.mak
> 2. The generated D code wasn't exactly pretty
>
> I concluded that worse is better and hand translated all of 
> posix.mak instead. It isn't as pretty as possible either, but 
> that's on purpose - since I'll have to mentally apply any 
> further diffs and hand translate, I tried to make it as close 
> as possible to the existing Makefile. That way the edits should 
> be obvious.
>
> AFAICT by testing manually, it does everything that the 
> original Makefile does, including all the different unit test 
> targets and documentation. Then again, I only tested on Linux. 
> I've been trying to bend the auto-tester to my will to make 
> sure all posix.mak systems are still green but I ran into 
> configuration issues.
>
> I'll carry on maintaining the D description as updates to 
> posix.mak happen for a year. If we haven't switched by then we 
> probably never will.
>
> To try it out yourself, get & build/run reggae from dub in this 
> branch at the root dir of phobos selecting the backend of 
> choice with `-b <backend>`. I suggest the binary one since one 
> of the points of this is to remove dependencies from other 
> build systems. Then run make/ninja/tup/./build with the same 
> targets as usual. If that doesn't work... open an issue on 
> github.
>
> Destroy!
>
> Atila
>
>
> [1] 
> https://github.com/atilaneves/phobos/blob/reggae/reggaefile.d
> [2] https://github.com/atilaneves/reggae

Phobos posix.mak in D:

https://github.com/atilaneves/phobos/blob/new_reggae/reggaefile.d

I've given up on making it look like the makefile for maintenance 
reasons and tried to write it "properly". At the end of the day, 
that phobos posix.mak just does a lot of stuff so even though I 
tried getting rid of cruft it's still rather large.

Notice however how there are no explicit listings of packages or 
converting them or anything like that. This isn't the best I can 
do, but it was a lot of work already so I thought I'd share.

This new attempt does everything posix.mak at that point in time 
did except for running unit tests per package. I think that's the 
test runner's job anyway. I also changed the individual unit test 
targets from e.g. std/array.test to std.array.test because, well, 
it makes a lot more sense.

Atila


More information about the Digitalmars-d mailing list