shebang launcher for D programs
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Sat Mar 24 13:53:28 PDT 2007
Anders F Björklund wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>
>>> When doing more complex such "scripts", this seems to work OK:
>>>
>>> #!/usr/bin/env rdmd --compiler=rebuild
>>>
>>> i.e. just using rebuild as a drop-in replacement for gdmd/dmd
>>>
>>> This caches the resulting program in /tmp (or $TEMP on Windows)
>>> and passes any additional arguments over to the compiled program:
> ...
>>> Should also work OK with Tango.
>>
>> This won't work if your script includes one of your own modules.
>
> I'm not sure what you mean. If I import foo and bar, then rebuild
> will include foo.o and bar.o when compiling the main D program...
>
> Had I used gdmd, then I *would* have needed to include foo.o/bar.o
> (or a library containing those), but rebuild picks dependencies up:
>
> run.d:
> ======
> #!/usr/bin/env rdmd -v --verbose --compiler=rebuild
Great. For some reason, it didn't work in my initial tests; I guess I've
been sloppy somewhere.
Any chance you make the --compiler=rebuild a default? Or is rebuild a
separate product? (If so, that's not an attractive option.)
Essentially what you want is to make rdmd do the deed flag-free:
$ rdmd prog args
does whatever it takes to build prog.d (if necessary) and then runs it
passing args. Each one necessary flag cuts your cut following in half. :o)
Andrei
More information about the Digitalmars-d
mailing list