
# This makefile includes all default values used to configure AWS. You can
# update variables here or set the corresponding variable on the command
# line. You should not have do change the main makefile.
#
# IMPORTANT: each time you change the definitions here make sure you run
#            $ make setup

##############################################################################
# AWS will be installed under $(prefix). Update this variable to point to
# the install directory. You probably want to set this to the GNAT root
# directory to have AWS project files automatically available.
#
prefix	 = $(dir $(shell which gnatls))..

##############################################################################
# Set to true if the AWS shared runtime must be built. If ENABLE_SHARED is
# set to false on the static version is built. The default value is true if
# the platform supports shared libraries.
#
# ENABLE_SHARED = [true|false]
#
ENABLE_SHARED=$(shell $(GNAT) make -c -q -p \
		-Pconfig/src/test_shared 2>/dev/null && echo "true")

##############################################################################
# Specify the default library type to setup for the installed AWS project.
#
# DEFAULT_LIBRARY_TYPE = [static|relocatable]
#
DEFAULT_LIBRARY_TYPE = static

##############################################################################
# XMLADA optional, needed if you want to build SOAP's AWS support. Set XMLADA
# to true to activate XML/Ada support, you must also set ADA_PROJECT_PATH
# to point to the XML/Ada project files if not installed in the standard
# location.
#
# XMLADA = [true/false]
#
XMLADA	= $(shell $(GNAT) make -c -q -p \
		-Pconfig/src/test_xmlada 2>/dev/null && echo "true")

##############################################################################
# ASIS optional, needed if you want to build ada2wsdl tool. This tool can be
# used to create a WSDL document from an Ada spec. Set ASIS to true to
# activate ASIS support. You must also set ADA_PROJECT_PATH to point to the
# ASIS project files if not installed in the standard location.
#
# If you activate ASIS you also need to activate XMLADA above.
#
# ASIS = [true|false]
#
ASIS	= $(shell $(GNAT) make -c -q -p \
		-Pconfig/src/test_asis 2>/dev/null && echo "true")

##############################################################################
# DEMOS optional, whether the demos are built or not
#
# DEMOS = [true|false]
#
DEMOS	= false

##############################################################################
# IPv6, optional. If you want to use IPv6 sockets just uncomment the IPv6
# variable below.
#
# IPv6 = [true|false]
#
IPv6	= false

##############################################################################
# AWS supports SSL (Secure Socket Layer). The SSL support is always built-in
# AWS. To build AWS's demos will SSL support you need to set SOCKET to ssl, in
# this case you must have installed OpenSSL on you computer. OpenSSL libraries
# are distributed on Windows platforms therefore the SSL mode is the default
# on this platform. (note that below ssl and openssl are aliases).
#
# SOCKET = [std|openssl|gnutls]
#
SOCKET	= std

##############################################################################
# AWS provides a binding to the LDAP API. This binding will use the standard
# LDAP DLL provided with Windows OS. On GNU/Linux you need to install OpenLDAP
# if it is not already installed. If LDAP is installed on your system you can
# set LDAP=true below.
#
# LDAP = [true|false]
#
LDAP	= false

##############################################################################
# To activate the debug mode just uncomment the variable below. This will
# build AWS with debug information and will output more build information.
#
# DEBUG = [true|false]
#
DEBUG	= false

##############################################################################
# Number of parallel compilations to do.
#
CJOBS	= 2

##############################################################################
# Tools used by AWS
#
AR 		  = ar
AWK               = awk
CHMOD	 	  = chmod
CP	 	  = cp -p
DLLTOOL	 	  = dlltool
GNAT		  = gnat
GCC		  = gcc
GPRBUILD	  = gprbuild
GPRCLEAN	  = gprclean
GREP		  = grep
GZIP	 	  = gzip
MKDIR	 	  = mkdir -p
MV	 	  = mv
PYTHON            = python
RM	 	  = rm
SED	 	  = sed
TAR	 	  = tar
WINDRES	 	  = windres
CAT		  = cat
STRIP		  = strip

UNAME = $(shell uname)

ifeq ($(UNAME), SunOS)
DIFF	=	diff -w
else
DIFF	=	diff -w -c
endif

##############################################################################
# Consistency checks

ifneq ($(DEBUG), true)
ifneq ($(DEBUG), false)
$(error DEBUG variable must be set to true or false)
endif
endif

ifneq ($(IPv6), true)
ifneq ($(IPv6), false)
$(error IPv6 variable must be set to true or false)
endif
endif

ifeq  ($(ENABLE_SHARED), )
ENABLE_SHARED=false
endif

ifeq  ($(XMLADA), )
XMLADA=false
endif

ifeq  ($(ASIS), )
ASIS=false
endif

ifneq ($(ENABLE_SHARED), true)
ifneq ($(ENABLE_SHARED), false)
$(error ENABLE_SHARED variable must be set to true or false)
endif
endif

ifneq ($(DEFAULT_LIBRARY_TYPE), static)
ifneq ($(DEFAULT_LIBRARY_TYPE), relocatable)
$(error DEFAULT_LIBRARY_TYPE variable must be set to static or relocatable)
endif
endif

ifneq ($(DEMOS), true)
ifneq ($(DEMOS), false)
$(error DEMOS variable must be set to true or false)
endif
endif

ifneq ($(ASIS), true)
ifneq ($(ASIS), false)
$(error ASIS variable must be set to true or false)
endif
endif

ifneq ($(XMLADA), true)
ifneq ($(XMLADA), false)
$(error XMLADA variable must be set to true or false)
endif
endif

ifneq ($(LDAP), true)
ifneq ($(LDAP), false)
$(error LDAP variable must be set to true or false)
endif
endif

ifeq ($(ASIS), true)
ifeq ($(XMLADA), false)
$(error ASIS is set and requires XMLADA to be installed. \
	You may be missing XMLADA=true)
endif
endif

ifneq ($(SOCKET), std)
ifneq ($(SOCKET), openssl)
ifneq ($(SOCKET), gnutls)
$(error SOCKET variable must be set to std, openssl or gnutls)
endif
endif
endif

ifneq ($(INSTALL), )
$(error INSTALL variable is deprecated, please use prefix instead)
endif

ifneq ($(SHARED), )
$(error SHARED variable is deprecated, please use ENABLE_SHARED instead)
endif

ifeq ("$(prefix)", "..")
$(error "Wrong install path : prefix='$(prefix)', \
  Check that GNAT is in the PATH")
else
ifeq ("$(prefix)", "")
$(error "Wrong install path : empty prefix variable")
endif
endif
