Need help deciphering posix.mak

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 3 12:31:38 PST 2014


01-Dec-2014 16:59, Martin Nowak пишет:
> On Thursday, 27 November 2014 at 20:17:55 UTC, Dmitry Olshansky wrote:
>> What I know(?) so far:
>> 1. First we build library in one go - trivial to reproduce.
>> 2. Then we compile each unittest with -c and -deps to dump actual
>> dependencies.
>
> Yes, we compile one object file per module because memory doesn't
> suffice to build everything at once.
>

That's okay...

>> 3. Then we run a bunch of sed/sort/uniq to extract module names from
>> verbose output of compiler (red flag IMHO, but anyway).
>> https://github.com/D-Programming-Language/phobos/blob/master/posix.mak#L325
>>
>
> Converting DMD deps output to makefile dependency rules, what's the
> problem with that?

Eh-m now I see. Makes sense I guess, though it looks like some 
makedepend-ish hack. What happens if the compiler was stopped half-way 
during writing a deps file?

However now I understand it and can re-write it as a SCons builder that 
emits sources for tests/xyz binary as it parses deps file.

>
>> 5. We build a unittester from Druntime (pulling sources out of tree -
>> omg) with ALL of object files:
>> https://github.com/D-Programming-Language/phobos/blob/master/posix.mak#L334
>>
>
> That's the test runner, didn't make to copy the sources, because Phobos
> already depends on druntime anyhow

Gotta test it, might work as is.
Typically SCons would copy over all sources to stage directory and build 
there.

>
>> 6. Run it passing a specific module to unittest:
>> https://github.com/D-Programming-Language/phobos/blob/master/posix.mak#L355
>>
>
> Yep, this is so because all unit tests live in a shared library.

Mmm. Why pack unittests into a shared library?

> So we need a special test runner to run only a single module, allowing
> us to still parallelize testing.

Does it work the same way if Phobos is a static library?

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list