Using DMD's -v to build dependencies
Sergey Gromov
snake.scaly at gmail.com
Fri Dec 12 14:18:37 PST 2008
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