digitalmars.D - DMD Automatic Dependency Linking
Travis <boucher.travis gmail.com> writes:
DMD currently follows a fairly standard compiler methodology: - Compile a bunch of source files into binary objects (to generate .o). - Act as a front end to an archiver (to generate .a). - Act as a front end to a linker (to generate final binary). This makes integration with most build systems and IDEs not only possible, but in most cases reasonably trivial. The one thing I have been wondering however is why doesn't DMD have a flag for easy project building which compiles dependencies in a single command. DMD already can generate a recursive list of module dependencies (-deps=), why not go one step towards a full build system and have it build those dependencies (and check timestamps). This could create behaviours similar to that of simple dsss/rebuild/bud/xfBuild configuration but keep up to date with the DMD syntax. The behaviour I am thinking/suggesting for the '-R' flag (recursive) is: - Generate dependency tree of each .d file provided on the command line - If -o- is provided on the command line, treat each dependant .d file in the dependency tree as if it was provided on the command line. - If -o- is not provided on the command line only compile the .d files that are newer than the .o files. - Link/Archive the resulting .o files. Adding in pragma('link', 'foo') would also be really nice to add in as well for this sort of system. Even better would be some way of passing command line arguments to dmd via a pragma such as pragma('cmd', '-Jfoo') which would add a string imports path relative to the file being compiled. I think this sort of feature would allow alot of newcomers to D to get writing modular code faster without learning build systems and all of the crap associated cross platform issues. I don't know the dmd internals well enough to implement it myself, but I'd love to hear Walter's or Andrei's input on a feature like this. From what I do know about dmd's current functionality, it seems like it would be a fairly easy feature to implement. Thanks, tbone
Nov 16 2010
Matthias Pleh <sufu alter.com> writes:
Am 16.11.2010 18:38, schrieb Travis:The one thing I have been wondering however is why doesn't DMD have a flag for easy project building which compiles dependencies in a single command.[...]Thanks, tboneHave you tried 'rdmd' ?
Nov 16 2010
Travis Boucher <boucher.travis gmail.com> writes:
On 10-11-16 12:04 PM, Matthias Pleh wrote:Am 16.11.2010 18:38, schrieb Travis:Son of a bitch, I didn't realize rdmd did the dependencies as well. Previously I have only used rdmd for D 'scripts' and unittesting. I have done some testing with it using derelict (with some modifications to work with D2) and gtkd and it works perfectly (slow for gtkd, but gtkd is kinda slow to compile anyway). I'll start using rdmd and suggest it to others. Thanks!The one thing I have been wondering however is why doesn't DMD have a flag for easy project building which compiles dependencies in a single command.[...]Thanks, tboneHave you tried 'rdmd' ?
Nov 19 2010