#//////////////////////////////////////////////////////////////////////////////
#
# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
#                         Tassilo Philipp <tphilipp@potion-studios.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#//////////////////////////////////////////////////////////////////////////////

#///////////////////////////////////////////////////
#
#	nmake rules
#	prolog.nmake
#
#///////////////////////////////////////////////////


.SILENT:

# Default "build all" target.
all: configure build


# Check if library has been 'configured' properly. If not, tell the user and abort.
!IF !DEFINED(CONFIG_OS) || !DEFINED(CONFIG_ARCH)
configure: $(TOP)\ConfigVars
$(TOP)\ConfigVars:
	echo "Library not configured properly! Run configure.bat from the library's root directory first!"
!ELSE
configure:
!ENDIF


# Include config rules.
!IF EXISTS($(TOP)\ConfigVars)
!  INCLUDE $(TOP)\ConfigVars
!ENDIF

# Include site rules.
!IF EXISTS($(TOP)\SiteVars)
!  INCLUDE $(TOP)\SiteVars
!ENDIF

# set BUILD_* from CONFIG_* variables
!IF !DEFINED(BUILD_HOST)
BUILD_HOST = $(CONFIG_HOST)
!ENDIF
!IF !DEFINED(BUILD_OS)
BUILD_OS = $(CONFIG_OS)
!ENDIF
!IF !DEFINED(BUILD_ARCH)
BUILD_ARCH = $(CONFIG_ARCH)
!ENDIF
!IF !DEFINED(BUILD_TOOL)
BUILD_TOOL = $(CONFIG_TOOL)
!ENDIF
!IF !DEFINED(BUILD_ASM)
BUILD_ASM = $(CONFIG_ASM)
!ENDIF
!IF !DEFINED(BUILD_CONFIG)
BUILD_CONFIG = $(CONFIG_CONFIG)
!ENDIF

!IF "$(BUILD_TOOL)" != ""
!  INCLUDE tool_$(BUILD_TOOL).nmake
!ENDIF
