Welcome to Web-News
A Web-based News Reader
Subject Using DMD's -v to build dependencies
From Sergey Gromov <snake.scaly@gmail.com>
Date Sat, 13 Dec 2008 01:18:37 +0300
Newsgroups digitalmars.D

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@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<-------------------

Recent messages in this thread
 
-# Using DMD's -v to build dependencies (Current message) Sergey Gromov 12-Dec-2008 05:18 pm
.-# Re: Using DMD's -v to build dependencies Bill Baxter 12-Dec-2008 05:37 pm
..-# Re: Using DMD's -v to build dependencies Sergey Gromov 13-Dec-2008 01:35 pm
...\# Re: Using DMD's -v to build dependencies Bill Baxter 13-Dec-2008 02:32 pm