echo off
rem
rem Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
rem Copyright (C) 2001-2002  Internet Software Consortium.
rem
rem Permission to use, copy, modify, and distribute this software for any
rem purpose with or without fee is hereby granted, provided that the above
rem copyright notice and this permission notice appear in all copies.
rem 
rem THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
rem REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
rem AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
rem INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
rem LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
rem OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
rem PERFORMANCE OF THIS SOFTWARE.

rem BuildAll.bat
rem This script sets up the files necessary ready to build BIND 9
rem and then builds all of the binaries that make up the installation kit.
rem This requires perl to be installed on the system.

rem IMPORTANT NOTE:
rem OpenSSL is a prerequisite for building and running this release of
rem BIND 9. You must fetch the OpenSSL sources yourself from
rem http://www.OpenSSL.org/ and compile it yourself.  The code must reside
rem at the same level as the bind 9.2.0 source tree and it's top-level
rem directory be named openssl-0.9.6k. This restriction will be lifted in
rem a future release of BIND 9 for Windows NT/2000/XP.

echo Setting up the BIND files required for the build

rem Setup the files
call BuildSetup.bat

echo Build all of the Library files

cd ..\..\lib

cd isc\win32
nmake /nologo -f libisc.mak CFG="libisc - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd dns\win32
nmake /nologo -f libdns.mak CFG="libdns - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd isccfg\win32
nmake /nologo -f libisccfg.mak CFG="libisccfg - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd isccc\win32
nmake /nologo -f libisccc.mak CFG="libisccc - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd bind9\win32
nmake /nologo -f libbind9.mak CFG="libbind9 - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd lwres\win32
nmake /nologo -f liblwres.mak CFG="liblwres - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

@IF TESTS
cd tests\win32
nmake /nologo -f libtests.mak CFG="libtests - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..
@END TESTS

rem This is the DLL required for the event Viewer

cd win32\bindevt
nmake /nologo -f bindevt.mak CFG="bindevt - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd ..

echo Now build the apps

cd bin

cd named\win32
nmake /nologo -f named.mak CFG="named - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"

cd ..\..

cd rndc\win32
nmake /nologo -f rndc.mak CFG="rndc - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"

cd ..\..

cd confgen\win32
nmake /nologo -f rndcconfgen.mak CFG="rndcconfgen - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f ddnsconfgen.mak CFG="ddnsconfgen - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"

cd ..\..

cd dig\win32
nmake /nologo -f dig.mak CFG="dig - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo /nologo -f host.mak CFG="host - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f nslookup.mak CFG="nslookup - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd nsupdate\win32
nmake /nologo -f nsupdate.mak CFG="nsupdate - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd check\win32
nmake /nologo -f checkconf.mak CFG="checkconf - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f checkzone.mak CFG="checkzone - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd dnssec\win32
nmake /nologo -f keygen.mak CFG="keygen - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f signzone.mak CFG="signzone - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f dsfromkey.mak CFG="dsfromkey - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f keyfromlabel.mak CFG="keyfromlabel - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f revoke.mak CFG="revoke - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f settime.mak CFG="settime - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f verify.mak CFG="verify - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f importkey.mak CFG="importkey - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

@IF PKCS11
cd pkcs11\win32
nmake /nologo -f pk11keygen.mak CFG="pk11keygen - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f pk11list.mak CFG="pk11list - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f pk11destroy.mak CFG="pk11destroy - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..
@END PKCS11

cd tools\win32
nmake /nologo -f arpaname.mak CFG="arpaname - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f genrandom.mak CFG="genrandom - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f nsec3hash.mak CFG="nsec3hash - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f journalprint.mak CFG="journalprint - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f ischmacfixup.mak CFG="ischmacfixup - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

@IF TESTS
cd tests
@IF ATOMIC
cd atomic\win32
nmake /nologo -f t_atomic.mak CFG="t_atomic - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..
@END ATOMIC

cd db\win32
nmake /nologo -f t_db.mak CFG="t_db - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd dst\win32
nmake /nologo -f t_dst.mak CFG="t_dst - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd master\win32
nmake /nologo -f t_master.mak CFG="t_master - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd mem\win32
nmake /nologo -f t_mem.mak CFG="t_mem - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd hashes\win32
nmake /nologo -f t_hashes.mak CFG="t_hashes - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd names\win32
nmake /nologo -f t_names.mak CFG="t_names - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd rbt\win32
nmake /nologo -f t_rbt.mak CFG="t_rbt - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd resolver\win32
nmake /nologo -f t_resolver.mak CFG="t_resolver - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd sockaddr\win32
nmake /nologo -f t_sockaddr.mak CFG="t_sockaddr - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd tasks\win32
nmake /nologo -f t_tasks.mak CFG="t_tasks - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd timers\win32
nmake /nologo -f t_timers.mak CFG="t_timers - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd ..
@END TESTS

@IF XTESTS
cd tests\win32
nmake /nologo -f backtrace_test.mak CFG="backtrace_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f inter_test.mak CFG="inter_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f rwlock_test.mak CFG="rwlock_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f shutdown_test.mak CFG="shutdown_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f sock_test.mak CFG="sock_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f task_test.mak CFG="task_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
nmake /nologo -f timer_test.mak CFG="timer_test - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..
@END XTESTS

rem This is the BIND 9 Installer

cd win32\BINDInstall
nmake /nologo -f BINDInstall.mak CFG="BINDInstall - @PLATFORM@ Release"  NO_EXTERNAL_DEPS="1"
cd ..\..

cd ..

cd win32utils\legacy

call BuildPost.bat

echo Done.

rem exit here.
