www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6622] New: rdmd --makedepend lists "dmd.conf" and "dmd"

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622

           Summary: rdmd --makedepend lists "dmd.conf" and "dmd"
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: soul8o8 gmail.com



---
// --- k.d ---
    //   (empty)
    // ----------


    // --- m.d ---
    import k;
    void main(){}
    // ---------


[Bug]

m.d : /Library/Compilers/dmd2/osx/bin/dmd.conf k.d
/Library/Compilers/dmd2/osx/bin/dmd

rdmd build 20110906
...



[Expected results]

m.d : k.d 



_____

(Side note: I'm using this to build makefile dependencies on the fly, like this

    SERVER_D_FILES = $(shell rdmd --makedepend src/server.d | cut -d : -f 2)

Can anyone figure out a simple workaround for this, except adding all the files
manually?
Side note 2: It would be nice if DMD could handle this on its own hint hint...)

_____

PS. Very nice release anyway! thanks

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




---
(This is D 2.055)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



03:27:27 PDT ---
This is somewhat expected behavior: if you update your compiler or edit the
compiler's configuration, the whole project should be rebuilt. Do you think
that rdmd should omit listing these dependencies in its --makedepend output?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




---
Ah, I see.

Well, that does sound well-meaning. Hm, but, how can rdmd --makedepend claim to
know which dmd-binary I'm using in my Makefile? How does it even know I'm going
to use dmd, and not gdc, or ldc?

I suppose the tool being named "rdmd" could imply dmd is assumed, but then
again, outputting text to be used in a Makefile implies rdmd is trying to be a
part of a Makefile-work-flow. Ok, I realize I've just assumed that, maybe it
isn't (?), but if it is, then I think including "dmd.conf" and the "dmd"-binary
makes rdmd a bit presumptuous.

So, yes, I think these files should be omitted. Although I don't have the
expertise to say anything decisive about this. Is this the convention in
Makefiles? Is the g++-binary usually listed as a dependency? I have no idea. As
long as rdmd at least outputs d-files I'm happy!

***

In any case, here's how to just get the d-files from the --makedepend output,
and this is probably embarrassingly obvious, but for Makefile-hobbyists like me
it's good stuff : )

    D_FILES_WITH_PATHS = $(filter %.d, $(MAKEDEP_OUTPUT))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




15:33:12 PDT ---
"(and I'll file an enhancement request for "tell RDMD which DMD to use" if one
doesn't already exist)"

Here: issue 6628

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




15:48:00 PDT ---
Sorry, that was pretty long-winded, so let me summarize:

I believe the current behavior is correct.

Why? Because the list of .d dependencies is *inherently* dependent on the
*specific* compiler, anyway. Due to the language itself, there's no getting
around that. So even if dmd.exe and dmd.conf/sc.ini are omitted, the results of
"rdmd --makedepend" are *still* dependent on the specific compiler used.

Why is the .d list dependent on the specific compiler? Because there might be
conditional includes:

// I probably have these identifiers wrong, but whatever.
version(DMD)
    include foo_dmd;
else version(GDC)
    include foo_gdc;
else version(LDC)
    include foo_ldc;

// "LittleEndian" was changed to "littleEndian" in DMD 2.055
// Basically, this could be anything in Phobos that's changed
// between two versions of DMD.
static if(__traits(compiles, Endian.littleEndian))
    include foo_A;
else
    include foo_B;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




08:03:09 PDT ---

 Why? Because the list of .d dependencies is *inherently* dependent on the
 *specific* compiler, anyway.
Question: if the output of "rdmd --makedepend" is only usable on the current system, is there still a valid use for it? Why not just use rdmd? Using "rdmd --makedepend" to generate makefiles ready for redistribution can be seen a valid use case when the user knows that their code base does not contain imports which change depending on the environment - in which case, this bug report would be valid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




15:18:01 PDT ---
"Question: if the output of "rdmd --makedepend" is only usable on the current
system, is there still a valid use for it? Why not just use rdmd?"

"Using "rdmd --makedepend" to generate makefiles ready for redistribution..."

To be honest, even if the output of "rdmd --makedepend" were 100% portable, I'm
still not sure I see a compelling reason to use it to generate redistributed
makefiles. (At least if rdmd gains support for ldc and gdc, that is.) The user
would still need a D compiler, and if they have that, they should have rdmd
(Side note: If rdmd does support ldc and gdc, then there's no reason why it
shouldn't come packaged with those too. Or at least be trivially installable
with one or two simple commandline statements). So why pipe it all through
make? It would only create a need for people to re-generate the makefile when
source files are added or renamed, and wouldn't provide any benefit (after all,
rdmd can be invoked from a makefile).

"...when the user knows that their code base does not contain imports which
change depending on the environment"

That strikes me an error-prone, inadvisable thing to rely on.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 11 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




---
Interesting! I can see this is a bit more complex than I thought. I don't know
the convention here but as I opened this and all, I thought I'd just say that
I'm happy with this bug being closed! Not saying that I know if it should be or
not. Anyway, it seems including these files is the "right thing to do", even if
perhaps not practical for me specifically, but of course I'm not demanding that
:)

Just don't make this feature disappear! It's immensily useful when building
several targets from one single code base that mixes D with other langauges.
I'd rather give up coffee than --makedepend! (Ok, maybe not, still, very
close..)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622




13:48:47 PDT ---
"Question: if the output of "rdmd --makedepend" is only usable on the current
system, is there still a valid use for it? Why not just use rdmd?"

Now that I think about it more, yes, even then it could still be useful if you
need to do anything else with the .d files besides just send them to the
compiler.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 12 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6622


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



10:55:10 EET ---
OK, let's close this issue. It should be easy to filter or manually edit out
bits of the resulting makefile to get it to the level of specificity you need,
whereas leaving dependencies out could lead to some unexpected consequences.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 10 2013