#
# The Apache Software License, Version 1.1
#
# Copyright (c) 1999-2000 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.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 = @platform@
CC  = @cc@
CXX = @cxx@
CXXFLAGS = @cxxflags@
CFLAGS = @cflags@
PREFIX = @prefix@
LDFLAGS = @ldflags@
LIBS = @libs@
OSVER = @osver@
USELIBWWW = @uselibwww@
MESSAGELOADER = @messageloader@
TRANSCODER = @transcoder@
NETACCESSOR = @netaccessor@

MODULE = util

ifeq (${TRANSCODER},ICU)
   TRANSCODERMODULE=ICU
else
   ifeq (${TRANSCODER},Iconv400)
    TRANSCODERMODULE=Iconv400
   else
    ifeq (${TRANSCODER},Iconv390)
       TRANSCODERMODULE=Iconv390
    else
       TRANSCODERMODULE=Iconv
    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


ifeq (${NETACCESSOR},Socket)
   NETACCESSORMODULE=Socket
endif


include ../Makefile.incl

UTIL_CPP_PUBHEADERS = \
    ArrayIndexOutOfBoundsException.hpp \
    AutoSense.hpp \
    BinFileInputStream.hpp \
    BinInputStream.hpp \
    BinMemInputStream.hpp \
    BitOps.hpp \
    BitSet.hpp \
    CountedPointer.hpp \
    EmptyStackException.hpp \
    FlagJanitor.hpp \
    HashBase.hpp \
    HashXMLCh.hpp \
    HashPtr.hpp \
    IOException.hpp \
    IllegalArgumentException.hpp \
    InvalidCastException.hpp \
    Janitor.hpp \
    KVStringPair.hpp \
    KeyValuePair.hpp \
    Mutexes.hpp \
    NameIdPool.hpp \
    NoDefTranscoderException.hpp \
    NoSuchElementException.hpp \
    NullPointerException.hpp \
    PlatformUtils.hpp \
    RefArrayOf.hpp \
    RefHashTableOf.hpp \
    RefStackOf.hpp \
    RefVectorOf.hpp \
    RuntimeException.hpp \
    StringPool.hpp \
    TransENameMap.hpp \
    TransService.hpp \
    TranscodingException.hpp \
    UTFDataFormatException.hpp \
    UnexpectedEOFException.hpp \
    UnsupportedEncodingException.hpp \
    ValueArrayOf.hpp \
    ValueStackOf.hpp \
    ValueVectorOf.hpp \
    XercesDefs.hpp \
    XML256TableTranscoder.hpp \
    XML88591Transcoder.hpp \
    XMLASCIITranscoder.hpp \
    XMLChTranscoder.hpp \
    XMLIBM1140Transcoder.hpp \
    XMLDeleterFor.hpp \
    XMLEBCDICTranscoder.hpp \
    XMLEnumerator.hpp \
    XMLExceptMsgs.hpp \
    XMLException.hpp \
    XMLMsgLoader.hpp \
    XMLNetAccessor.hpp \
    XMLString.hpp \
    XMLUCS4Transcoder.hpp \
    XMLURL.hpp \
    XMLUTF16Transcoder.hpp \
    XMLUTF8Transcoder.hpp \
	XMLUniDefs.hpp \
    XMLUni.hpp \
    XMLWin1252Transcoder.hpp

UTIL_CPP_PRIVHEADERS =

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

UTIL_CPP_OBJECTS = \
    BinFileInputStream.$(TO) \
    BinInputStream.$(TO) \
    BinMemInputStream.$(TO) \
    BitSet.$(TO) \
    HashXMLCh.$(TO) \
    HashPtr.$(TO) \
    HeaderDummy.$(TO) \
    KVStringPair.$(TO) \
    Mutexes.$(TO) \
    PlatformUtils.$(TO) \
    StringPool.$(TO) \
    XMLURL.$(TO) \
    TransService.$(TO) \
    XML256TableTranscoder.$(TO) \
    XML88591Transcoder.$(TO) \
    XMLASCIITranscoder.$(TO) \
    XMLChTranscoder.$(TO) \
    XMLIBM1140Transcoder.$(TO) \
    XMLEBCDICTranscoder.$(TO) \
    XMLException.$(TO) \
    XMLString.$(TO) \
    XMLUCSTranscoder.$(TO) \
    XMLUTF16Transcoder.$(TO) \
    XMLUTF8Transcoder.$(TO) \
    XMLUni.$(TO) \
    XMLWin1252Transcoder.$(TO)


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

includes:: pubheaders $(C_FILES)
	cd Platforms ; $(MAKE) $@ ; cd ..
	cd Transcoders/$(TRANSCODERMODULE) ; $(MAKE) $@ ; cd ../..
	cd MsgLoaders/$(MESSAGELOADERMODULE) ; $(MAKE) $@ ; cd ../..
ifeq ($(NETACCESSORMODULE),Socket)
	cd NetAccessors/$(NETACCESSORMODULE) ; $(MAKE) $@ ; cd ../..
endif
	cd Compilers ; $(MAKE) $@ ; cd ..


platforms::
	cd Platforms ; $(MAKE) ; cd ..


transcoders::
	cd Transcoders/$(TRANSCODERMODULE) ; $(MAKE) ; cd ../..


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
	cd MsgLoaders/$(MESSAGELOADERMODULE) ; $(MAKE) ; cd ../..


compilers::
	cd Compilers ; $(MAKE) ; cd ..


netaccessors::
	cd NetAccessors/$(NETACCESSORMODULE) ; $(MAKE) ; cd ../..


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))
	cd Platforms ; $(MAKE) $@ ; cd ..
	cd Transcoders/$(TRANSCODERMODULE) ; $(MAKE) $@ ; cd ../..
	cd MsgLoaders/$(MESSAGELOADERMODULE) ; $(MAKE) $@ ; cd ../..
ifeq ($(NETACCESSORMODULE),Socket)
	cd NetAccessors/$(NETACCESSORMODULE) ; $(MAKE) $@ ; cd ../..
endif
	cd Compilers ; $(MAKE) $@ ; cd ..



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))
	cd Platforms ; $(MAKE) $@ ; cd ..
	cd Transcoders/$(TRANSCODERMODULE) ; $(MAKE) $@ ; cd ../..
	cd MsgLoaders/$(MESSAGELOADERMODULE) ; $(MAKE) $@ ; cd ../..
ifeq ($(NETACCESSORMODULE),Socket)
	cd NetAccessors/$(NETACCESSORMODULE) ; $(MAKE) $@ ; cd ../..
endif
	cd Compilers ; $(MAKE) $@ ; cd ..


install::
	-mkdir -p $(PREFIX)/$(MODULE)
	$(CP) $(UTIL_CPP_PUBHEADERS) $(C_FILES) $(PREFIX)/$(MODULE)
	cd Platforms ; $(MAKE) $@ ; cd ..
	cd Transcoders/$(TRANSCODERMODULE) ; $(MAKE) $@ ; cd ../..
	cd MsgLoaders/$(MESSAGELOADERMODULE) ; $(MAKE) $@ ; cd ../..
	cd Compilers ; $(MAKE) $@ ; cd ..

