# -*- Makefile -*- # # $Id$ # # configuration file for SunPro CC on SunOS # ######################################################################## # # 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-2007 Rogue Wave Software, Inc. # ######################################################################## CXX = CC # extract the "C++ m.n" substring from version string (whcih changes # from one release of the compiler to another) CCVER := $(shell $(CXX) -V 2>&1 | head -n1 \ | sed 's/.*C++ *\([^ ]*\).*/\1/') CCMAJOR := $(shell echo $(CCVER) | cut -f1 -d'.') CCMINOR := $(shell echo $(CCVER) | cut -f2 -d'.') ifeq ($(shell expr $(CCMAJOR) = 5 \& $(CCMINOR) = 9),1) # in Sun C++ 5.9 -xM can only be used with C and C++ files # and it produces the wrong results with .{S,s} files DEPENDFLAGS.cpp = -xM # deliberately undefined: # DEPENDFLAGS.S = # DEPENDFLAGS = else DEPENDFLAGS = -xM endif WARNFLAGS = +w ifeq ($(shell expr \( $(CCMAJOR) = 5 \& $(CCMINOR) \> 6 \) \ \| $(CCMAJOR) \> 5),1) # for Sun C++ 5.7 and beyond, enable diagnostic "tags" in compiler output # and use -erroff to silence Warning: std::stringstream::rdbuf hides the # function std::ios::rdbuf(std::streambuf*) (see STDCXX-344) WARNFLAGS += -errtags -erroff=hidef endif PICFLAGS = -KPIC LDSOFLAGS = CXXFLAGS = -library=%none CXXPRELINK = CPPFLAGS = LDFLAGS = -library=%none LDSOFLAGS = -G # use CC to invoke the compiler (needed to pick up template # instantiations from SunWS_cache) AR = CC ARFLAGS = -xar -o # The flag(s) to use to embed a library search path into generated executables. RPATH = -R # debug/optimization options DEBUG_CXXFLAGS = -g DEBUG_CPPFLAGS = OPTMZ_CXXFLAGS = -O OPTMZ_CPPFLAGS = # shared/static library options SHARED_CXXFLAGS = SHARED_CPPFLAGS = SHARED_LDFLAGS = STATIC_CXXFLAGS = STATIC_CPPFLAGS = STATIC_LDFLAGS = # multi/single thread options; -mt defines _REENTRANT MULTI_CPPFLAGS_POSIX = -mt MULTI_CPPFLAGS_SOLARIS = -mt -D_RWSTD_SOLARIS_THREADS MULTI_CPPFLAGS_DCE = # avoid linking with the redundant libpthread and libthread # on Solaris 10 and beyond to prevent error 543 ifeq ($(OSNAME),SunOS) OSVER = $(shell uname -r) OSMAJOR = $(shell echo $(OSVER) | sed "s/\([0-9][0-9]*\)\..*/\1/") OSMINOR = $(shell echo $(OSVER) | sed "s/[^.]*\.\([0-9][0-9]*\)/\1/") ifneq ($(shell expr $(OSMAJOR) \> 5 \| $(OSMINOR) = 10),1) LIBPTHREAD = -lpthread LIBTHREAD = -lthread endif else LIBPTHREAD = -lpthread LIBTHREAD = -lthread endif MULTI_LDFLAGS_POSIX = -mt $(LIBPTHREAD) MULTI_LDFLAGS_SOLARIS = -mt $(LIBTHREAD) MULTI_LDFLAGS_DCE = # POSIX MULTI_CPPFLAGS = $(MULTI_CPPFLAGS_POSIX) MULTI_LDFLAGS = $(MULTI_LDFLAGS_POSIX) SINGL_CPPFLAGS = SINGL_LDFLAGS = ifeq ($(shell expr $(CCMAJOR) \>= 5 \& $(CCMINOR) \>= 9),1) # starting with Sun C++ 5.9, the compiler prefers the generic # -m32 and -m64 options to the architecture specific -xarch # options some of which have been deprecated wide_flags = -m64 narrow_flags = -m32 else # (try to) determine the architecture via the (non-standard) # -p option recognized on (at least) Linux and Solaris arch := $(shell uname -p 2>/dev/null) ifeq ($(arch),sparc) # wide (64-bit) flags -- must be set explicitly # narrow (32-bit) flags are implicit on SPARC wide_flags = -xarch=v9 narrow_flags = -xarch=v8 else # wide (64-bit) flags -- must be set explicitly # narrow (32-bit) flags are implicit on AMD64 ifeq ($(OSNAME),SunOS) # Solaris uname -p prints i386 on AMD64, use the optisa # command to deterrmine "the best" architecture arch := $(shell optisa amd64) endif ifeq ($(arch),amd64) wide_flags = -xarch=amd64 narrow_flags = -xarch=386 # the default (same as generic) else wide_flags = -xarch=generic64 narrow_flags = -xarch=generic # the default (same as 386) endif endif endif CXXFLAGS.wide = $(wide_flags) LDFLAGS.wide = $(wide_flags) LDSOFLAGS.wide = $(wide_flags) ARFLAGS.wide = CXXFLAGS.narrow = $(narrow_flags) LDFLAGS.narrow = $(narrow_flags) LDSOFLAGS.narrow = $(narrow_flags) ARFLAGS.narrow =