#
# The Apache Software License, Version 1.1
#
# Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# 3. The end-user documentation included with the redistribution,
#    if any, must include the following acknowledgment:
#       "This product includes software developed by the
#        Apache Software Foundation (http://www.apache.org/)."
#    Alternately, this acknowledgment may appear in the software itself,
#    if and wherever such third-party acknowledgments normally appear.
#
# 4. The names "Xerces" and "Apache Software Foundation" must
#    not be used to endorse or promote products derived from this
#    software without prior written permission. For written
#    permission, please contact apache\@apache.org.
#
# 5. Products derived from this software may not be called "Apache",
#    nor may "Apache" appear in their name, without prior written
#    permission of the Apache Software Foundation.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation, and was
# originally based on software copyright (c) 1999, International
# Business Machines, Inc., http://www.ibm.com .  For more information
# on the Apache Software Foundation, please see
# <http://www.apache.org/>.
#
#
# $Log: Makefile.in,v $
# Revision 1.13  2002/08/19 19:38:17  tng
# [Bug 11771] Linux specific IconvGNU transcoder.  Patch from Vasily Tchekalkin.
#
# Revision 1.12  2002/08/19 18:35:56  tng
# [Bug 6467] Installing Xerces C++ on cygwin environment.  Patch from Derek Harmon.
#
# Revision 1.11  2002/07/26 16:49:27  tng
# [Bug 2681] Can't build with gcc/g++ not named 'gcc'/'g++'.  Patch from Jonathan Lennox.
#
# Revision 1.10  2002/07/18 21:57:27  knoaman
# Makefile update.
#
# Revision 1.9  2002/07/10 12:56:45  tng
# [Bug 9154] Requesting Xerces Version Macro.
#
# Revision 1.8  2002/06/18 19:59:12  knoaman
# Remove DOMInputSourceWrapper.
#
# Revision 1.7  2002/06/12 17:10:16  tng
# Add KeyRefPair (similar to KeyValuePair but using reference instead of value).
#
# Revision 1.6  2002/05/29 21:47:08  knoaman
# DOM L3 LS: DOMInputSource, DOMEntityResolver, DOMImplementationLS and DOMBuilder
#
# Revision 1.5  2002/05/24 16:42:20  knoaman
# Performance fixes: eliminate mulitple calls to addRange and sort.
#
# Revision 1.4  2002/04/16 20:10:48  peiyongz
# Bug#8168: Error when attempting to build NetAccessors
#
# Revision 1.3  2002/02/18 06:36:44  jberry
# Modify Mac OS X "unix" build to use new MacOSURLAccessCF NetAccessor.
# This means that Xerces no longer relies on the Carbon.framework and
# links only to CoreServices.framework, which allows it to be called
# from a remote context where no GUI is available.
#
# Revision 1.2  2002/02/11 18:19:19  tng
# [Bug 2715] Build recursion suppresses make failures.
#
# Revision 1.1.1.1  2002/02/01 22:22:11  peiyongz
# sane_include
#
# Revision 1.52  2001/12/03 14:45:11  tng
# FreeBSD native transcoder (IconvFBSD) added by Max Gotlib.
#
# Revision 1.51  2001/11/19 21:59:00  peiyongz
# Reorganization: Double/Float
#
# Revision 1.50  2001/11/12 20:36:54  peiyongz
# SchemaDateTimeException defined
#
# Revision 1.49  2001/11/07 19:16:03  peiyongz
# DateTime Port
#
# Revision 1.48  2001/10/23 23:09:32  peiyongz
# [Bug#880] patch to PlatformUtils:init()/term() and related. from Mark Weaver
#
# Revision 1.47  2001/10/02 16:07:45  tng
# typo: fix extra spaces after the separator that led to make error
#
# Revision 1.46  2001/09/27 14:54:03  peiyongz
# DTV Reorganization: new class
#
# Revision 1.45  2001/08/17 14:06:59  peiyongz
# Typo: XMLHashCMStateSet.hpp -> HashCMStateSet.hpp
#
# Revision 1.44  2001/08/16 21:54:16  peiyongz
# new class creation
#
# Revision 1.43  2001/08/10 16:42:33  peiyongz
# XMLUri Added
#
# Revision 1.42  2001/07/26 20:40:01  peiyongz
# XMLFloat
#
# Revision 1.41  2001/07/24 20:39:44  peiyongz
# XMLDouble
#
# Revision 1.40  2001/07/06 17:11:58  tng
# Automatic build of single-threaded library.  By Martin Kalen.
#
# Revision 1.39  2001/06/27 17:08:30  tng
# [Bug 1147] Headers install in wrong directory.  By Murray Cumming.
#
# Revision 1.38  2001/06/11 15:15:45  knoaman
# StringTokenizer renamed to XMLStringTokenizer.
#
# Revision 1.37  2001/06/06 13:13:58  tng
# Fix regression where TRANSCODERMODULE is not assigned if TRANSCODE == NATIVE.
#
# Revision 1.36  2001/06/05 19:35:51  jberry
# Add support for Mac OS X command line configuration and build.
#
# Revision 1.35  2001/05/16 15:25:40  tng
# Schema: Add Base64 and HexBin.  By Pei Yong Zhang.
#
# Revision 1.34  2001/05/11 13:26:27  tng
# Copyright update.
#
# Revision 1.33  2001/05/10 20:51:18  tng
# Schema: Add DecimalDatatypeValidator and XMLBigDecimal, XMLBigInteger.  By Pei Yong Zhang.
#
# Revision 1.32  2001/04/19 17:47:56  knoaman
# A string tokenizer utility.
#
# Revision 1.31  2001/03/21 21:56:11  tng
# Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
#
# Revision 1.30  2001/03/02 20:06:19  knoaman
# Schema: Regular expression project and configuration file changes
#
# Revision 1.29  2001/03/02 14:39:13  tng
# Enabling libWWW NetAccessor support under UNIX. Tested with latest tarball of libWWW
# (w3c-libwww-5.3.2) under RedHat Linux 6.1.  Added by Martin Kalen.
#
# There is one MAJOR problem with the use of libwww and the patches
# below, which someone with knowledge of libwww filters etc. might want
# to look into. Default behavior for content-type text/xml is to consume
# all xml data before it reaches the simple HTML presenter. Hence, only
# files with content-type text/html will actually reach the xerces-c
# library. If you have a *.xml file on the webbserver, processing of the
# file will throw an exception stating "The main XML document cannot be
# empty" (correct in a xerces point of view since if you enable debug
# build you will see that libwww "eats" all text/xml).
#
# See "Diffs for enabling libWWW NetAccessor support under UNIX" posted in March 1, 2001
# in the xerces-c-dev mailing list for further information.
#
# Revision 1.28  2001/02/27 18:23:59  tng
# Schema: Add utility RefHash2KeysTableOf.
#
# Revision 1.27  2001/02/26 19:44:23  tng
# Schema: add utility class QName, by Pei Yong Zhang.
#
# Revision 1.26  2001/02/15 18:41:41  tng
# Schema: Exception Handling added by Pei Yong Zhang.  Add NumberFormatException, ParseException,
# InvalidDatatypeFacetException, and InvalidDatatypeValueException.  The associated
# Makefile.in and configure.in are updated.
#
# Revision 1.25  2000/07/25 22:28:15  aruna1
# Char definitions in XMLUni moved to XMLUniDefs
#
# Revision 1.24  2000/06/27 22:11:41  jpolast
# added HashBase, HashXMLCh, HashPtr
#
# Revision 1.23  2000/05/02 19:22:55  aruna1
# Unix related changes in.
#
# Revision 1.22  2000/03/20 23:48:50  rahulj
# Added Socket based NetAccessor. This will enable one to
# use HTTP URL's for system id's. Default build options do
# not use this NetAccessor. Specify the '-n socket' option
# to 'runConfigure' to configure Xerces-C to use this new
# feature. The code works under Solaris 2.6, Linux, AIX
# and HPUX 11 with aCC.
# Todo's: enable proper error handling.
#
# Revision 1.21  2000/03/20 19:17:00  abagchi
# Added XML256TableTranscoder
#
# Revision 1.20  2000/03/02 20:33:44  abagchi
# Changed XML4CDefs to XercesDefs
#
# Revision 1.19  2000/03/01 22:30:03  abagchi
# Object files are now created directly under obj directory
#
# Revision 1.18  2000/02/22 01:06:28  aruna1
# Added XMLChTranscoder
#
# Revision 1.17  2000/02/18 20:17:15  abagchi
# Added XMLWin1252Transcoder
#
# Revision 1.16  2000/02/17 00:58:07  abagchi
# Replaced IBM1047 with IBM1140
#
# Revision 1.15  2000/02/08 02:28:34  abagchi
# Added IBM 1047 Transcoder
#
# Revision 1.14  2000/02/08 02:03:44  aruna1
# Added changes for IBM1047 transcoder
#
# Revision 1.13  2000/02/06 07:48:02  rahulj
# Year 2K copyright swat.
#
# Revision 1.12  2000/02/04 23:48:45  abagchi
# Made sure all targets are appended with :: not single :
#
# Revision 1.11  2000/02/01 23:43:25  abagchi
# AS/400 related change
#
# Revision 1.10  2000/01/19 17:37:24  abagchi
# Removed the streaming classes
#
# Revision 1.9  2000/01/15 01:26:17  rahulj
# Added support for HTTP to the parser using libWWW 5.2.8.
# Renamed URL.[ch]pp to XMLURL.[ch]pp and like wise for the class name.
# Only tested under NT 4.0 SP 5.
# Removed URL.hpp from files where it was not used.
#
# Revision 1.8  2000/01/12 22:54:22  abagchi
# Added additional transcoding object files and headers
#
# Revision 1.7  2000/01/12 20:10:12  aruna1
# Modified for new file
#
# Revision 1.5  2000/01/05 22:06:11  aruna1
# MsgCatalog support for AIX introduced
#
# Revision 1.4  1999/12/23 01:43:17  aruna1
# MsgCatalog support added for solaris
#
# Revision 1.3  1999/12/14 23:53:24  rahulj
# Removed the offending Ctrl-M's from the commit message
# logs which was giving packaging problems.
#
# PR:
# Obtained from:
# Submitted by:
# Reviewed by:
#
# Revision 1.2  1999/11/23 02:00:05  rahulj
# Code now works under HPUX 11. Tested inmemory message loader.
# Revamped makefiles. Builds with both DCE threads as well as pthread libraries.
#
# Revision 1.1.1.1  1999/11/09 01:04:40  twl
# Initial checkin
#
# Revision 1.4  1999/11/08 20:45:09  rahul
# Swat for adding in Product name and CVS comment log variable.
#
#

PLATFORM = LINUX
CC  = gcc
CXX = g++
GCC = yes
GXX = yes
CXXFLAGS =   -w -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET  
CFLAGS =   -w -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET   
PREFIX = /usr/local
PREFIX_INCLUDE = ${PREFIX}/include/xercesc
LDFLAGS =    
LIBS =  -lpthread 
OSVER = 
USELIBWWW = 
MESSAGELOADER = INMEM
TRANSCODER = NATIVE
NETACCESSOR = Socket
THREADS = pthread

MODULE = util

ifeq (${TRANSCODER},NATIVE)
    ifeq (${PLATFORM},MACOSX)
        TRANSCODERMODULE=MacOSUnicodeConverter
    else
        TRANSCODERMODULE=Iconv
    endif
else
	ifeq (${TRANSCODER},ICU)
	   TRANSCODERMODULE=ICU
	else
	   ifeq (${TRANSCODER},Iconv400)
		TRANSCODERMODULE=Iconv400
	   else
		ifeq (${TRANSCODER},Iconv390)
		   TRANSCODERMODULE=Iconv390
		else
		    ifeq (${TRANSCODER},IconvFBSD)
			TRANSCODERMODULE=IconvFBSD
		    else
                       ifeq (${TRANSCODER},Cygwin)
                           TRANSCODERMODULE=Cygwin
                       else
  		    	    ifeq (${TRANSCODER},IconvGNU)
			        TRANSCODERMODULE=IconvGNU
			    else
		                TRANSCODERMODULE=Iconv
  		            endif
  		        endif
		    endif
		endif
	   endif
	endif
endif

ifeq (${MESSAGELOADER},ICU)
   MESSAGELOADERMODULE=ICU
else
  ifeq (${MESSAGELOADER},MSGFILE)
      MESSAGELOADERMODULE=MsgFile
  else
   ifeq (${MESSAGELOADER},ICONV)
      MESSAGELOADERMODULE=MsgCatalog
      MSG_DIR=${XERCESCROOT}/lib/msg
   else
      MESSAGELOADERMODULE=InMemory
   endif
  endif
endif

NETACCESSORMODULE=FileOnly

ifeq (${NETACCESSOR},NATIVE)
    NETACCESSORMODULE=MacOSURLAccessCF
else
	ifeq (${NETACCESSOR},Socket)
	  NETACCESSORMODULE=Socket
	else
	  ifeq (${NETACCESSOR},LibWWW)
		NETACCESSORMODULE=libWWW
	  endif
	endif
endif

include ../Makefile.incl

UTIL_CPP_PUBHEADERS = \
    ArrayIndexOutOfBoundsException.hpp \
    AutoSense.hpp \
    Base64.hpp \
    BinFileInputStream.hpp \
    BinInputStream.hpp \
    BinMemInputStream.hpp \
    BitOps.hpp \
    BitSet.hpp \
    CountedPointer.hpp \
    EmptyStackException.hpp \
    EncodingValidator.hpp \
    FlagJanitor.hpp \
    HashBase.hpp \
    HashCMStateSet.hpp \
    HashXMLCh.hpp \
    HashPtr.hpp \
    HexBin.hpp \
    IOException.hpp \
    IllegalArgumentException.hpp \
    InvalidCastException.hpp \
    Janitor.hpp \
    KVStringPair.hpp \
    KeyRefPair.hpp \
    KeyValuePair.hpp \
    Mutexes.hpp \
    NameIdPool.hpp \
    NoDefTranscoderException.hpp \
    NoSuchElementException.hpp \
    NullPointerException.hpp \
    NumberFormatException.hpp \
    ParseException.hpp \
    PlatformUtils.hpp \
    QName.hpp \
    RefArrayOf.hpp \
    RefHash2KeysTableOf.hpp \
    RefHash3KeysIdPool.hpp \
    RefHashTableOf.hpp \
    RefStackOf.hpp \
    RefVectorOf.hpp \
    RuntimeException.hpp \
    SchemaDateTimeException.hpp \
    StringPool.hpp \
    XMLStringTokenizer.hpp \
    TransENameMap.hpp \
    TransService.hpp \
    TranscodingException.hpp \
    UTFDataFormatException.hpp \
    UnexpectedEOFException.hpp \
    UnsupportedEncodingException.hpp \
    ValueArrayOf.hpp \
    ValueHashTableOf.hpp \
    ValueStackOf.hpp \
    ValueVectorOf.hpp \
    XercesDefs.hpp \
    XercesVersion.hpp \
    XML256TableTranscoder.hpp \
    XML88591Transcoder.hpp \
    XMLASCIITranscoder.hpp \
    XMLNumber.hpp \
    XMLBigDecimal.hpp \
    XMLBigInteger.hpp \
    XMLAbstractDoubleFloat.hpp \
    XMLDouble.hpp \
    XMLDateTime.hpp \
    XMLChTranscoder.hpp \
    XMLInteger.hpp \
    XMLIBM1140Transcoder.hpp \
    XMLDeleterFor.hpp \
    XMLEBCDICTranscoder.hpp \
    XMLEnumerator.hpp \
    XMLExceptMsgs.hpp \
    XMLException.hpp \
    XMLFloat.hpp \
    XMLMsgLoader.hpp \
    XMLNetAccessor.hpp \
    XMLRegisterCleanup.hpp \
    XMLString.hpp \
    XMLUCS4Transcoder.hpp \
    XMLUri.hpp \
    XMLURL.hpp \
    XMLUTF16Transcoder.hpp \
    XMLUTF8Transcoder.hpp \
    XMLUniDefs.hpp \
    XMLUni.hpp \
    XMLWin1252Transcoder.hpp

UTIL_CPP_PRIVHEADERS =

C_FILES = \
    CountedPointer.c \
    FlagJanitor.c \
    Janitor.c \
    KeyRefPair.c \
    KeyValuePair.c \
    NameIdPool.c \
    RefArrayOf.c \
    RefHash2KeysTableOf.c \
    RefHash3KeysIdPool.c \
    RefHashTableOf.c \
    RefStackOf.c \
    RefVectorOf.c \
    TransENameMap.c \
    ValueArrayOf.c \
    ValueHashTableOf.c \
    ValueStackOf.c \
    ValueVectorOf.c \
    XMLDeleterFor.c

UTIL_CPP_OBJECTS = \
    Base64.$(TO) \
    BinFileInputStream.$(TO) \
    BinInputStream.$(TO) \
    BinMemInputStream.$(TO) \
    BitSet.$(TO) \
    EncodingValidator.$(TO) \
    HashXMLCh.$(TO) \
    HashPtr.$(TO) \
    HeaderDummy.$(TO) \
    HexBin.$(TO) \
    KVStringPair.$(TO) \
    Mutexes.$(TO) \
    PlatformUtils.$(TO) \
    QName.$(TO) \
    StringPool.$(TO) \
    XMLStringTokenizer.$(TO) \
    XMLUri.$(TO) \
    XMLURL.$(TO) \
    TransService.$(TO) \
    XML256TableTranscoder.$(TO) \
    XML88591Transcoder.$(TO) \
    XMLASCIITranscoder.$(TO) \
    XMLNumber.$(TO) \
    XMLBigDecimal.$(TO) \
    XMLBigInteger.$(TO) \
    XMLAbstractDoubleFloat.$(TO) \
    XMLDouble.$(TO) \
    XMLDateTime.$(TO) \
    XMLChTranscoder.$(TO) \
    XMLIBM1140Transcoder.$(TO) \
    XMLEBCDICTranscoder.$(TO) \
    XMLException.$(TO) \
    XMLFloat.$(TO) \
    XMLString.$(TO) \
    XMLUCSTranscoder.$(TO) \
    XMLUTF16Transcoder.$(TO) \
    XMLUTF8Transcoder.$(TO) \
    XMLUni.$(TO) \
    XMLWin1252Transcoder.$(TO)


all:: includes $(UTIL_CPP_OBJECTS) platforms transcoders \
      messageloaders compilers netaccessors regx

includes:: pubheaders $(C_FILES)
	${MAKE} -C Platforms $@
	${MAKE} -C Transcoders/$(TRANSCODERMODULE) $@
	${MAKE} -C MsgLoaders/$(MESSAGELOADERMODULE) $@
ifneq (${NETACCESSORMODULE},FileOnly)
	${MAKE} -C NetAccessors/$(NETACCESSORMODULE) $@
endif
	${MAKE} -C Compilers $@
	${MAKE} -C regx $@


platforms::
	${MAKE} -C Platforms


transcoders::
	${MAKE} -C Transcoders/$(TRANSCODERMODULE)


messageloaders::
ifeq (${MESSAGELOADER},ICONV)
ifeq (${PLATFORM},SOLARIS)
	mkdir -p ${MSG_DIR}
	gencat ${MSG_DIR}/XMLMessages.cat MsgLoaders/${MESSAGELOADERMODULE}/XMLMsgCat_EN_US.Msg
endif
ifeq (${PLATFORM},AIX)
	mkdir -p ${MSG_DIR}
	gencat ${MSG_DIR}/XMLMessages.cat MsgLoaders/${MESSAGELOADERMODULE}/XMLMsgCat_EN_US.Msg
endif
endif
	${MAKE} -C MsgLoaders/$(MESSAGELOADERMODULE)


compilers::
	${MAKE} -C Compilers


netaccessors::
ifneq (${NETACCESSORMODULE},FileOnly)
	${MAKE} -C NetAccessors/$(NETACCESSORMODULE)
endif

regx::
	${MAKE} -C regx


pubheaders::
	-mkdir -p $(XML_INC_DIR)/$(MODULE)
	$(CP) $(UTIL_CPP_PUBHEADERS) $(C_FILES) $(XML_INC_DIR)/$(MODULE)


# this may generate unnecessary dependencies, but it makes life easier
depend:: includes
	$(MAKE_DEPEND) $(XML_INCL)  *.cpp > $(DEPFILE)


clean::
	@echo "Making clean in $(MODULE) ..."
	$(RM2) $(addprefix $(XML_OBJ_DIR)/,$(UTIL_CPP_OBJECTS))
	${MAKE} -C Platforms $@
	${MAKE} -C Transcoders/$(TRANSCODERMODULE) $@
	${MAKE} -C MsgLoaders/$(MESSAGELOADERMODULE) $@
ifneq (${NETACCESSORMODULE},FileOnly)
	${MAKE} -C NetAccessors/$(NETACCESSORMODULE) $@
endif
	${MAKE} -C Compilers $@
	${MAKE} -C regx $@



distclean:: clean
	$(RM) Makefile $(DEPFILE)
	@echo "Removing all $(MODULE) header files ..."
	$(RM2) $(addprefix $(XML_INC_DIR)/$(MODULE)/,$(UTIL_CPP_PUBHEADERS))
	$(RM2) $(addprefix $(XML_INC_DIR)/$(MODULE)/,$(C_FILES))
	${MAKE} -C Platforms $@
	${MAKE} -C Transcoders/$(TRANSCODERMODULE) $@
	${MAKE} -C MsgLoaders/$(MESSAGELOADERMODULE) $@
ifneq (${NETACCESSORMODULE},FileOnly)
	${MAKE} -C NetAccessors/$(NETACCESSORMODULE) $@
endif
	${MAKE} -C Compilers $@
	${MAKE} -C regx $@


install::
	-mkdir -p $(PREFIX_INCLUDE)/$(MODULE)
	$(CP) $(UTIL_CPP_PUBHEADERS) $(C_FILES) $(PREFIX_INCLUDE)/$(MODULE)
	${MAKE} -C Platforms $@
	${MAKE} -C Transcoders/$(TRANSCODERMODULE) $@
	${MAKE} -C MsgLoaders/$(MESSAGELOADERMODULE) $@
	${MAKE} -C Compilers $@
	${MAKE} -C regx $@
