jdk/make/common/Defs-windows.gmk
changeset 917 75261da60fff
parent 715 f16baef3a20e
child 919 909db04edd73
equal deleted inserted replaced
817:cd8b8f500fac 917:75261da60fff
    82 # C Compiler flag definitions
    82 # C Compiler flag definitions
    83 
    83 
    84 #
    84 #
    85 # Default optimization
    85 # Default optimization
    86 #
    86 #
       
    87 
       
    88 ifndef OPTIMIZATION_LEVEL
       
    89   ifeq ($(PRODUCT), java)
       
    90     OPTIMIZATION_LEVEL = HIGHER
       
    91   else
       
    92     OPTIMIZATION_LEVEL = LOWER
       
    93   endif
       
    94 endif
       
    95 
    87 ifeq ($(CC_VERSION),msvc)
    96 ifeq ($(CC_VERSION),msvc)
    88   # Visual Studio .NET 2003 or VS2003 compiler option definitions:
    97   # Visual Studio .NET 2003 or VS2003 compiler option definitions:
    89   #   -O1      Favors reduced size over speed (-Og     -Os -Oy -Ob2 -Gs -GF -Gy)
    98   #   -O1      Favors reduced size over speed (-Og     -Os -Oy -Ob2 -Gs -GF -Gy)
    90   #   -O2      Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
    99   #   -O2      Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
    91   #   -Ox      Full optimization (use -O2)    (-Og -Oi -Ot -Oy -Ob2)
   100   #   -Ox      Full optimization (use -O2)    (-Og -Oi -Ot -Oy -Ob2)
   111   #
   120   #
   112   # NOTE: With VC6, -Ox included -Gs.
   121   # NOTE: With VC6, -Ox included -Gs.
   113   # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
   122   # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
   114   # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
   123   # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
   115   #
   124   #
       
   125 
       
   126   CC_OPT/NONE    = -Od
       
   127   CC_OPT/LOWER   = -O2
       
   128   CC_OPT/HIGHER  = -O3
       
   129   CC_OPT/HIGHEST = -O3
       
   130   
   116   ifeq ($(COMPILER_VERSION), VC6)
   131   ifeq ($(COMPILER_VERSION), VC6)
   117     # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
   132     # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
   118     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   133     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   119     AUTOMATIC_PCH_OPTION =
   134     AUTOMATIC_PCH_OPTION =
   120     GX_OPTION = -GX
   135     GX_OPTION = -GX
   121     ifeq ($(ARCH_DATA_MODEL), 32)
   136     ifeq ($(ARCH_DATA_MODEL), 32)
   122       CC_HIGHEST_OPT = -Ox -Gy -Os -GB
   137       CC_OPT/HIGHEST = -Ox -Gy -Os -GB
   123       CC_HIGHER_OPT  = -Ox -Gy -Os -GB
   138       CC_OPT/HIGHER  = -Ox -Gy -Os -GB
   124       CC_LOWER_OPT   = -Ox -Gy -Os -GB
   139       CC_OPT/LOWER   = -Ox -Gy -Os -GB
   125     else
   140     else
   126       CC_HIGHEST_OPT = -Ox -Gy -Op
   141       CC_OPT/HIGHEST = -Ox -Gy -Op
   127       CC_HIGHER_OPT  = -Ox -Gy -Op
   142       CC_OPT/HIGHER  = -Ox -Gy -Op
   128       CC_LOWER_OPT   = -Ox -Gy -Op
   143       CC_OPT/LOWER   = -Ox -Gy -Op
   129     endif
   144     endif
   130   endif
   145   endif
       
   146   
   131   ifeq ($(COMPILER_VERSION), VS2003)
   147   ifeq ($(COMPILER_VERSION), VS2003)
   132     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   148     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   133     AUTOMATIC_PCH_OPTION = -YX
   149     AUTOMATIC_PCH_OPTION = -YX
   134     # Also known as VC7 compiler
   150     # Also known as VC7 compiler
   135     GX_OPTION = -GX
   151     GX_OPTION = -GX
   136     ifeq ($(ARCH_DATA_MODEL), 32)
   152     ifeq ($(ARCH_DATA_MODEL), 32)
   137       # Lowered opt level to try and reduce footprint, dll size especially.
   153       # Lowered opt level to try and reduce footprint, dll size especially.
   138       #     Was: CC_HIGHEST_OPT = -O2 -G6
   154       #     Was: CC_OPT/HIGHEST = -O2 -G6
   139       #     Was: CC_HIGHER_OPT  = -O2
   155       #     Was: CC_OPT/HIGHER  = -O2
   140       CC_HIGHEST_OPT = -O2
   156       CC_OPT/HIGHEST = -O2
   141       CC_HIGHER_OPT  = -O1
   157       CC_OPT/HIGHER  = -O1
   142       CC_LOWER_OPT   = -O1
   158       CC_OPT/LOWER   = -O1
   143     else
   159     else
   144       CC_HIGHEST_OPT = -O2 -Op
   160       CC_OPT/HIGHEST = -O2 -Op
   145       CC_HIGHER_OPT  = -O2 -Op
   161       CC_OPT/HIGHER  = -O2 -Op
   146       CC_LOWER_OPT   = -O1 -Op
   162       CC_OPT/LOWER   = -O1 -Op
   147     endif
   163     endif
   148   endif
   164   endif
       
   165   
   149   ifeq ($(COMPILER_VERSION), VS2005)
   166   ifeq ($(COMPILER_VERSION), VS2005)
   150     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   167     # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   151     AUTOMATIC_PCH_OPTION =
   168     AUTOMATIC_PCH_OPTION =
   152     # VS2005 compiler, only with Platform SDK right now?
   169     # VS2005 compiler, only with Platform SDK right now?
   153     GX_OPTION = -EHsc
   170     GX_OPTION = -EHsc
   154     ifeq ($(ARCH_DATA_MODEL), 32)
   171     ifeq ($(ARCH_DATA_MODEL), 32)
   155       CC_HIGHEST_OPT = -O2
   172       CC_OPT/HIGHEST = -O2
   156       CC_HIGHER_OPT  = -O1
   173       CC_OPT/HIGHER  = -O1
   157       CC_LOWER_OPT   = -O1
   174       CC_OPT/LOWER   = -O1
   158     else
   175     else
   159       CC_HIGHEST_OPT = -O2
   176       CC_OPT/HIGHEST = -O2
   160       CC_HIGHER_OPT  = -O1
   177       CC_OPT/HIGHER  = -O1
   161       CC_LOWER_OPT   = -O1
   178       CC_OPT/LOWER   = -O1
   162     endif
   179     endif
   163   endif
   180   endif
   164   CC_NO_OPT      = -Od
   181 
   165 else # CC_VERSION
   182 else # CC_VERSION
       
   183   
   166   # GCC not supported, but left for historical reference...
   184   # GCC not supported, but left for historical reference...
   167   CC_HIGHEST_OPT = -O3
   185   CC_OPT/NONE     =
   168   CC_HIGHER_OPT  = -O2
   186   CC_OPT/LOWER    = -O2
   169   CC_LOWER_OPT   = -O2
   187   CC_OPT/HIGHER   = -O2
   170   CC_NO_OPT      = 
   188   CC_OPT/HIGHEST  = -O3
   171 endif
   189 
   172 
   190 endif
   173 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
   191 
   174 ifdef NO_OPTIMIZATIONS
   192 CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
   175   CC_HIGHEST_OPT = $(CC_NO_OPT)
       
   176   CC_HIGHER_OPT  = $(CC_NO_OPT)
       
   177   CC_LOWER_OPT   = $(CC_NO_OPT)
       
   178 endif
       
   179 
       
   180 ifeq ($(PRODUCT), java)
       
   181     _OPT = $(CC_HIGHER_OPT)
       
   182 else
       
   183     _OPT = $(CC_LOWER_OPT)
       
   184 endif
       
   185 
   193 
   186 # Select the runtime support library carefully, need to be consistent
   194 # Select the runtime support library carefully, need to be consistent
   187 #
   195 #
   188 # VS2003 compiler option definitions:
   196 # VS2003 compiler option definitions:
   189 #   -MD        Use dynamic multi-threaded runtime library
   197 #   -MD        Use dynamic multi-threaded runtime library
   231   #   -nologo  Don't print out startup message
   239   #   -nologo  Don't print out startup message
   232   #   /D _STATIC_CPPLIB  
   240   #   /D _STATIC_CPPLIB  
   233   #            Use static link for the C++ runtime (so msvcp71.dll not needed)
   241   #            Use static link for the C++ runtime (so msvcp71.dll not needed)
   234   #   
   242   #   
   235   CFLAGS_COMMON  += -Zi -nologo
   243   CFLAGS_COMMON  += -Zi -nologo
   236   CFLAGS_OPT      = $(POPT)
   244   CFLAGS_OPT      = $(CC_OPT)
   237   CFLAGS_DBG      = -Od $(MS_RUNTIME_DEBUG_OPTION)
   245   CFLAGS_DBG      = -Od $(MS_RUNTIME_DEBUG_OPTION)
   238 
   246 
   239   # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
   247   # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
   240   # by default. However, we expect the wchar_t to be a typedef to the
   248   # by default. However, we expect the wchar_t to be a typedef to the
   241   # unsigned short data type. The -Zc:wchar_t- option restores the old
   249   # unsigned short data type. The -Zc:wchar_t- option restores the old