# -*- Makefile -*-
#
# $Id: acc.config 642302 2008-03-28 17:22:02Z sebor $
#
# configuration file for HP aCC on HP-UX
#
########################################################################
#
# Licensed to the Apache Software  Foundation (ASF) under one or more
# contributor  license agreements.  See  the NOTICE  file distributed
# with  this  work  for  additional information  regarding  copyright
# ownership.   The ASF  licenses this  file to  you under  the Apache
# License, Version  2.0 (the  "License"); you may  not use  this file
# except in  compliance with the License.   You may obtain  a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the  License is distributed on an  "AS IS" BASIS,
# WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
# implied.   See  the License  for  the  specific language  governing
# permissions and limitations under the License.
#
# Copyright 1999-2008 Rogue Wave Software, Inc.
#
########################################################################

CXX       = aCC

CCVER     := $(shell   $(CXX) -V 2>&1 \
                     | sed "s/.* \(A\.[0-9][0-9]*\.[0-9][0-9]\)[^0-9]*.*/\1/")
aCC_MAJOR := $(shell echo $(CCVER) | sed "s/[^.]*\.\([0-9]*\)\..*/\1/")
aCC_MINOR := $(shell echo $(CCVER) | sed "s/[^.]*\.[^.]*\.\([0-9]*\)/\1/")

WARNFLAGS = +w +W392,655,684,818,819,849

ifeq ($(shell [ $(aCC_MAJOR) -eq 3 -a $(aCC_MINOR) -lt 33 ] && echo 1),1)

# disable bogus aCC warnings (aCC prior to 3.32):
#    229 Ambiguous overloaded function call
#    361 Value-returning function might end without executing a return statement

WARNFLAGS  += +W229,361
endif

ifeq ($(aCC_MAJOR),06)

# disabled warnings:
# 2193 zero used for undefined preprocessing identifier
# 2236 controlling expression is constant
# 2261 access control not specified (%sq by default)
# 2340 value copied to temporary, reference to temporary used
# 2401 destructor for base class %t is not virtual
# 2487 inline %n cannot be explicitly instantiated

# disable aCC 6.x (EDG front end) warnings emitted with +w:
WARNFLAGS  += +W2193,2236,2261,2340,2401,2487

    ifeq ($(shell [ $(aCC_MINOR) -gt 10 ] && echo 1),1)

# disabled remarks:
# 4227 padding struct with N bytes to align member
# 4229 64 bit migration: conversion from "long" to "int" may truncate value
# 4231 64 bit migration: conversion between types of different sizes
# 4235 conversion from "T" to "U" may lose significant bits
# 4237 type cast from "T" to "U" may cause sign extension
# 4249 64 bit migration: value could be truncated before cast
# 4255 padding size of struct with N bytes to alignment boundary
# 4272 conversion from "T" to "unsigned T" may lose sign
# 4284 operator= does not return reference to *this
# 4285 operator= does not have a check for the source and destination
# 4286 return non-const handle to non-public data member

# remarks disabled as useless (even according to HP):
# 4296 arithmetic operation on boolean type
# 4297 boolean value is used as array index

        WARNFLAGS += +W4227,4229,4231,4235,4237,4249 \
                     +W4255,4272,4284,4285,4286,4296,4297

        ifeq ($(shell [ $(aCC_MINOR) -lt 20 ] && echo 1),1)

# disabled due to STDCXX-694 (hopefully fixed by the time 6.20 comes out)
# 3348 declaration hides constant or variable

            WARNFLAGS += +W3348

        endif   # aCC < 6.20


    endif   # aCC > 6.10
endif   # aCC 6.x

ifeq ($(shell [ $(aCC_MAJOR) -ge 6 -o $(aCC_MINOR) -ge 38 ] && echo 1),1)
# starting with aCC x.38, the +Md option is deprecated in favor of +Maked
DEPENDFLAGS     = +Maked -E
else
DEPENDFLAGS     = +Md -E
endif

PICFLAGS        = +Z
LDSOFLAGS       = +Z -b

# the extension of assembly files is .s
AS_EXT = .s

# $(_CPPOPTS), $(_CXXOPTS), and $(_LDOPTS) provided to allow for modification
# of the respective variables w/o underscores on HP-UX where the latter are
# used directly by the compiler and linker, respectively

# use -AA by default, allow -Aa as an option
use_Aa := $(filter -Aa,$(_CXXOPTS))

ifneq ($(use_Aa),-Aa)
CXXFLAGS        = -AA "$$"(_CXXOPTS)
CXXPRELINK      = 
CPPFLAGS        = "$$"(_CPPOPTS)
LDFLAGS         = -AA +nostl -Wl,+s "$$"(_LDOPTS)
else
# -Aa was specified in _CXXOPTS
CXXFLAGS        = -Aa +nostl "$$"(_CXXOPTS)
CXXPRELINK      = 
CPPFLAGS        = -I$(TOPDIR)/include/ansi -I/usr/include "$$"(_CPPOPTS)
# -Wl,+s allows the dynamic loader to consider LD_LIBRARY_PATH (LP64)
# and SHLIB_PATH when loading an executable into memory
LDFLAGS         = -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings "$$"(_LDOPTS)
endif

# The flag(s) to use to embed a library search path into generated executables.
RPATH = -Wl,+b

# debug/optimization options
DEBUG_CXXFLAGS  = -g +d
DEBUG_CPPFLAGS  =

OPTMZ_CXXFLAGS  = +O2
OPTMZ_CPPFLAGS  =

# shared/static library options
SHARED_CXXFLAGS =
SHARED_CPPFLAGS =
SHARED_LDFLAGS  =
SHARED_SUFFIX   = .sl

STATIC_CXXFLAGS =
STATIC_CPPFLAGS =
STATIC_LDFLAGS  =

# multi/single thread options; 
# we use the macros defined by the compiler when the -mt option is used
# DCE threads not added since HP-UX versions after 10.20 use POSIX
MULTI_CPPFLAGS_POSIX   = -mt
MULTI_CPPFLAGS_SOLARIS = 
MULTI_CPPFLAGS_DCE     = 

MULTI_LDFLAGS_POSIX    = -mt
MULTI_LDFLAGS_SOLARIS  = 
MULTI_LDFLAGS_DCE      = 

# POSIX
MULTI_CPPFLAGS = $(MULTI_CPPFLAGS_POSIX)
MULTI_LDFLAGS  = $(MULTI_LDFLAGS_POSIX)

SINGL_CPPFLAGS =
SINGL_LDFLAGS  =

# wide (64-bit, LP64) flags -- must be set explicitly
CXXFLAGS.wide    = +DD64
LDFLAGS.wide     = +DD64
LDSOFLAGS.wide   = +DD64
ARFLAGS.wide     =

# narrow (32-bit, ILP32) flags -- implicit in the default invocation
# CXXFLAGS.narrow  = +DD32
# LDFLAGS.narrow   = +DD32
# LDSOFLAGS.narrow = +DD32
# ARFLAGS.narrow   =
