DFLAGS and gdc

Timo Sintonen via D.gnu d.gnu at puremagic.com
Thu Jul 10 23:22:18 PDT 2014


On Thursday, 10 July 2014 at 23:54:08 UTC, Joseph Rushton 
Wakeling via D.gnu wrote:
> On 08/07/14 17:58, Iain Buclaw via D.gnu wrote:
>> My stance at the moment is that DFLAGS should be recognised by 
>> the
>> build tool, not the compiler.
>
> I wonder if John's specific concern may be to do with how dmd 
> uses the DFLAGS environment variable to specify the standard 
> import and library paths.
>
> Is there an equivalent for gdc, or does it simply assume that 
> imports and libraries will be in well-defined locations 
> relative to where the executable is located?

As an ordinary user I might say that the basic idea is a little 
different.
Dmd is more a standalone tool. All options, files, libs etc are 
passed to it at the same time. Gdc and other gcc tools are more 
like parts in a toolchain. It is not meant to call them directly. 
It is the job of a build system like make to parse the 
environment.

When using gcc it is common to compile each file separately and 
then link all of them together. This is a make rule I have been 
using to compile a d file:
$(dobjects): %.o:  %.d   $(deps)
	 $(gccprefix)$(gdc) -c $(dflags) $(flags) $(includes) $< -o $@

I think that if libraries are installed to standard place, they 
are found automatically. A special feature of D language is that 
full library sources have to be available for imports. I do not 
know where they are located in different distros but it may be 
necessary always to give gdc the correct path for imports.


More information about the D.gnu mailing list