corba/make/common/shared/Compiler-gcc.gmk
author tbell
Thu, 30 Jul 2009 23:37:25 -0700
changeset 3359 0589e2ed45b3
parent 3291 805a72a26925
child 4124 0493b08f4d56
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
#
3291
805a72a26925 6862919: Update copyright year
xdono
parents: 2827
diff changeset
     2
# Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
#
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
02bb8761fcce Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
02bb8761fcce Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
02bb8761fcce Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
02bb8761fcce Initial load
duke
parents:
diff changeset
    23
# have any questions.
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
# GCC Compiler settings
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
COMPILER_NAME=GCC
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
ifeq ($(PLATFORM), windows)
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
  # Settings specific to Windows, pretty stale, hasn't been used
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
  CC           = $(COMPILER_PATH)gcc
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
  CPP          = $(COMPILER_PATH)gcc -E
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
  CXX          = $(COMPILER_PATH)g++
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
  CCC          = $(COMPILER_PATH)g++
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
  LIBEXE       = $(COMPILER_PATH)lib
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
  LINK         = $(COMPILER_PATH)link
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
  RC           = $(MSDEVTOOLS_PATH)link
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
  LINK32       = $(LINK)
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
  RSC          = $(RC)
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
  # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
  NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
  ifeq ($(ARCH_DATA_MODEL), 32)
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
    CC_VER  = UNKNOWN
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
    CC_TYPE = UNKNOWN
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
  else
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
    CC_VER  = UNKNOWN
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
    CC_TYPE = UNKNOWN
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
  _LINK_VER :=$(shell $(LINK) 2>&1 | $(HEAD) -n 1)
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
  LINK_VER  :=$(call GetVersion,"$(_LINK_VER)")
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
ifeq ($(PLATFORM), linux)
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
  # Settings specific to Linux
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
  CC             = $(COMPILER_PATH)gcc
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
  CPP            = $(COMPILER_PATH)gcc -E
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
  # statically link libstdc++ before C++ ABI is stablized on Linux
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
  STATIC_CXX     = true
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
  ifeq ($(STATIC_CXX),true)
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
    # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
    # We need to use gcc to statically link the C++ runtime. gcc and g++ use
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
    # the same subprocess to compile C++ files, so it is OK to build using gcc.
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
    CXX            = $(COMPILER_PATH)gcc
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
  else
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
    CXX            = $(COMPILER_PATH)g++
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
  ifneq ("$(findstring sparc,$(ARCH))", "")
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
    # sparc or sparcv9
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
    REQUIRED_CC_VER = 4.0
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
  else
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
  ifeq ($(ARCH_DATA_MODEL), 32)
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
    # i586
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
    REQUIRED_CC_VER = 3.2
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
  else
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
  ifeq ($(ARCH), amd64)
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
    # amd64
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
    REQUIRED_CC_VER = 3.2
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
  ifeq ($(ARCH), ia64)
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
    # ia64
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
    REQUIRED_CC_VER = 3.2
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
  # Option used to create a shared library
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
  SHARED_LIBRARY_FLAG = -shared -mimpure-text
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
  SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
ifeq ($(PLATFORM), solaris)
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
  # Settings specific to Solaris
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
  CC             = $(COMPILER_PATH)gcc
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
  CPP            = $(COMPILER_PATH)gcc -E
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
  CXX            = $(COMPILER_PATH)g++
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
  REQUIRED_CC_VER = 3.2
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
  # Option used to create a shared library
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
  SHARED_LIBRARY_FLAG = -G
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
# Get gcc version
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
_CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
CC_VER  :=$(call GetVersion,"$(_CC_VER)")
02bb8761fcce Initial load
duke
parents:
diff changeset
   113