#
# 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/>.
#
#
# $Id: Makefile.incl,v 1.24 2000/09/11 18:43:43 aruna1 Exp $
#

################## LIBRARY NAMES AND DIRECTORIES ##################

ifeq (${SYSOVR},OS400)
PLATFORM = OS400
endif
INCLUDES= -I. -I${XERCESCROOT}/include
LIB_DIR=${XERCESCROOT}/lib
ifneq (${PLATFORM},OS400)
LIBNAME=xerces-c
else
LIBNAME=xercesc
endif
THISLIB=${LIB_DIR}/${LIBNAME}

LIBRARY_NAMES=-l${LIBNAME}${VER}
LIBRARY_SEARCH_PATHS=-L${LIB_DIR}

TO = o
####################### PLATFORM DEPENDENCIES #####################

#=============== IRIX SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, IRIX)
  ifeq (${COMPILER}, g++)
	CMP= -c ${CXXFLAGS}
	CC= g++ -c -D${PLATFORM} -D_REENTRANT -fpic -instances=static
	LINK = g++ -D${PLATFORM} -fpic
	PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
	EXTRA_LINK_OPTIONS=-lc
  else
	CMP= -c ${CXXFLAGS}
	CC= CC -c -D${PLATFORM} -LANG:pch -LANG:std -O2 -D_REENTRANT -I/usr/local/include
	LINK =  CC -D${PLATFORM}
	PLATFORM_LIB_LINK_OPTIONS=
	EXTRA_LINK_OPTIONS=
  endif
  SHLIBSUFFIX=.so
endif

#=============== SOLARIS SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, SOLARIS)
  ifeq (${COMPILER}, g++)
	CMP= -c ${CXXFLAGS}
	CC= g++ -c -D${PLATFORM} -D_REENTRANT -fpic
	LINK = g++ -D${PLATFORM} -fpic
	PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
	EXTRA_LINK_OPTIONS=-lc
  else
	CMP= -c ${CXXFLAGS}
	CC= CC -c -D${PLATFORM} -D_REENTRANT -pic
	LINK =  CC -D${PLATFORM}
	PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib
	EXTRA_LINK_OPTIONS=-lc -lgen
  endif
  SHLIBSUFFIX=.so
endif

#================= PTX SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, PTX)
COMPILESWITCH= -KPIC -Kthread -DPTX -w -O
CMP = -c ${COMPILESWITCH}
CC= c++
LINK =  ${CC} -DPTX -Kthread
PLATFORM_CPP_COMPILER = c++
PLATFORM_C_COMPILER = cc
PLATFORM_LIBRARIES =
PLATFORM_COMPILE_OPTIONS = -KPIC -Kthread -DPTX
MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -DPTX -G
MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -DPTX  -G
PLATFORM_LIB_LINK_OPTIONS=-L/usr/local/lib -L${XMLINSTALL}/lib
EXTRA_LINK_OPTIONS=-lm -lgen 
SHLIBSUFFIX=.so
endif

#================= AIX SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, AIX)
CMP= -c ${CXXFLAGS} -qnotempinc
CC=xlC_r -D${PLATFORM}
LINK =  ${CC}
PLATFORM_LIB_LINK_OPTIONS=-L/usr/lpp/xlC/lib
EXTRA_LINK_OPTIONS=-lC
SHLIBSUFFIX=.a
endif

#=============== OS400 SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, OS400)
ifeq (${SYSOVR},OS400)
MYCC = cross compiler path here
TO = qwobj
else
MYCC = icc
LINK =  ${CC} -v
endif
CMP= -c -DOS400 ${CXXFLAGS}
CXX = $(MYCC)
CC = $(MYCC)
#INCLUDES    += -I${ICUROOT}/include
SHLIBSUFFIX=.a
endif

#=============== LINUX SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, LINUX)
CMP= -c ${CXXFLAGS}
CC= g++ -c -D${PLATFORM} -D_REENTRANT -fpic -instances=static
LINK =  g++ -D${PLATFORM} -fpic
PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
EXTRA_LINK_OPTIONS=-lc
SHLIBSUFFIX=.so
endif

#================= HP SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, HPUX)
  ifeq (${COMPILER}, aCC)
    CMP = -c $(CXXFLAGS) -D_HP_UX -DHPaCC +DAportable -w +z
    CC = aCC
    LINK =  ${CC} -Wl,+s
    PLATFORM_LIB_LINK_OPTIONS=-L/opt/aCC/lib -L/usr/ccs/lib
    SHLIBSUFFIX=.sl
  else
    ifneq (${DEBUG}, 1)
      CXXFLAGS = -w +O1
    endif
    APPL_NAME = $(notdir $(shell pwd))
    TEMPLATESDIR = $(XERCESCROOT)/bin/obj/$(APPL_NAME)/ptrepository
    COMMON_CMP = $(CXXFLAGS) -D_HP_UX -DHPCC +DAportable -w +eh +z -z \
        -ptr$(TEMPLATESDIR)
    CMP = -c $(COMMON_CMP)
    CC = CC
    LINK =  ${CC} $(COMMON_CMP) -Wl,+s
    PLATFORM_LIB_LINK_OPTIONS=-L/opt/CC/lib -L/usr/lib
    SHLIBSUFFIX=.sl
  endif
endif

#================= OS390 SPECIFIC OPTIONS ===========================
###################################################################
#                    IMPORTANT NOTE                               #
###################################################################
# Before you try to run the Makefile, make sure you have two      #
# environment variables set.                                      #
#                                                                 #
# export XERCESCROOT=<the directory where you installed XERCES-C> #
#                                                                 #
# If you are going to do the OS390BATCH build, make sure you have #
# the OS390BATCH environment variable set.                        #
#                                                                 #
#   export OS390BATCH=1                                           #
#                                                                 #
# Also,                                                           #
#                                                                 #
#   export LOADMOD=USERID.LOAD                                    #
#   export LOADEXP=SYS1.SIXMEXP or &hlq.SIXMEXP                   #
#                                                                 #
# to specify your LOADMOD and the IXM4C31 definition sidedeck     #
# dataset.  													  #
###################################################################

ifeq (${PLATFORM}, OS390)
CMP= -c -DOS390 ${CXXFLAGS}
## OS390BATCH
ifeq (${OS390BATCH},1)
CC = _CXX_CXXSUFFIX="cpp" _CXX_STEPS="-1" c++ -W0,"langlvl(extended)" -DOS390 -DOPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -DOS390BATCH
else
CC = _CXX_CXXSUFFIX="cpp" _CXX_STEPS="-1" c++ -W0,"langlvl(extended)" -DOS390 -DOPEN_THREADS -D_XOPEN_SOURCE_EXTENDED
endif
LINK =  ${CC}
PLATFORM_LIB_LINK_OPTIONS=
EXTRA_LINK_OPTIONS =
SHLIBSUFFIX=.dll
OS390SIDEDECK=.x
## OS390BATCH
ifeq (${OS390BATCH},1)
LIBRARY_NAMES="//'${LOADEXP}(IXM4C33)'"
else
LIBRARY_NAMES=${LIB_DIR}/lib${LIBNAME}${VER}${OS390SIDEDECK}
endif
LIBRARY_SEARCH_PATHS=
endif

#=============== TRU64 SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, TRU64)
CMP= -c ${CXXFLAGS}
CC = cxx -c -D${PLATFORM}
LINK = cxx -D${PLATFORM}
PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib

SHLIBSUFFIX=.so
endif
