<!--
  WANT - A build management tool.
  Copyright (c) 2001-2003 Juancarlo Anez, Caracas, Venezuela.
  All rights reserved.


  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later Ver.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

{ $Id: want.xml,v 1.41 2009/05/19 14:30:09 zjy Exp $ }

This is the Want script for building CnWizards.
See http://www.suigeneris.org/want/ for details.
-->
<project name="cnwizards"
         basedir="../"
         default="help" >

  <!-- 从环境变量中取得管理员标志 -->
  <property name="master.ini"   value="${basedir}/Make/master.ini" />
  <property name="ismaster"     value="?{${master.ini}:Master:Master}" />

  <!-- 从环境变量中取得系统参数 -->
  <property name="ProgramFiles"   value="%{ProgramFiles}" />

  <property name="exe.D2005"      value="%{env.D2005}" if="env.D2005" />
  <property name="exe.D2005"      value="${ProgramFiles}\Borland\BDS\3.0\Bin\DCC32.EXE" unless="env.D2005" />
  <property name="exe.D2006"      value="%{env.D2006}" if="env.D2006" />
  <property name="exe.D2006"      value="${ProgramFiles}\Borland\BDS\4.0\Bin\DCC32.EXE" unless="env.D2006" />
  <property name="exe.D2007"      value="%{env.D2007}" if="env.D2007" />
  <property name="exe.D2007"      value="${ProgramFiles}\CodeGear\RAD Studio\5.0\Bin\DCC32.EXE" unless="env.D2007" />
  <property name="exe.D2009"      value="%{env.D2009}" if="env.D2009" />
  <property name="exe.D2009"      value="${ProgramFiles}\CodeGear\RAD Studio\6.0\Bin\DCC32.EXE" unless="env.D2009" />
  <property name="exe.D2010"      value="%{env.D2010}" if="env.D2010" />
  <property name="exe.D2010"      value="${ProgramFiles}\Embarcadero\RAD Studio\7.0\Bin\DCC32.EXE" unless="env.D2010" />
  <property name="exe.DXE"        value="%{env.DXE}" if="env.DXE" />
  <property name="exe.DXE"        value="${ProgramFiles}\Embarcadero\RAD Studio\8.0\Bin\DCC32.EXE" unless="env.DXE" />
  <property name="exe.DXE2"       value="%{env.DXE2}" if="env.DXE2" />
  <property name="exe.DXE2"       value="${ProgramFiles}\Embarcadero\RAD Studio\9.0\Bin\DCC32.EXE" unless="env.DXE2" />
  <property name="exe.DXE3"       value="%{env.DXE3}" if="env.DXE3" />
  <property name="exe.DXE3"       value="${ProgramFiles}\Embarcadero\RAD Studio\10.0\Bin\DCC32.EXE" unless="env.DXE3" />
  <property name="exe.DXE4"       value="%{env.DXE4}" if="env.DXE4" />
  <property name="exe.DXE4"       value="${ProgramFiles}\Embarcadero\RAD Studio\11.0\Bin\DCC32.EXE" unless="env.DXE4" />
  <property name="exe.DXE5"       value="%{env.DXE5}" if="env.DXE5" />
  <property name="exe.DXE5"       value="${ProgramFiles}\Embarcadero\RAD Studio\12.0\Bin\DCC32.EXE" unless="env.DXE5" />
  <property name="exe.DXE6"       value="%{env.DXE6}" if="env.DXE6" />
  <property name="exe.DXE6"       value="${ProgramFiles}\Embarcadero\Studio\14.0\Bin\DCC32.EXE" unless="env.DXE6" />
  <property name="exe.DXE7"       value="${ProgramFiles}\Embarcadero\Studio\15.0\Bin\DCC32.EXE" unless="env.DXE7" />
  <property name="exe.brcc32"     value="%{BRCC32}" />
  <property name="exe.git"        value="%{env.git}" if="env.git" />
  <property name="exe.git"        value="${ProgramFiles}\Git\bin\git.exe" unless="env.git" />
  <property name="exe.svn"        value="%{env.svn}" if="env.svn" />
  <property name="exe.svn"        value="${ProgramFiles}\Subversion\bin\svn.exe" unless="env.svn" />
  <property name="exe.python"     value="%{env.python}" if="env.python" />
  <property name="exe.python"     value="C:\Python26\python.exe" unless="env.python" />

  <!-- 版本类型属性，由命令行传入，如 want -Dlite=true -->
  <property name="release.pro"    value="" />
  <property name="release.pro"    value=""          if="full" />
  <property name="release.pro"    value="_Lite"     if="lite" />

  <property name="cnwizards_list" value="-d5,-d6,-d7,-d2005,-d2006,-d2007,-d2009,-d2010,-dxe,-dxe2,-dxe3,-dxe4,-dxe5,-dxe6,-dxe7,-cb5,-cb6" unless="lite" />
  <property name="cnwizards_list" value="-d6,-d7,-d2006,-d2007,-cb6" if="lite" />
  <property name="tools_list"     value="cnconfigio,cndebugviewer,cndfm6to5,cnascii,cnidebr,cnmanagewiz,cnselectlang,cnsmr,cnwizsetup" unless="lite" />
  <property name="tools_list"     value="cnconfigio,cndebugviewer,cnwizsetup" if="lite" />
  <property name="all_list"       value="cnwizards,resdll,cnwizhelperdll,cnpnglib,tools,makehelp,makeinst" unless="lite" />
  <property name="all_list"       value="cnwizards,resdll,cnpnglib,tools,makeinst" if="lite" />

  <property name="install_lite"   value=""          unless="lite"/>
  <property name="install_lite"   value="/DLITE"    if="lite"/>

  <!-- 根据发布类型设置相关属性，发布类型由命令行传入，如 want -Dpreview=true -->
  <property name="release.type"   value="_Unstable" if="unstable" />
  <property name="release.type"   value="_Debug"    if="debug" />
  <property name="release.type"   value="_Preview"  if="preview" />
  <property name="release.type"   value="_RC1"      if="rc1" />
  <property name="release.type"   value="_RC2"      if="rc2" />
  <property name="release.type"   value="_RC3"      if="rc3" />
  <property name="release.type"   value="_RC4"      if="rc4" />
  <property name="release.type"   value="_RC5"      if="rc5" />
  <property name="release.type"   value=""          if="release" />

  <property name="release.labels"   value="Unstable"   if="unstable" />
  <property name="release.labels"   value="Debug"      if="debug" />
  <property name="release.labels"   value="Preview"    if="preview" />
  <property name="release.labels"   value="RC"         if="rc1" />
  <property name="release.labels"   value="RC"         if="rc2" />
  <property name="release.labels"   value="RC"         if="rc3" />
  <property name="release.labels"   value="RC"         if="rc4" />
  <property name="release.labels"   value="RC"         if="rc5" />
  <property name="release.labels"   value="Release"    if="release" />
  <property name="release.labels"   value="Release"    unless="release.labels" />

  <property name="ftpdir"  value="/download.cnpack.org/unstable"  if="unstable" />
  <property name="ftpdir"  value="/download.cnpack.org/debug"     if="debug" />
  <property name="ftpdir"  value="/download.cnpack.org/preview"   if="preview" />
  <property name="ftpdir"  value="/download.cnpack.org/rc"        if="rc1" />
  <property name="ftpdir"  value="/download.cnpack.org/rc"        if="rc2" />
  <property name="ftpdir"  value="/download.cnpack.org/rc"        if="rc3" />
  <property name="ftpdir"  value="/download.cnpack.org/rc"        if="rc4" />
  <property name="ftpdir"  value="/download.cnpack.org/rc"        if="rc5" />
  <property name="ftpdir"  value="/upgrade.cnpack.org/cnwizards"  if="release" />

  <property name="dcc_arg" value="-vn" if="debug" />
  <property name="dcc_arg" value="-vn" if="td32" />
  <property name="dcc_arg" value=""    unless="dcc_arg" />

  <!-- 定义编译时使用的条件编译宏 -->
  <property name="define._debug"    value=";DEBUG;USE_JCL" if="debug" />
  <property name="define._debug"    value=""               unless="debug" />
  <property name="define._lite"     value=";CNWIZARDS_LITE" if="lite" />
  <property name="define._lite"     value=""               unless="lite" />
  <property name="define._master"   value=";IS_MASTER"     if="ismaster" />
  <property name="define._master"   value=""               unless="ismaster" />
  <property name="define.add"       value="AUTO_BUILD${define._debug}${define._lite}${define._master}"/>

  <!-- 定义是否需要包括帮助文件的条件 -->
  <property name="install_arg"  value="/DNO_HELP" if="unstable"/>
  <property name="install_arg"  value=""          unless="unstable"/>
  <property name="install_arg"  value="/DNO_HELP" if="debug"/>
  <property name="install_arg"  value=""          if="helpfile"/>

  <property name="install_dbg"  value="/DDEBUG"   if="debug"/>
  <property name="install_dbg"  value=""          unless="debug"/>

  <property name="release.type" value="_Unstable" unless="ftpdir" />
  <property name="ftpdir"       value="/download.cnpack.org/unstable" unless="ftpdir" />

  <!-- 从 release.ini 中读取项目属性 -->
  <property name="ini"                  value="${basedir}/Make/release.ini" />
  <property name="Ver.Major"            value="?{${ini}:Version:Major}" />
  <property name="Ver.Minor"            value="?{${ini}:Version:Minor}" />
  <property name="Ver.Release"          value="?{${ini}:Version:Release}" />
  <property name="Ver.Build.old"        value="?{${ini}:Version:Build}" />
  <property name="Ver.CompanyName"      value="?{${ini}:Version:CompanyName}" />
  <property name="Ver.ProductName"      value="?{${ini}:Version:ProductName}" />
  <property name="Ver.ProductVersion"   value="?{${ini}:Version:ProductVersion}" />
  <property name="Ver.LegalCopyright"   value="?{${ini}:Version:LegalCopyright}" />
  <property name="Ver.LegalTrademarks"  value="?{${ini}:Version:LegalTrademarks}" />
  <property name="Ver.Comments"         value="?{${ini}:Version:Comments}" />

  <!-- 如果是管理员，将 build 号加一 -->
  <property name="Ver.Build"            value="={1 + ${Ver.Build.old}}" if="ismaster" />
  <property name="Ver.Build"            value="${Ver.Build.old}"    unless="ismaster" />

  <!-- 设置版本字符串 -->
  <property name="Ver.Str.Major"        value="${Ver.Major}" />
  <property name="Ver.Str.Minor"        value="${Ver.Minor}.${Ver.Release}.${Ver.Build}${release.pro}${release.type}" />
  <property name="Ver.Comma"            value="${Ver.Major},${Ver.Minor},${Ver.Release},${Ver.Build}" />
  <property name="Ver.Dot"              value="${Ver.Major}.${Ver.Minor}.${Ver.Release}.${Ver.Build}" />

  <!-- 设置安装程序文件名 -->
  <property name="Installer.Name"       value="CnWizards_${Ver.Str.Major}.${Ver.Str.Minor}.exe" />
  <property name="zipname"              value="CnWizards_Src_${Ver.Str.Major}.${Ver.Str.Minor}.zip" />
  <property name="zipfile"              value="${root}/${zipname}" />

  <!-- 取得日期时间 -->
  <tstamp>
    <format property="date.curr"        pattern="yyyy-mm-dd" />
    <format property="date.build"       pattern="yyyy.mm.dd" />
  </tstamp>

  <!-- 定义目录名变量 -->
  <property name="root"           value="${basedir}/.." />
  <property name="bin"            value="${basedir}/Bin" />
  <property name="dcu"            value="${basedir}/Dcu" />
  <property name="doc"            value="${basedir}/Doc" />
  <property name="help"           value="${basedir}/Help" />
  <property name="install"        value="${basedir}/Install" />
  <property name="install.src"    value="${basedir}/Install/Src" />
  <property name="install.output" value="${basedir}/Install/Output" />
  <property name="make"           value="${basedir}/Make" />
  <property name="src"            value="${basedir}/Source" />
  <property name="tools"          value="${basedir}/Tools" />
  <property name="cnvcl"          value="${basedir}/../cnvcl" />
  <property name="cnvcl.src"      value="${cnvcl}/Source" />

  <!-- 显示帮助信息 -->
  <target name="help" description="Show help text." >
    <echo message="CnWizards Build Tool - WANT
Usage: want [target-name] [-Dname=value]
  where target-name may:
    help       - This help text.
    cleanbin   - Clean output files.
    cleanobj   - Clean temp files.
    clean      - Clean output and temp files.
    gitpull    - Update all files.
    d5         - Compile CnWizards for Delphi 5.
                 (d6, d7, d2005, d2006, d2007, d2009, d2010, dxe, dxe2, dxe3, dxe4, dxe5, dxe6, dxe7, cb5, cb6 also)
    cnwizards  - Compile all CnWizards DLLs (D5, D6, etc.).
    resdll     - Compile CnWizards Resource DLL.
    cnwizhelperdll - Compile CnWizards Helper DLL.
    cnpnglib   - Compile CnPngLib DLL.
    cnconfigio - Compile CnConfigIO.
    cndebugviewer  - Compile CnDebugViewer.
    cndfm6to5  - Compile CnDfm6To5.
    cnascii    - Compile CnAsciiChart.
    cnidebr    - Compile CnIdeBRTool.
    cnmanagewiz   - Compile CnManageWiz;
    cnselectlang  - Compile CnSelectLang.
    cnsmr         - Compile Relation Analyzer.
    cnwizsetup - Compile CnWizards Setup.
    tools      - Compile Tools (CnDfm6To5, CnWizSetup, etc.).
    help_chs   - Compile Chinese chm help (GB2312).
    help_cht   - Compile Chinese chm help (BIG5).
    help_enu   - Compile English chm help.
    makehelp   - Compile all chm help files.
    makeinst   - Build CnWizards Installer.
    all        - All above tasks except gitpull.
    allgit     - All above tasks.
    upload     - Upload Installer to Server (Master only).
    incbuild   - Increase build and commit (Master only).
    publish    - Publish a new version (Master only).

  where name=value may:
    unstable=true - Make unstable version (default).
    debug=true    - Make debug version.
    preview=true  - Make preview version.
    release=true  - Make release version.
    
    helpfile=true - Include help files (default when not unstable)." />
  </target>

  <!-- 准备构建 -->
  <target name="-prepare" >
    <echo  message="Run as master." if="ismaster" />
    <echo  message="version=${Ver.Str.Major}.${Ver.Str.Minor}" />
  </target>

  <!-- 清理目录 -->
  <target name="clean" depends="cleanbin,cleanobj" description="Clean output and temp files." >
  </target>

  <target name="cleanbin" description="Clean output files." >
    <delete dir="${bin}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <include name="Help/*.chm" />
    </delete>
  </target>

  <target name="cleanobj" description="Clean temp files." >
    <delete dir="${dcu}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <exclude name="Readme.txt" />
    </delete>
    <delete dir="${src}" >
       <include name="**/*.hpp" />
       <include name="**/*.drc" />
       <include name="**/*.rc" />
       <include name="**/*.mak" />
       <exclude name="**/*.template.*" />
    </delete>
    <delete dir="${tools}" >
       <include name="**/*.hpp" />
       <include name="**/*.drc" />
       <include name="**/*.rc" />
       <include name="**/*.mak" />
       <exclude name="**/*.template.*" />
    </delete>
    <delete dir="${cnvcl.src}" >
       <include name="**/*.hpp" />
       <include name="**/*.drc" />
       <include name="**/*.mak" />
       <exclude name="**/*.template.*" />
    </delete>
    <delete dir="${help}" >
       <include name="**/_errorlog.txt" />
    </delete>
  </target>

  <!-- 更新 svn 源码，目前暂不用了 -->
  <target name="svnupdate" ifndef="nosvn" description="Update all files. (Now NOT used)." >
    <exec basedir="${root}" errorlevel="1" defaultfilters="true"
          executable="${exe.svn}" if="ismaster" >
      <arg value="-R" />
      <arg value="revert" />
      <arg value="*.*" />
    </exec>
    <exec basedir="${root}" errorlevel="1" defaultfilters="true"
          executable="${exe.svn}" >
      <arg value="update" />
    </exec>
  </target>

  <!-- 更新 git 源码 -->
  <target name="gitpull" ifndef="nogit" description="Update all files." >
    <exec basedir="${cnvcl}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" if="ismaster" >
      <arg value="checkout" />
      <arg value="--" />
      <arg value="*" />
    </exec>
    <exec basedir="${cnvcl}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" >
      <arg value="pull" />
    </exec>
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" if="ismaster" >
      <arg value="checkout" />
      <arg value="--" />
      <arg value="*" />
    </exec>
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" >
      <arg value="pull" />
    </exec>
  </target>

  <!-- 编译 CnWizards DLLs -->
  <target name="cnwizards" depends="-cw_prepare,${cnwizards_list},-cw_final" description="Compile all CnWizards DLLs (D5, D6, etc.)." />

  <target name="d5" depends="-d5,-cw_final" description="Compile CnWizards for Delphi 5." />
  <target name="d6" depends="-d6,-cw_final" description="Compile CnWizards for Delphi 6." />
  <target name="d7" depends="-d7,-cw_final" description="Compile CnWizards for Delphi 7." />
  <target name="d2005" depends="-d2005,-cw_final" description="Compile CnWizards for Delphi 2005." />
  <target name="d2006" depends="-d2006,-cw_final" description="Compile CnWizards for Delphi 2006." />
  <target name="d2007" depends="-d2007,-cw_final" description="Compile CnWizards for RAD Studio 2007." />
  <target name="d2009" depends="-d2009,-cw_final" description="Compile CnWizards for RAD Studio 2009." />
  <target name="d2010" depends="-d2010,-cw_final" description="Compile CnWizards for RAD Studio 2010." />
  <target name="dxe" depends="-dxe,-cw_final" description="Compile CnWizards for RAD Studio XE." />
  <target name="dxe2" depends="-dxe2,-cw_final" description="Compile CnWizards for RAD Studio XE2." />
  <target name="dxe3" depends="-dxe3,-cw_final" description="Compile CnWizards for RAD Studio XE3." />
  <target name="dxe4" depends="-dxe4,-cw_final" description="Compile CnWizards for RAD Studio XE4." />
  <target name="dxe5" depends="-dxe5,-cw_final" description="Compile CnWizards for RAD Studio XE5." />
  <target name="dxe6" depends="-dxe6,-cw_final" description="Compile CnWizards for RAD Studio XE6." />
  <target name="dxe7" depends="-dxe7,-cw_final" description="Compile CnWizards for RAD Studio XE7." />
  <target name="cb5" depends="-cb5,-cw_final" description="Compile CnWizards for C++Builder 5." />
  <target name="cb6" depends="-cb6,-cw_final" description="Compile CnWizards for C++Builder 6." />

  <target name="-cw_prepare" depends="-prepare" >
    <copy tofile="${src}/Version.inc.old" unless="ismaster" >
       <include name="${src}/Version.inc" />
    </copy>
    <echo input="${src}/Version.template.inc" file="${src}/Version.inc" />
  </target>

  <target name="-cw_final" >
    <delete dir="${dcu}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <exclude name="Readme.txt" />
    </delete>
    <delete dir="${cnvcl.src}" >
       <include name="**/*.hpp" />
    </delete>
    <delete dir="${src}">
       <include name="**/*.hpp" />
    </delete>

    <delete dir="${src}" unless="ismaster" >
       <include name="Version.inc" />
    </delete>
    <move tofile="${src}/Version.inc" unless="ismaster" >
       <include name="${src}/Version.inc.old" />
    </move>
  </target>

  <target name="-d5" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For Delphi 5" />
    <property name="Ver.InternalName"     value="CnWizards_D5" />
    <property name="Ver.OriginalFilename" value="CnWizards_D5.DLL" />
    <copy tofile="${src}/CnWizards_D5.res.old" >
       <include name="${src}/CnWizards_D5.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D5.rc" />
    <brcc file="${src}/CnWizards_D5.rc" output="${src}/CnWizards_D5.res" />
    <dcc basedir="${src}" source="CnWizards_D5.dpr" versions="5" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D5.res" />
       <include name="CnWizards_D5.rc" />
       <include name="CnWizards_D5.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D5.res" >
       <include name="${src}/CnWizards_D5.res.old" />
    </move>
  </target>

  <target name="-d6" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For Delphi 6" />
    <property name="Ver.InternalName"     value="CnWizards_D6" />
    <property name="Ver.OriginalFilename" value="CnWizards_D6.DLL" />
    <copy tofile="${src}/CnWizards_D6.res.old" >
       <include name="${src}/CnWizards_D6.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D6.rc" />
    <brcc file="${src}/CnWizards_D6.rc" output="${src}/CnWizards_D6.res" />
    <dcc basedir="${src}" source="CnWizards_D6.dpr" versions="6" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D6.res" />
       <include name="CnWizards_D6.rc" />
       <include name="CnWizards_D6.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D6.res" >
       <include name="${src}/CnWizards_D6.res.old" />
    </move>
  </target>

  <target name="-d7" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For Delphi 7" />
    <property name="Ver.InternalName"     value="CnWizards_D7" />
    <property name="Ver.OriginalFilename" value="CnWizards_D7.DLL" />
    <copy tofile="${src}/CnWizards_D7.res.old" >
       <include name="${src}/CnWizards_D7.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D7.rc" />
    <brcc file="${src}/CnWizards_D7.rc" output="${src}/CnWizards_D7.res" />
    <dcc basedir="${src}" source="CnWizards_D7.dpr" versions="7" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D7.res" />
       <include name="CnWizards_D7.rc" />
       <include name="CnWizards_D7.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D7.res" >
       <include name="${src}/CnWizards_D7.res.old" />
    </move>
  </target>

  <target name="-d2005" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For Delphi 2005" />
    <property name="Ver.InternalName"     value="CnWizards_D2005" />
    <property name="Ver.OriginalFilename" value="CnWizards_D2005.DLL" />
    <copy tofile="${src}/CnWizards_D2005.res.old" >
       <include name="${src}/CnWizards_D2005.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D2005.rc" />
    <brcc file="${src}/CnWizards_D2005.rc" exename="${exe.brcc32}" output="${src}/CnWizards_D2005.res" />
    <dcc basedir="${src}" source="CnWizards_D2005.dpr" exename="${exe.D2005}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D2005.res" />
       <include name="CnWizards_D2005.rc" />
       <include name="CnWizards_D2005.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D2005.res" >
       <include name="${src}/CnWizards_D2005.res.old" />
    </move>
  </target>

  <target name="-d2006" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For Delphi 2006" />
    <property name="Ver.InternalName"     value="CnWizards_D2006" />
    <property name="Ver.OriginalFilename" value="CnWizards_D2006.DLL" />
    <copy tofile="${src}/CnWizards_D2006.res.old" >
       <include name="${src}/CnWizards_D2006.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D2006.rc" />
    <brcc file="${src}/CnWizards_D2006.rc" exename="${exe.brcc32}" output="${src}/CnWizards_D2006.res" />
    <dcc basedir="${src}" source="CnWizards_D2006.dpr" exename="${exe.D2006}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D2006.res" />
       <include name="CnWizards_D2006.rc" />
       <include name="CnWizards_D2006.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D2006.res" >
       <include name="${src}/CnWizards_D2006.res.old" />
    </move>
  </target>

  <target name="-d2007" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio 2007" />
    <property name="Ver.InternalName"     value="CnWizards_D2007" />
    <property name="Ver.OriginalFilename" value="CnWizards_D2007.DLL" />
    <copy tofile="${src}/CnWizards_D2007.res.old" >
       <include name="${src}/CnWizards_D2007.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D2007.rc" />
    <brcc file="${src}/CnWizards_D2007.rc" exename="${exe.brcc32}" output="${src}/CnWizards_D2007.res" />
    <dcc basedir="${src}" source="CnWizards_D2007.dpr" exename="${exe.D2007}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D2007.res" />
       <include name="CnWizards_D2007.rc" />
       <include name="CnWizards_D2007.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D2007.res" >
       <include name="${src}/CnWizards_D2007.res.old" />
    </move>
  </target>

  <target name="-d2009" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio 2009" />
    <property name="Ver.InternalName"     value="CnWizards_D2009" />
    <property name="Ver.OriginalFilename" value="CnWizards_D2009.DLL" />
    <copy tofile="${src}/CnWizards_D2009.res.old" >
       <include name="${src}/CnWizards_D2009.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D2009.rc" />
    <brcc file="${src}/CnWizards_D2009.rc" exename="${exe.brcc32}" output="${src}/CnWizards_D2009.res" />
    <dcc basedir="${src}" source="CnWizards_D2009.dpr" exename="${exe.D2009}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D2009.res" />
       <include name="CnWizards_D2009.rc" />
       <include name="CnWizards_D2009.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D2009.res" >
       <include name="${src}/CnWizards_D2009.res.old" />
    </move>
  </target>

  <target name="-d2010" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio 2010" />
    <property name="Ver.InternalName"     value="CnWizards_D2010" />
    <property name="Ver.OriginalFilename" value="CnWizards_D2010.DLL" />
    <copy tofile="${src}/CnWizards_D2010.res.old" >
       <include name="${src}/CnWizards_D2010.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_D2010.rc" />
    <brcc file="${src}/CnWizards_D2010.rc" exename="${exe.brcc32}" output="${src}/CnWizards_D2010.res" />
    <dcc basedir="${src}" source="CnWizards_D2010.dpr" exename="${exe.D2010}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_D2010.res" />
       <include name="CnWizards_D2010.rc" />
       <include name="CnWizards_D2010.drc" />
    </delete>
    <move tofile="${src}/CnWizards_D2010.res" >
       <include name="${src}/CnWizards_D2010.res.old" />
    </move>
  </target>

  <target name="-dxe" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE" />
    <property name="Ver.InternalName"     value="CnWizards_DXE" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE.DLL" />
    <copy tofile="${src}/CnWizards_DXE.res.old" >
       <include name="${src}/CnWizards_DXE.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE.rc" />
    <brcc file="${src}/CnWizards_DXE.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE.res" />
    <dcc basedir="${src}" source="CnWizards_DXE.dpr" exename="${exe.DXE}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE.res" />
       <include name="CnWizards_DXE.rc" />
       <include name="CnWizards_DXE.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE.res" >
       <include name="${src}/CnWizards_DXE.res.old" />
    </move>
  </target>
  
  <target name="-dxe2" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE2" />
    <property name="Ver.InternalName"     value="CnWizards_DXE2" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE2.DLL" />
    <copy tofile="${src}/CnWizards_DXE2.res.old" >
       <include name="${src}/CnWizards_DXE2.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE2.rc" />
    <brcc file="${src}/CnWizards_DXE2.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE2.res" />
    <dcc basedir="${src}" source="CnWizards_DXE2.dpr" exename="${exe.DXE2}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE2.res" />
       <include name="CnWizards_DXE2.rc" />
       <include name="CnWizards_DXE2.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE2.res" >
       <include name="${src}/CnWizards_DXE2.res.old" />
    </move>
  </target>

  <target name="-dxe3" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE3" />
    <property name="Ver.InternalName"     value="CnWizards_DXE3" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE3.DLL" />
    <copy tofile="${src}/CnWizards_DXE3.res.old" >
       <include name="${src}/CnWizards_DXE3.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE3.rc" />
    <brcc file="${src}/CnWizards_DXE3.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE3.res" />
    <dcc basedir="${src}" source="CnWizards_DXE3.dpr" exename="${exe.DXE3}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE3.res" />
       <include name="CnWizards_DXE3.rc" />
       <include name="CnWizards_DXE3.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE3.res" >
       <include name="${src}/CnWizards_DXE3.res.old" />
    </move>
  </target>

  <target name="-dxe4" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE4" />
    <property name="Ver.InternalName"     value="CnWizards_DXE4" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE4.DLL" />
    <copy tofile="${src}/CnWizards_DXE4.res.old" >
       <include name="${src}/CnWizards_DXE4.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE4.rc" />
    <brcc file="${src}/CnWizards_DXE4.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE4.res" />
    <dcc basedir="${src}" source="CnWizards_DXE4.dpr" exename="${exe.DXE4}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE4.res" />
       <include name="CnWizards_DXE4.rc" />
       <include name="CnWizards_DXE4.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE4.res" >
       <include name="${src}/CnWizards_DXE4.res.old" />
    </move>
  </target>

  <target name="-dxe5" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE5" />
    <property name="Ver.InternalName"     value="CnWizards_DXE5" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE5.DLL" />
    <copy tofile="${src}/CnWizards_DXE5.res.old" >
       <include name="${src}/CnWizards_DXE5.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE5.rc" />
    <brcc file="${src}/CnWizards_DXE5.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE5.res" />
    <dcc basedir="${src}" source="CnWizards_DXE5.dpr" exename="${exe.DXE5}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE5.res" />
       <include name="CnWizards_DXE5.rc" />
       <include name="CnWizards_DXE5.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE5.res" >
       <include name="${src}/CnWizards_DXE5.res.old" />
    </move>
  </target>

  <target name="-dxe6" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE6" />
    <property name="Ver.InternalName"     value="CnWizards_DXE6" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE6.DLL" />
    <copy tofile="${src}/CnWizards_DXE6.res.old" >
       <include name="${src}/CnWizards_DXE6.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE6.rc" />
    <brcc file="${src}/CnWizards_DXE6.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE6.res" />
    <dcc basedir="${src}" source="CnWizards_DXE6.dpr" exename="${exe.DXE6}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE6.res" />
       <include name="CnWizards_DXE6.rc" />
       <include name="CnWizards_DXE6.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE6.res" >
       <include name="${src}/CnWizards_DXE6.res.old" />
    </move>
  </target>

  <target name="-dxe7" depends="-cw_prepare" >
    <property name="Ver.FileDescription"  value="CnWizards For RAD Studio XE7" />
    <property name="Ver.InternalName"     value="CnWizards_DXE7" />
    <property name="Ver.OriginalFilename" value="CnWizards_DXE7.DLL" />
    <copy tofile="${src}/CnWizards_DXE7.res.old" >
       <include name="${src}/CnWizards_DXE7.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_DXE7.rc" />
    <brcc file="${src}/CnWizards_DXE7.rc" exename="${exe.brcc32}" output="${src}/CnWizards_DXE7.res" />
    <dcc basedir="${src}" source="CnWizards_DXE7.dpr" exename="${exe.DXE7}" usecfg="true" arguments="${dcc_arg}" >
      <define name="${define.add}" />
    </dcc>
    <delete dir="${src}">
       <include name="CnWizards_DXE7.res" />
       <include name="CnWizards_DXE7.rc" />
       <include name="CnWizards_DXE7.drc" />
    </delete>
    <move tofile="${src}/CnWizards_DXE7.res" >
       <include name="${src}/CnWizards_DXE7.res.old" />
    </move>
  </target>

  <target name="-cb5" depends="-cw_prepare" >
    <delete dir="${dcu}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <exclude name="Readme.txt" />
    </delete>

    <property name="Ver.FileDescription"  value="CnWizards For C++Builder 5" />
    <property name="Ver.InternalName"     value="CnWizards_CB5" />
    <property name="Ver.OriginalFilename" value="CnWizards_CB5.DLL" />
    <copy tofile="${src}/CnWizards_CB5.res.old" >
       <include name="${src}/CnWizards_CB5.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_CB5.rc" />
    <brcc file="${src}/CnWizards_CB5.rc" output="${src}/CnWizards_CB5.res" />

    <exec basedir="${src}" defaultfilters="true"
          executable="${ProgramFiles}\Borland\CBuilder5\Bin\bpr2mak.exe">
      <arg value='-t"${ProgramFiles}\Borland\CBuilder5\Bin\DEFAULT.BMK"' />
      <arg value="CnWizards_CB5.bpr" />
      <arg value="-q" />
    </exec>

    <!-- 替换掉编译宏 -->
    <echo input="${src}\CnWizards_CB5.mak" file="${src}\CnWizards_CB5.mak" />

    <exec basedir="${src}" defaultfilters="true"
          executable="${ProgramFiles}\Borland\CBuilder5\Bin\make.exe">
      <arg value="-fCnWizards_CB5.mak" />
    </exec>

    <delete dir="${src}">
       <include name="CnWizards_CB5.res" />
       <include name="CnWizards_CB5.rc" />
       <include name="CnWizards_CB5.mak" />
    </delete>
    <delete dir="${bin}">
       <include name="CnWizards_CB5.drc" />
       <include name="CnWizards_CB5.lib" />
       <include name="CnWizards_CB5.tds" />
    </delete>
    <move tofile="${src}/CnWizards_CB5.res" >
       <include name="${src}/CnWizards_CB5.res.old" />
    </move>
  </target>

  <target name="-cb6" depends="-cw_prepare" >
    <delete dir="${dcu}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <exclude name="Readme.txt" />
    </delete>

    <property name="Ver.FileDescription"  value="CnWizards For C++Builder 6" />
    <property name="Ver.InternalName"     value="CnWizards_CB6" />
    <property name="Ver.OriginalFilename" value="CnWizards_CB6.DLL" />
    <copy tofile="${src}/CnWizards_CB6.res.old" >
       <include name="${src}/CnWizards_CB6.res" />
    </copy>
    <echo input="${src}/CnWizards.template.rc" file="${src}/CnWizards_CB6.rc" />
    <brcc file="${src}/CnWizards_CB6.rc" output="${src}/CnWizards_CB6.res" />

    <exec basedir="${src}" defaultfilters="true"
          executable="${ProgramFiles}\Borland\CBuilder6\Bin\bpr2mak.exe">
      <arg value='-t"${ProgramFiles}\Borland\CBuilder6\Bin\DEFAULT.BMK"' />
      <arg value="CnWizards_CB6.bpr" />
      <arg value="-q" />
    </exec>

    <!-- 替换掉编译宏 -->
    <echo input="${src}\CnWizards_CB6.mak" file="${src}\CnWizards_CB6.mak" />

    <exec basedir="${src}" defaultfilters="true"
          executable="${ProgramFiles}\Borland\CBuilder6\Bin\make.exe">
      <arg value="-fCnWizards_CB6.mak" />
    </exec>

    <delete dir="${src}">
       <include name="CnWizards_CB6.res" />
       <include name="CnWizards_CB6.rc" />
       <include name="CnWizards_CB6.mak" />
    </delete>
    <delete dir="${bin}">
       <include name="CnWizards_CB6.drc" />
       <include name="CnWizards_CB6.lib" />
       <include name="CnWizards_CB6.tds" />
    </delete>
    <move tofile="${src}/CnWizards_CB6.res" >
       <include name="${src}/CnWizards_CB6.res.old" />
    </move>
  </target>

  <!-- 编译资源 DLL -->
  <target name="resdll" depends="-prepare" description="Compile CnWizards Resource DLL." >
    <dcc basedir="${tools}/CnWizRes" source="CnWizResGen.dpr" versions="5" usecfg="true" />

    <exec basedir="${tools}/CnWizRes" defaultfilters="true"
          executable="${tools}/CnWizRes/CnWizResGen.exe">
      <arg value="..\..\Bin\Icons\" />
      <arg value="CnWizIcons.rc" />
    </exec>

    <brcc file="${tools}/CnWizRes/CnWizIcons.rc" output="${tools}/CnWizRes/CnWizIcons.res" />

    <property name="Ver.FileDescription"  value="CnWizards Resource DLL" />
    <property name="Ver.InternalName"     value="CnWizRes" />
    <property name="Ver.OriginalFilename" value="CnWizRes.DLL" />
    <copy tofile="${tools}/CnWizRes/CnWizRes.res.old" >
       <include name="${tools}/CnWizRes/CnWizRes.res" />
    </copy>
    <echo input="${tools}/CnDll.template.rc" file="${tools}/CnWizRes/CnWizRes.rc" />
    <brcc file="${tools}/CnWizRes/CnWizRes.rc" output="${tools}/CnWizRes/CnWizRes.res" />

    <dcc basedir="${tools}/CnWizRes" source="CnWizRes.dpr" versions="5" usecfg="true" />

    <delete dir="${tools}/CnWizRes">
       <include name="*.exe" />
       <include name="*.res" />
       <include name="*.rc" />
       <include name="*.drc" />
       <include name="*.map" />
    </delete>
    <move tofile="${tools}/CnWizRes/CnWizRes.res" >
       <include name="${tools}/CnWizRes/CnWizRes.res.old" />
    </move>
  </target>
  
  <!-- 编译 ZIP DLL -->  
  <target name="cnwizhelperdll" depends="-prepare" description="Compile CnWizards Helper DLL." >
    <property name="Ver.FileDescription"  value="CnWizards Helper DLL" />
    <property name="Ver.InternalName"     value="CnWizHelper" />
    <property name="Ver.OriginalFilename" value="CnWizHelper.DLL" />
    <copy tofile="${tools}/CnWizHelper/CnWizHelper.res.old" >
       <include name="${tools}/CnWizHelper/CnWizHelper.res" />
    </copy>
    <echo input="${tools}/CnDll.template.rc" file="${tools}/CnWizHelper/CnWizHelper.rc" />
    <brcc file="${tools}/CnWizHelper/CnWizHelper.rc" output="${tools}/CnWizHelper/CnWizHelper.res" />
    <dcc basedir="${tools}/CnWizHelper" source="CnWizHelper.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnWizHelper">
       <include name="CnWizHelper.res" />
       <include name="CnWizHelper.rc" />
       <include name="CnWizHelper.drc" />
    </delete>
    <move tofile="${tools}/CnWizHelper/CnWizHelper.res" >
       <include name="${tools}/CnWizHelper/CnWizHelper.res.old" />
    </move>
  </target>

  <!-- 编译 CnPngLib DLL -->  
  <target name="cnpnglib" depends="-prepare" description="Compile CnPngLib DLL." >
    <property name="Ver.FileDescription"  value="CnPngLib DLL" />
    <property name="Ver.InternalName"     value="CnPngLib" />
    <property name="Ver.OriginalFilename" value="CnPngLib.DLL" />
    <copy tofile="${tools}/CnPngLib/CnPngLib.res.old" >
       <include name="${tools}/CnPngLib/CnPngLib.res" />
    </copy>
    <echo input="${tools}/CnDll.template.rc" file="${tools}/CnPngLib/CnPngLib.rc" />
    <brcc file="${tools}/CnPngLib/CnPngLib.rc" output="${tools}/CnPngLib/CnPngLib.res" />
    <dcc basedir="${tools}/CnPngLib" source="CnPngLib.dpr" exename="${exe.D2010}" usecfg="true" />
    <delete dir="${tools}/CnPngLib">
       <include name="CnPngLib.res" />
       <include name="CnPngLib.rc" />
       <include name="CnPngLib.drc" />
    </delete>
    <move tofile="${tools}/CnPngLib/CnPngLib.res" >
       <include name="${tools}/CnPngLib/CnPngLib.res.old" />
    </move>
  </target>

  <!-- 编译附加工具 -->
  <target name="tools" depends="-prepare,${tools_list}" description="Compile Tools (CnDfm6To5, CnWizSetup, etc.)." >
    <delete dir="${dcu}" >
       <exclude name="?svn" />
       <include name="*.*" />
       <exclude name="Readme.txt" />
    </delete>
  </target>

  <target name="cnconfigio" depends="-prepare" description="Compile CnConfigIO." >
    <property name="Ver.FileDescription"  value="CnWizards Configuration Import/Export Tool" />
    <property name="Ver.InternalName"     value="CnConfigIO" />
    <property name="Ver.OriginalFilename" value="CnConfigIO.EXE" />
    <copy tofile="${tools}/CnConfigIO/CnConfigIO.res.old" >
       <include name="${tools}/CnConfigIO/CnConfigIO.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnConfigIO/CnConfigIO.rc" />
    <brcc file="${tools}/CnConfigIO/CnConfigIO.rc" output="${tools}/CnConfigIO/CnConfigIO.res" />
    <dcc basedir="${tools}/CnConfigIO" source="CnConfigIO.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnConfigIO">
       <include name="CnConfigIO.res" />
       <include name="CnConfigIO.rc" />
       <include name="CnConfigIO.drc" />
    </delete>
    <move tofile="${tools}/CnConfigIO/CnConfigIO.res" >
       <include name="${tools}/CnConfigIO/CnConfigIO.res.old" />
    </move>
  </target>

  <target name="cndebugviewer" depends="-prepare" description="Compile CnDebugViewer." >
    <property name="Ver.FileDescription"  value="CnWizards Debug Viewer" />
    <property name="Ver.InternalName"     value="CnDebugViewer" />
    <property name="Ver.OriginalFilename" value="CnDebugViewer.EXE" />
    <copy tofile="${tools}/CnDebugViewer/CnDebugViewer.res.old" >
       <include name="${tools}/CnDebugViewer/CnDebugViewer.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnDebugViewer/CnDebugViewer.rc" />
    <brcc file="${tools}/CnDebugViewer/CnDebugViewer.rc" output="${tools}/CnDebugViewer/CnDebugViewer.res" />
    <dcc basedir="${tools}/CnDebugViewer" source="CnDebugViewer.dpr" versions="7" usecfg="true" />
    <delete dir="${tools}/CnDebugViewer">
       <include name="CnDebugViewer.res" />
       <include name="CnDebugViewer.rc" />
       <include name="CnDebugViewer.drc" />
    </delete>
    <move tofile="${tools}/CnDebugViewer/CnDebugViewer.res" >
       <include name="${tools}/CnDebugViewer/CnDebugViewer.res.old" />
    </move>
  </target>

  <target name="cndfm6to5" depends="-prepare" description="Compile CnDfm6To5." >
    <property name="Ver.FileDescription"  value="Delphi DFM Convertor" />
    <property name="Ver.InternalName"     value="CnDfm6To5" />
    <property name="Ver.OriginalFilename" value="CnDfm6To5.EXE" />
    <copy tofile="${tools}/CnDfm6To5/CnDfm6To5.res.old" >
       <include name="${tools}/CnDfm6To5/CnDfm6To5.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnDfm6To5/CnDfm6To5.rc" />
    <brcc file="${tools}/CnDfm6To5/CnDfm6To5.rc" output="${tools}/CnDfm6To5/CnDfm6To5.res" />
    <dcc basedir="${tools}/CnDfm6To5" source="CnDfm6To5.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnDfm6To5">
       <include name="CnDfm6To5.res" />
       <include name="CnDfm6To5.rc" />
       <include name="CnDfm6To5.drc" />
    </delete>
    <move tofile="${tools}/CnDfm6To5/CnDfm6To5.res" >
       <include name="${tools}/CnDfm6To5/CnDfm6To5.res.old" />
    </move>
  </target>

  <target name="cnascii" depends="-prepare" description="Compile CnAsciiChart." >
    <property name="Ver.FileDescription"  value="ASCII Chart" />
    <property name="Ver.InternalName"     value="cnascii" />
    <property name="Ver.OriginalFilename" value="AsciiChart.EXE" />
    <copy tofile="${tools}/CnAsciiChart/AsciiChart.res.old" >
       <include name="${tools}/CnAsciiChart/AsciiChart.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnAsciiChart/AsciiChart.rc" />
    <brcc file="${tools}/CnAsciiChart/AsciiChart.rc" output="${tools}/CnAsciiChart/AsciiChart.res" />
    <dcc basedir="${tools}/CnAsciiChart" source="AsciiChart.dpr" versions="7" usecfg="true" />
    <delete dir="${tools}/CnAsciiChart">
       <include name="AsciiChart.res" />
       <include name="AsciiChart.rc" />
       <include name="AsciiChart.drc" />
    </delete>
    <move tofile="${tools}/CnAsciiChart/AsciiChart.res" >
       <include name="${tools}/CnAsciiChart/AsciiChart.res.old" />
    </move>
  </target>

  <target name="cnidebr" depends="-prepare" description="Compile CnIdeBRTool." >
    <property name="Ver.FileDescription"  value="IDE Backup/Restore Tool" />
    <property name="Ver.InternalName"     value="cnidebr" />
    <property name="Ver.OriginalFilename" value="CnIdeBRTool.EXE" />
    <copy tofile="${tools}/CnIdeBRTool/CnIdeBRTool.res.old" >
       <include name="${tools}/CnIdeBRTool/CnIdeBRTool.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnIdeBRTool/CnIdeBRTool.rc" />
    <brcc file="${tools}/CnIdeBRTool/CnIdeBRTool.rc" output="${tools}/CnIdeBRTool/CnIdeBRTool.res" />
    <dcc basedir="${tools}/CnIdeBRTool" source="CnIdeBRTool.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnIdeBRTool">
       <include name="CnIdeBRTool.res" />
       <include name="CnIdeBRTool.rc" />
       <include name="CnIdeBRTool.drc" />
    </delete>
    <move tofile="${tools}/CnIdeBRTool/CnIdeBRTool.res" >
       <include name="${tools}/CnIdeBRTool/CnIdeBRTool.res.old" />
    </move>
  </target>
  
  <target name="cnmanagewiz" depends="-prepare" description="Compile CnManageWiz." >
    <property name="Ver.FileDescription"  value="External Wizard Management" />
    <property name="Ver.InternalName"     value="cnmanagewiz" />
    <property name="Ver.OriginalFilename" value="CnManageWiz.EXE" />
    <copy tofile="${tools}/CnManageWiz/CnManageWiz.res.old" >
       <include name="${tools}/CnManageWiz/CnManageWiz.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnManageWiz/CnManageWiz.rc" />
    <brcc file="${tools}/CnManageWiz/CnManageWiz.rc" output="${tools}/CnManageWiz/CnManageWiz.res" />
    <dcc basedir="${tools}/CnManageWiz" source="CnManageWiz.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnManageWiz">
       <include name="CnManageWiz.res" />
       <include name="CnManageWiz.rc" />
       <include name="CnManageWiz.drc" />
    </delete>
    <move tofile="${tools}/CnManageWiz/CnManageWiz.res" >
       <include name="${tools}/CnManageWiz/CnManageWiz.res.old" />
    </move>
  </target>
  
  <target name="cnselectlang" depends="-prepare" description="Compile CnSelectLang." >
    <property name="Ver.FileDescription"  value="Select CnWizards Language" />
    <property name="Ver.InternalName"     value="CnSelectLang" />
    <property name="Ver.OriginalFilename" value="CnSelectLang.EXE" />
    <copy tofile="${tools}/CnSelectLang/CnSelectLang.res.old" >
       <include name="${tools}/CnSelectLang/CnSelectLang.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnSelectLang/CnSelectLang.rc" />
    <brcc file="${tools}/CnSelectLang/CnSelectLang.rc" output="${tools}/CnSelectLang/CnSelectLang.res" />
    <dcc basedir="${tools}/CnSelectLang" source="CnSelectLang.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnSelectLang">
       <include name="CnSelectLang.res" />
       <include name="CnSelectLang.rc" />
       <include name="CnSelectLang.drc" />
    </delete>
    <move tofile="${tools}/CnSelectLang/CnSelectLang.res" >
       <include name="${tools}/CnSelectLang/CnSelectLang.res.old" />
    </move>
  </target>
  
  <target name="cnsmr" depends="-prepare" description="Compile Relation Analyzer." >
    <property name="Ver.FileDescription"  value="Relation Analyzer" />
    <property name="Ver.InternalName"     value="CnSMR" />
    <property name="Ver.OriginalFilename" value="CnSMR.EXE" />
    <copy tofile="${tools}/CnSMR/CnSMR.res.old" >
       <include name="${tools}/CnSMR/CnSMR.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnSMR/CnSMR.rc" />
    <brcc file="${tools}/CnSMR/CnSMR.rc" output="${tools}/CnSMR/CnSMR.res" />
    <dcc basedir="${tools}/CnSMR" source="CnSMR.dpr" versions="5" usecfg="true" />
    <delete dir="${tools}/CnSMR">
       <include name="CnSMR.res" />
       <include name="CnSMR.rc" />
       <include name="CnSMR.drc" />
    </delete>
    <move tofile="${tools}/CnSMR/CnSMR.res" >
       <include name="${tools}/CnSMR/CnSMR.res.old" />
    </move>
  </target>

  <target name="cnwizsetup" depends="-prepare" description="Compile CnWizards Setup." >
    <property name="Ver.FileDescription"  value="CnWizards Installer" />
    <property name="Ver.InternalName"     value="Setup" />
    <property name="Ver.OriginalFilename" value="Setup.EXE" />
    <copy tofile="${tools}/CnWizSetup/Setup.res.old" >
       <include name="${tools}/CnWizSetup/Setup.res" />
    </copy>
    <echo input="${tools}/CnTools.template.rc" file="${tools}/CnWizSetup/Setup.rc" />
    <brcc file="${tools}/CnWizSetup/Setup.rc" output="${tools}/CnWizSetup/Setup.res" />
    <dcc basedir="${tools}/CnWizSetup" source="Setup.dpr" versions="7" usecfg="true" />
    <delete dir="${tools}/CnWizSetup">
       <include name="Setup.res" />
       <include name="Setup.rc" />
       <include name="Setup.drc" />
    </delete>
    <move tofile="${tools}/CnWizSetup/Setup.res" >
       <include name="${tools}/CnWizSetup/Setup.res.old" />
    </move>
  </target>

  <!-- 编译帮助文件 -->
  <target name="makehelp" depends="-prepare,help_chs,help_cht,help_enu" description="Compile all chm help files." >
  </target>

  <target name="help_chs" depends="-prepare" description="Compile Chinese chm help (GB2312)." >
    <exec basedir="${help}/CnWizards_CHS" errorlevel="1" defaultfilters="true"
          executable="${ProgramFiles}\HTML Help Workshop\hhc">
      <arg value="CnWizards.hhp" />
    </exec>
    <delete dir="${help}/CnWizards_CHS">
       <include name="_errorlog.txt" />
    </delete>
  </target>

  <target name="help_cht" depends="-prepare" description="Compile Chinese chm help (BIG5)." >
    <exec basedir="${help}/CnWizards_CHT" errorlevel="1" defaultfilters="true"
          executable="${ProgramFiles}\HTML Help Workshop\hhc">
      <arg value="CnWizards.hhp" />
    </exec>
    <delete dir="${help}/CnWizards_CHT">
       <include name="_errorlog.txt" />
    </delete>
  </target>

  <target name="help_enu" depends="-prepare" description="Compile English chm help." >
    <exec basedir="${help}/CnWizards_ENU" errorlevel="1" defaultfilters="true"
          executable="${ProgramFiles}\HTML Help Workshop\hhc">
      <arg value="CnWizards.hhp" />
    </exec>
    <delete dir="${help}/CnWizards_ENU">
       <include name="_errorlog.txt" />
    </delete>
  </target>

  <!-- 制作安装程序 -->
  <target name="makeinst" depends="-prepare" description="Build CnWizards Installer." >
    <exec basedir="${install.src}" defaultfilters="true"
          executable="${ProgramFiles}\NSIS\makensis" >
      <arg value="/DVER_MAJOR=${Ver.Str.Major}" />
      <arg value="/DVER_MINOR=${Ver.Str.Minor}" />
      <arg value="${install_arg}" />
      <arg value="${install_dbg}" />
      <arg value="${install_lite}" />
      <arg value="CnWizards_Install.nsi" />
    </exec>
  </target>

  <!--
  <target name="zip" >
    <delete file="${zipfile}" />
    <zip zipfile="${zipfile}" >
      <include name="${root}/**" />
    </zip>
  </target>
  -->

  <!-- 完整构建 -->
  <target name="all" depends="-prepare,clean,${all_list}" description="All above tasks except gitpull." >
  </target>

  <!-- 带 git 更新的完整构建 -->
  <target name="allgit" depends="-prepare,clean,gitpull,${all_list}" description="All above tasks." >
  </target>

  <!-- FTP 上传服务器 -->
  <target name="upload_ftp" depends="-prepare" if="ismaster" description="Upload Installer to FTP Server (Master only)." >
    <ftp server="www.cnpack.org" userid="?{${master.ini}:Master:ftpuser}" password="?{${master.ini}:Master:ftppass}" >
      <cd dir="${ftpdir}" />
      <put basedir="${install.output}" src="${Installer.Name}" />
    </ftp>
  </target>

  <!-- 上传到 Google Code 服务器 -->
  <target name="upload_google" depends="-prepare" if="ismaster" description="Upload Installer to Google Code Server (Master only)." >
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.python}" >
      <arg value="Make/googlecode_upload.py" />
      <arg value="-s" />
      <arg value='"${Installer.Name}"' />
      <arg value="-p" />
      <arg value="cnpack" />
      <arg value="-u" />
      <arg value="?{${master.ini}:GoogleCode:user}" />
      <arg value="-w" />
      <arg value="?{${master.ini}:GoogleCode:password}" />
      <arg value="-l" />
      <arg value='"${release.labels}"' />
      <arg value="Install/Output/${Installer.Name}" />
    </exec>
  </target>

  <target name="upload" depends="-prepare,upload_ftp,upload_google" if="ismaster" description="Upload Installer to FTP and Google Code Servers (Master only)." />
  
  <!-- 更新 build 号及提交文件 -->
  <target name="incbuild" depends="-prepare" if="ismaster" description="Increase build and commit (Master only)." >
    <ini file="${ini}" >
      <write section="Version" key="Major" value="${Ver.Major}" />
      <write section="Version" key="Minor" value="${Ver.Minor}" />
      <write section="Version" key="Release" value="${Ver.Release}" />
      <write section="Version" key="Build" value="${Ver.Build}" />
      <write section="Version" key="LastDate" value="${date.curr}" />
    </ini>
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" >
      <arg value="add" />
      <arg value="Make/release.ini" />
      <arg value="Source/Version.inc" />
    </exec>
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" >
      <arg value="commit" />
      <arg value="-m" />
      <arg value='"Commit version files: ${Ver.Str.Major}.${Ver.Str.Minor}"' />
    </exec>
    <exec basedir="${basedir}" errorlevel="1" defaultfilters="true"
          executable="${exe.git}" >
      <arg value="push" />
    </exec>
  </target>

  <!-- 完整构建并发布 -->
  <target name="publish" depends="allgit,incbuild,upload" description="Publish a new version (Master only)." >
  </target>
</project>
