www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd.exe - curious behavior (bug?)

reply "Garett Bass" <gtbass studiotekne.com> writes:
I'm using dmake as follows:

    dmake 
main -ID:\Code\Compilers\D\dmd\src\phobos -od"bin" -of".\bin\main" 
 -gui

which basically creates a text file, "main.rsp":

    -ID:\Code\Compilers\D\dmd\src\phobos -odbin -of.\bin\main 
 -op -L/exet:nt/su:windows
    D:\Code\Projects\D\winsamp\main.d
    D:\Code\Projects\D\winsamp\windows.d
    D:\Code\Projects\D\winsamp\graphics.d
    gdi32.lib

then calls "dmd  main.rsp".  Now, I'm expecting this to 
behave the same as calling dmd directly:

    dmd main graphics 
gdi32.lib -od"bin" -of".\bin\main" -L/exet:nt/su:windows

Instead, the "dmd  main.rsp" call seems to ignore the -od 
flag, and all of my object files are dropped in the source 
directory.  This is inconvenient, as I'd rather avoid 
diluting the source directory with all the additional object 
files.

I've tried editing the main.rsp file manually, placing 
quotes around the flag arguments, and manually calling "dmd 
 main.rsp" from the command line, but the result is the 
same.  Anyone know how to remedy this?  Is this a bug?

Regards,
Garett 
Nov 14 2004
parent reply Helmut Leitner <leitner wikiservice.at> writes:
Garett Bass wrote:
 I'm using dmake as follows:
 
     dmake 
 main -ID:\Code\Compilers\D\dmd\src\phobos -od"bin" -of".\bin\main" 
  -gui
 
 which basically creates a text file, "main.rsp":
 
     -ID:\Code\Compilers\D\dmd\src\phobos -odbin -of.\bin\main 
  -op -L/exet:nt/su:windows
     D:\Code\Projects\D\winsamp\main.d
     D:\Code\Projects\D\winsamp\windows.d
     D:\Code\Projects\D\winsamp\graphics.d
     gdi32.lib
 
 then calls "dmd  main.rsp".  Now, I'm expecting this to 
 behave the same as calling dmd directly:
 
     dmd main graphics 
 gdi32.lib -od"bin" -of".\bin\main" -L/exet:nt/su:windows
 
 Instead, the "dmd  main.rsp" call seems to ignore the -od 
 flag, and all of my object files are dropped in the source 
 directory.  This is inconvenient, as I'd rather avoid 
 diluting the source directory with all the additional object 
 files.
 
 I've tried editing the main.rsp file manually, placing 
 quotes around the flag arguments, and manually calling "dmd 
  main.rsp" from the command line, but the result is the 
 same.  Anyone know how to remedy this?  Is this a bug?
 
 Regards,
 Garett 
If you look into the rsp file, you'll see - the option -op which comes after your -odbin and so superseedes it. So the behaviour of dmd is correct. The reason I chose to use an automatic -op was to make sharing of object creation work among different projects as easy as possible. In your setting you will not share objects and you will get problems with identical module names in different branches of your source tree. But that's your problem and I think dmake can be made more flexible by ommiting -op when an -od is given. Of course it would then have to look in different places for current objects. Maybe warn and stop in case of a name collision. Things often look easy at first sight and then start getting nasty...
Nov 14 2004
parent "news.digitalmars.com" <gtbass studiotekne.com> writes:
Helmut,

    Thanks for the information, I think I will drop the -od and use -op as 
you have suggested.

Best Regards,
Garett Bass 
Nov 15 2004