Common makefile (gasp) stuff

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 13 15:55:31 PST 2015


On Tue, Jan 13, 2015 at 03:20:12PM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
> Hey folks,
> 
> 
> Over the time a number of stuff has become quite duplicated across our
> makefiles for dmd, druntime, and phobos.
> 
> These include fetching OS and model but (newer) general-purpose macros for
> e.g. rebasing repos, see https://github.com/D-Programming-Language/dlang.org/blob/master/posix.mak#L37.
> 
> I think it's time to reduce clutter and duplication by migrating such
> common stuff into one common.mak file. Question is, where should that
> file sit? One candidate is tools/ but it's not really a tool. Another
> candidate is dmd/src/ because that would be the first thing anyone
> depends on.
> 
> Ideas?
[...]

Actually, my first reaction is to go the opposite direction. Currently,
we have way too many complicated interdependencies between different
repos. For example, the 'html' target of phobos/posix.mak depends on
files in the dlang.org repos, and the website build scripts of dlang.org
in turn depends on files generated by the Phobos ddoc targets. This may
be fine for the core devs and hard-core bleeding-edge people like myself
who don't mind running off git HEAD and dealing with breakages, but it's
bad for anybody else:

1) These interdependencies are currently expressed by hard-coded
filesystem paths, which presumes a specific directory layout for
checking out dmd, dlang.org, phobos, druntime. This means the build will
break if somebody doesn't know the correct directory structure to use
when checking out these repos.

2) This makes the build fragile, because any changes to makefiles that
might affect these dependencies have to be merged in sync between
multiple repos, e.g., a PR that changes the layout of dlang.org needs to
have a corresponding PR that updates the Phobos makefiles as well. This
is kinda what we already have to do with compiler-dependent changes to
druntime/phobos anyway, but in the case of documentation, any oversight
is not caught by the autotester and may wind up on the public-facing
dlang.org website before the problem is noticed.

3) Due to these interdependencies, you always have to checkout all 4
repos (in a specific directory layout), otherwise the build will fail
one way or another. Again, not a problem for core devs, but a gratuitous
obstacle for the casual user who wants to try things out. (Actually, to
this day I'm almost certain I *still* don't have the exact layout
assumed by the build scripts, because dlang.org appears to deposit
generated html files in dlang.org/web, whereas phobos/posix.mak's 'html'
target generates them in ../web/, which in my setup is one directory
level off. I hacked around the problem with a symlink from web to
dlang.org/web, but I'm pretty sure many users who wanted to experiment
with Phobos docs gave up because they didn't have the patience to figure
out how to get the thing to work properly.)

Because of this, my inclination right now is to *reduce*
interdependencies between these repos, rather than introduce yet more.

Either that, or we should just forget about trying to manually keep 3-4
disparate repos in sync, and just use a single repo for dmd, druntime,
phobos, dlang.org, etc.. Except that some people will then complain that
they just want the bare compiler and nothing else, so why should they
have to clone excess baggage like druntime/phobos. *shrug* Some days you
just can't win.

(Of course, the *ideal* solution is that the makefiles will tell you if
something is missing and where to get it and how to set it up correctly.
But I'm skeptical whether this will ever materialize.  I'm not holding
my breath.)


T

-- 
Why waste time reinventing the wheel, when you could be reinventing the engine? -- Damian Conway


More information about the Digitalmars-d mailing list