On Sun, Aug 11, 2013 at 06:14:18PM -0700, Jonathan M Davis wrote: > On Sunday, August 11, 2013 15:38:09 H. S. Teoh wrote: > > Maybe my previous post didn't get the idea across clearly, so let me > > try again. My underlying thrust was: instead of maintaining 3 > > different makefiles (or more) by hand, have a single source for all > > of them, and write a small D program to generate posix.mak, > > win32.mak, win64.mak, whatever, from that source. > > > > That way, adding/removing files from the build, etc., involves only > > editing a single file, and regenerating the makefiles/whatever we > > use. If there's a problem with a platform-specific makefile, then > > it's just a matter of fixing the platform-specific output handler in > > the D program. > > > > The way we're currently doing it essentially amounts to the same > > thing as copy-n-pasting the same piece of code 3 times and trying to > > maintain all 3 copies separately, instead of writing a template that > > can be specialized 3 times, thus avoiding boilerplate and > > maintenance headaches. > > But if you're going that far, why not just do the whole thing with D > and ditch make entirely? If it's to avoid bootstrapping issues, we're > going to have those anyway once we move the compiler to D (which is > well on is well underway), so that really isn't going to matter. [...]
If you like, think of it this way: the build tool will be written in D, with the option of generating scripts in legacy formats like makefiles or shell scripts so that it can be bootstrapped by whoever needs it to. We pay zero cost for this because the source document is the input format for the D tool, and the D tool takes care of producing the right sequence of commands. There is only one place to update when new files need to be added or old files removed -- or, if we integrate it with rdmd fully, even this may not be necessary. When somebody asks for a makefile, we just run the program with --generate=makefile. When somebody asks for a shell script, we just run it with --generate=shellscript. The generated makefiles/shell scripts are guaranteed to be consistent with the current state of the code, which is the whole point behind this exercise. T -- Designer clothes: how to cover less by paying more.
