< prev index next >

make/linux/makefiles/gcc.make

Print this page


   1 #
   2 # Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #


  31   # to the cross-compilation toolset
  32   ifdef CROSS_COMPILE_ARCH
  33     CXX = $(ALT_COMPILER_PATH)/g++
  34     CC  = $(ALT_COMPILER_PATH)/gcc
  35     HOSTCXX = g++
  36     HOSTCC  = gcc
  37     STRIP = $(ALT_COMPILER_PATH)/strip
  38   else
  39     ifeq ($(USE_CLANG), true)
  40       CXX = clang++
  41       CC  = clang
  42     else
  43       CXX = g++
  44       CC  = gcc
  45     endif
  46 
  47     HOSTCXX = $(CXX)
  48     HOSTCC  = $(CC)
  49     STRIP = strip
  50   endif

  51   AS  = $(CC) -c
  52 endif
  53 
  54 
  55 ifeq ($(USE_CLANG), true)
  56   CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
  57   CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
  58 else
  59   # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  60   # prints the numbers (e.g. "2.95", "3.2.1")
  61   CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  62   CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  63   CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3)
  64   # Workaround Ubuntu bug where -dumpversion doesn't print a micro version
  65   # https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1360404
  66   ifeq ($(CC_VER_MICRO),)
  67     CC_VER_MICRO := "0"
  68   endif
  69 endif
  70 


 115     PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
 116 
 117   endif
 118 else # ($(USE_CLANG), true)
 119   # check for precompiled headers support
 120   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
 121     # Allow the user to turn off precompiled headers from the command line.
 122     ifneq ($(USE_PRECOMPILED_HEADER),0)
 123       PRECOMPILED_HEADER_DIR=.
 124       PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
 125       PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
 126     endif
 127   endif
 128 endif
 129 
 130 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
 131 ifeq ($(USE_PRECOMPILED_HEADER),0)
 132   CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
 133 endif
 134 
 135 
 136 #------------------------------------------------------------------------
 137 # Compiler flags
 138 
 139 # position-independent code
 140 PICFLAG = -fPIC
 141 
 142 VM_PICFLAG/LIBJVM = $(PICFLAG)
 143 VM_PICFLAG/AOUT   =
 144 VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
 145 
 146 ifeq ($(JVM_VARIANT_ZERO), true)
 147 CFLAGS += $(LIBFFI_CFLAGS)
 148 endif
 149 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
 150 CFLAGS += $(LIBFFI_CFLAGS)
 151 CFLAGS += $(LLVM_CFLAGS)
 152 endif
 153 CFLAGS += $(VM_PICFLAG)
 154 CFLAGS += -fno-rtti
 155 CFLAGS += -fno-exceptions
 156 CFLAGS += -D_REENTRANT
 157 ifeq ($(USE_CLANG),)
 158   CFLAGS += -fcheck-new
 159   # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
 160   # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
 161   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
 162     CFLAGS += -fvisibility=hidden
 163   endif
 164 else
 165   CFLAGS += -fvisibility=hidden
 166 endif
 167 
 168 ifeq ($(USE_CLANG), true)
 169   # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
 170   # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
 171   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"


 375     FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
 376     ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
 377       FASTDEBUG_CFLAGS += -g
 378     endif
 379 
 380     OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
 381     ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
 382       OPT_CFLAGS += -g
 383     endif
 384   endif
 385 endif
 386 
 387 ifeq ($(USE_CLANG),)
 388   # Enable bounds checking.
 389   ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
 390     # stack smashing checks.
 391     DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1
 392   endif
 393 endif
 394 
 395 
 396 # If we are building HEADLESS, pass on to VM
 397 # so it can set the java.awt.headless property
 398 ifdef HEADLESS
 399 CFLAGS += -DHEADLESS
 400 endif
 401 
 402 # We are building Embedded for a small device
 403 # favor code space over speed
 404 ifdef MINIMIZE_RAM_USAGE
 405 CFLAGS += -DMINIMIZE_RAM_USAGE
 406 endif
 407 
 408 # Stack walking in the JVM relies on frame pointer (%rbp) to walk thread stack.
 409 # Explicitly specify -fno-omit-frame-pointer because it is off by default
 410 # starting with gcc 4.6.
 411 ifndef USE_SUNCC
 412   CFLAGS += -fno-omit-frame-pointer
 413 endif
 414 
 415 -include $(HS_ALT_MAKE)/linux/makefiles/gcc.make
   1 #
   2 # Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #


  31   # to the cross-compilation toolset
  32   ifdef CROSS_COMPILE_ARCH
  33     CXX = $(ALT_COMPILER_PATH)/g++
  34     CC  = $(ALT_COMPILER_PATH)/gcc
  35     HOSTCXX = g++
  36     HOSTCC  = gcc
  37     STRIP = $(ALT_COMPILER_PATH)/strip
  38   else
  39     ifeq ($(USE_CLANG), true)
  40       CXX = clang++
  41       CC  = clang
  42     else
  43       CXX = g++
  44       CC  = gcc
  45     endif
  46 
  47     HOSTCXX = $(CXX)
  48     HOSTCC  = $(CC)
  49     STRIP = strip
  50   endif
  51 
  52   AS  = $(CC) -c
  53 endif
  54 
  55 
  56 ifeq ($(USE_CLANG), true)
  57   CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
  58   CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
  59 else
  60   # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
  61   # prints the numbers (e.g. "2.95", "3.2.1")
  62   CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
  63   CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
  64   CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3)
  65   # Workaround Ubuntu bug where -dumpversion doesn't print a micro version
  66   # https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1360404
  67   ifeq ($(CC_VER_MICRO),)
  68     CC_VER_MICRO := "0"
  69   endif
  70 endif
  71 


 116     PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
 117 
 118   endif
 119 else # ($(USE_CLANG), true)
 120   # check for precompiled headers support
 121   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
 122     # Allow the user to turn off precompiled headers from the command line.
 123     ifneq ($(USE_PRECOMPILED_HEADER),0)
 124       PRECOMPILED_HEADER_DIR=.
 125       PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
 126       PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
 127     endif
 128   endif
 129 endif
 130 
 131 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
 132 ifeq ($(USE_PRECOMPILED_HEADER),0)
 133   CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
 134 endif
 135 

 136 #------------------------------------------------------------------------
 137 # Compiler flags
 138 
 139 # position-independent code
 140 PICFLAG = -fPIC
 141 
 142 VM_PICFLAG/LIBJVM = $(PICFLAG)
 143 VM_PICFLAG/AOUT   =
 144 VM_PICFLAG        = $(VM_PICFLAG/$(LINK_INTO))
 145 
 146 ifeq ($(JVM_VARIANT_ZERO), true)
 147   CFLAGS += $(LIBFFI_CFLAGS)
 148 endif
 149 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
 150   CFLAGS += $(LIBFFI_CFLAGS)
 151   CFLAGS += $(LLVM_CFLAGS)
 152 endif
 153 CFLAGS += $(VM_PICFLAG)
 154 CFLAGS += -fno-rtti
 155 CFLAGS += -fno-exceptions
 156 CFLAGS += -D_REENTRANT
 157 ifeq ($(USE_CLANG),)
 158   CFLAGS += -fcheck-new
 159   # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
 160   # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
 161   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
 162     CFLAGS += -fvisibility=hidden
 163   endif
 164 else
 165   CFLAGS += -fvisibility=hidden
 166 endif
 167 
 168 ifeq ($(USE_CLANG), true)
 169   # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
 170   # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
 171   ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"


 375     FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
 376     ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
 377       FASTDEBUG_CFLAGS += -g
 378     endif
 379 
 380     OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
 381     ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
 382       OPT_CFLAGS += -g
 383     endif
 384   endif
 385 endif
 386 
 387 ifeq ($(USE_CLANG),)
 388   # Enable bounds checking.
 389   ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
 390     # stack smashing checks.
 391     DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1
 392   endif
 393 endif
 394 

 395 # If we are building HEADLESS, pass on to VM
 396 # so it can set the java.awt.headless property
 397 ifdef HEADLESS
 398 CFLAGS += -DHEADLESS
 399 endif
 400 
 401 # We are building Embedded for a small device
 402 # favor code space over speed
 403 ifdef MINIMIZE_RAM_USAGE
 404 CFLAGS += -DMINIMIZE_RAM_USAGE
 405 endif
 406 
 407 # Stack walking in the JVM relies on frame pointer (%rbp) to walk thread stack.
 408 # Explicitly specify -fno-omit-frame-pointer because it is off by default
 409 # starting with gcc 4.6.
 410 ifndef USE_SUNCC
 411   CFLAGS += -fno-omit-frame-pointer
 412 endif
 413 
 414 -include $(HS_ALT_MAKE)/linux/makefiles/gcc.make
< prev index next >