# **********************************************************************
#
# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# This file is included by Make.rules when uname is AIX.
#

CXX			= xlC_r
CC			= xlc_r -qcpluscmt

# 
# -qstaticinline: make inline functions that were not inlined (typically 
# in debug mode or when the function is too big) static instead of
# extern (the default). This eliminates lots of "Duplicate symbol"
# warnings at link time, and surprisingly reduces the size of the
# libraries.
#
# -D_LARGE_FILES: By default, Berkeley DB is built with -D_LARGE_FILES,
# which moves a number of symbols from namespace std to namespace
# std::_LSF_ON. It would be nice to find a better solution, and get
# rid of this define.
#
# -qalign=natural: You should add this option if you plan to use or 
# build Ice with libraries built with GCC. The default alignment for GCC 
# is "natural", while the default for xlC is "power".
#

ifneq ($(OBJECT_MODE),64)
    CXXARCHFLAGS	= -D_LARGE_FILES 
endif

CXXFLAGS		= -brtl -qrtti=all -qstaticinline $(CXXARCHFLAGS)

ifeq ($(OPTIMIZE),yes)
     CXXFLAGS		+= -O2 -DNDEBUG -qinline
else
     CXXFLAGS		+= -g
endif

ifeq ($(ADD_LIBDIR_TO_RPATH),yes)
   LDPLATFORMFLAGS      = -Wl,-blibpath:$(install_libdir):/usr/lpp/xlopt:/usr/lib/threads:/usr/vacpp/lib:/usr/lib:/lib
else
   LDPLATFORMFLAGS	= -Wl,-blibpath:/usr/lpp/xlopt:/usr/lib/threads:/usr/vacpp/lib:/usr/lib:/lib
endif

mklibfilename		= lib$(1).a

ifeq ($(STATICLIBS),)
	mklibname	= lib$(1).notused
else
	mklibname	= lib$(1).a
endif

mklibtargets		= $(1)

mkshlib			= $(CXX) -qmkshrobj $(LDFLAGS) -o $(2) $(3) $(4) ; ar -rc $(1) $(2) ; rm $(2)

mklib			= ar -rc $(1) $(2)

installlib		= $(INSTALL) $(2)/$(3) $(1)

BASELIBS		= -lIceUtil
LIBS			= -lIce $(BASELIBS)

ICEUTIL_OS_LIBS		=
ICE_OS_LIBS		=

export LIBPATH		:= $(libdir):$(LIBPATH)
