Using DMD's -v to build dependencies

Bill Baxter wbaxter at gmail.com
Fri Dec 12 14:37:18 PST 2008


So how fast is dmd -o-?  Does this pretty much double the compile time?
An option to reuse a previously generated .deps might be nice.

--bb

On Sat, Dec 13, 2008 at 7:18 AM, Sergey Gromov <snake.scaly at gmail.com> wrote:
> After some twitting ;) here's my Windows shell script (a .cmd file)
> which can effectively replace bud/rebuild in some simple cases.  This
> script makes use of GNU grep and sed.  Both are available from GnuWin32
> or Cygwin or as separate ports.
>
> file "sbd.cmd"
> ---8<-------------------
> :: Build a D program including any dependencies
> :: 2008, Sergey 'SnakE' Gromov <snake.scaly at gmail.com>
>
> @echo off
> setlocal
>
> if "%1" == "" (
>  echo Build a D program with all dependencies
>  echo Usage: %0 master [options]
>  echo   master   master source, root of the import hierarchy
>  echo   options  any options are forwarded to DMD
>  exit /b 1
> )
>
> set DEP=dependencies.tmp
>
> :: generate dependencies
> dmd %* -c -o- -v | grep "^import" | grep -v "phobos\|tango\|\.di)" | sed "s/^.*(\(.*\)).*$/\1/" > %DEP%
>
> :: compile
> dmd %* @%DEP% || goto error
>
> :: cleanup
> del %DEP%
> exit /b 0
>
> :error
> del %DEP%
> exit /b 1
> ---8<-------------------
>



More information about the Digitalmars-d mailing list