1 #
   2 # Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   3 # Copyright 2019 Red Hat, Inc.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #
  24 #
  25 
  26 # Note: this makefile is invoked both from build.bat and from the J2SE
  27 # control workspace in exactly the same manner; the required
  28 # environment variables (Variant, WorkSpace, BootStrapDir, BuildUser, HOTSPOT_BUILD_VERSION)
  29 # are passed in as command line arguments.
  30 
  31 # Note: Running nmake or build.bat from the Windows command shell requires
  32 # that "sh" be accessible on the PATH. An MKS install does this.
  33 
  34 # SA components are built if BUILD_WIN_SA=1 is specified.
  35 # See notes in README. This produces files:
  36 #  1. sa-jdi.jar       - This is built before building jvm.dll
  37 #  2. sawindbg.dll     - Native library for SA - This is built after jvm.dll
  38 #                      - Also, .lib, .map, .pdb.
  39 #
  40 # Please refer to ./makefiles/sa.make
  41 
  42 # If we haven't set an ARCH yet use x86
  43 # create.bat and build.bat will set it, if used.
  44 !ifndef ARCH
  45 ARCH=x86
  46 !endif
  47 
  48 
  49 # Must be one of these values (if value comes in from env, can't trust it)
  50 !if "$(ARCH)" != "x86"
  51 !if "$(ARCH)" != "ia64"
  52 ARCH=x86
  53 !endif
  54 !endif
  55 
  56 # At this point we should be certain that ARCH has a definition
  57 # now determine the BUILDARCH
  58 #
  59 
  60 # the default BUILDARCH
  61 BUILDARCH=i486
  62 
  63 # Allow control workspace to force Itanium or AMD64 builds with LP64
  64 ARCH_TEXT=
  65 !ifdef LP64
  66 !if "$(LP64)" == "1"
  67 ARCH_TEXT=64-Bit
  68 !if "$(ARCH)" == "x86"
  69 BUILDARCH=amd64
  70 !else
  71 BUILDARCH=ia64
  72 !endif
  73 !endif
  74 !endif
  75 
  76 !if "$(BUILDARCH)" != "ia64"
  77 !ifndef CC_INTERP
  78 !ifndef FORCE_TIERED
  79 FORCE_TIERED=1
  80 !endif
  81 !endif
  82 !endif
  83 
  84 !if "$(BUILDARCH)" == "amd64"
  85 Platform_arch=x86
  86 Platform_arch_model=x86_64
  87 !endif
  88 !if "$(BUILDARCH)" == "i486"
  89 Platform_arch=x86
  90 Platform_arch_model=x86_32
  91 !endif
  92 
  93 # Supply these from the command line or the environment
  94 #  It doesn't make sense to default this one
  95 Variant=
  96 #  It doesn't make sense to default this one
  97 WorkSpace=
  98 
  99 variantDir = windows_$(BUILDARCH)_$(Variant)
 100 
 101 realVariant=$(Variant)
 102 VARIANT_TEXT=Core
 103 !if "$(Variant)" == "compiler1"
 104 VARIANT_TEXT=Client
 105 !elseif "$(Variant)" == "compiler2"
 106 !if "$(FORCE_TIERED)" == "1"
 107 VARIANT_TEXT=Server
 108 realVariant=tiered
 109 !else
 110 VARIANT_TEXT=Server
 111 !endif
 112 !elseif "$(Variant)" == "tiered"
 113 VARIANT_TEXT=Tiered
 114 !endif
 115 
 116 #########################################################################
 117 # Parameters for VERSIONINFO resource for jvm.dll.
 118 # These can be overridden via the nmake.exe command line.
 119 # They are overridden by RE during the control builds.
 120 #
 121 !include "$(WorkSpace)/make/hotspot_version"
 122 
 123 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
 124 # or make/hotspot_distro.
 125 !ifndef HOTSPOT_VM_DISTRO
 126 !if exists($(WorkSpace)\src\closed)
 127 
 128 # if the build is for JDK6 or earlier version, it should include jdk6_hotspot_distro,
 129 # instead of hotspot_distro.
 130 JDK6_OR_EARLIER=0
 131 !if "$(JDK_MAJOR_VERSION)" != "" && "$(JDK_MINOR_VERSION)" != "" && "$(JDK_MICRO_VERSION)" != ""
 132 !if $(JDK_MAJOR_VERSION) == 1 && $(JDK_MINOR_VERSION) < 7
 133 JDK6_OR_EARLIER=1
 134 !endif
 135 !else
 136 !if $(JDK_MAJOR_VER) == 1 && $(JDK_MINOR_VER) < 7
 137 JDK6_OR_EARLIER=1
 138 !endif
 139 !endif
 140 
 141 !if $(JDK6_OR_EARLIER) == 1
 142 !include $(WorkSpace)\make\jdk6_hotspot_distro
 143 !else
 144 !include $(WorkSpace)\make\hotspot_distro
 145 !endif
 146 !else
 147 !include $(WorkSpace)\make\openjdk_distro
 148 !endif
 149 !endif
 150 
 151 # Following the Web Start / Plugin model here....
 152 # We can have update versions like "01a", but Windows requires
 153 # we use only integers in the file version field.  So:
 154 # JDK_UPDATE_VER = JDK_UPDATE_VERSION * 10 + EXCEPTION_VERSION
 155 #
 156 JDK_UPDATE_VER=0
 157 JDK_BUILD_NUMBER=0
 158 
 159 HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(ARCH_TEXT) $(VARIANT_TEXT) VM
 160 
 161 # JDK ProductVersion:
 162 # 1.5.0_<wx>-b<yz> will have DLL version 5.0.wx*10.yz
 163 # Thus, 1.5.0_10-b04  will be 5.0.100.4
 164 #       1.6.0-b01     will be 6.0.0.1
 165 #       1.6.0_01a-b02 will be 6.0.11.2
 166 #
 167 # JDK_* variables are defined in make/hotspot_version or on command line
 168 #
 169 JDK_VER=$(JDK_MINOR_VER),$(JDK_MICRO_VER),$(JDK_UPDATE_VER),$(JDK_BUILD_NUMBER)
 170 JDK_DOTVER=$(JDK_MINOR_VER).$(JDK_MICRO_VER).$(JDK_UPDATE_VER).$(JDK_BUILD_NUMBER)
 171 !if "$(JRE_RELEASE_VERSION)" == ""
 172 JRE_RELEASE_VER=$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)
 173 !else
 174 JRE_RELEASE_VER=$(JRE_RELEASE_VERSION)
 175 !endif
 176 !if "$(JDK_MKTG_VERSION)" == ""
 177 JDK_MKTG_VERSION=$(JDK_MINOR_VER).$(JDK_MICRO_VER)
 178 !endif
 179 
 180 # Hotspot Express VM FileVersion:
 181 # 10.0-b<yz> will have DLL version 10.0.0.yz (need 4 numbers).
 182 #
 183 # HS_* variables are defined in make/hotspot_version
 184 #
 185 HS_VER=$(HS_MAJOR_VER),$(HS_MINOR_VER),0,$(HS_BUILD_NUMBER)
 186 HS_DOTVER=$(HS_MAJOR_VER).$(HS_MINOR_VER).0.$(HS_BUILD_NUMBER)
 187 
 188 !if "$(HOTSPOT_RELEASE_VERSION)" == ""
 189 HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
 190 !endif
 191 
 192 !if "$(HOTSPOT_BUILD_VERSION)" == ""
 193 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)
 194 !else
 195 HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)
 196 !endif
 197 
 198 # End VERSIONINFO parameters
 199 
 200 # if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK
 201 !ifndef OPENJDK
 202 !if !exists($(WorkSpace)\src\closed)
 203 OPENJDK=true
 204 !endif
 205 !endif
 206 
 207 # We don't support SA on ia64, and we can't
 208 # build it if we are using a version of Vis Studio
 209 # older than .Net 2003.
 210 # SA_INCLUDE and SA_LIB are hold-overs from a previous
 211 # implementation in which we could build SA using
 212 # Debugging Tools For Windows, in which the .h/.lib files
 213 # and the .dlls are in different places than
 214 # they are for Vis Studio .Net 2003.
 215 # If that code ever needs to be resurrected, these vars
 216 # can be set here.  They are used in makefiles/sa.make.
 217 
 218 checkSA::
 219 
 220 !if "$(BUILD_WIN_SA)" != "1"
 221 checkSA::
 222         @echo     Not building SA:  BUILD_WIN_SA != 1
 223 
 224 !elseif "$(ARCH)" == "ia64"
 225 BUILD_WIN_SA = 0
 226 checkSA::
 227         @echo     Not building SA:  ARCH = ia64
 228 
 229 !endif  # ! "$(BUILD_WIN_SA)" != "1"
 230 
 231 #########################################################################
 232 
 233 defaultTarget: product
 234 
 235 # The product or release build is an optimized build, and is the default
 236 
 237 # note that since all the build targets depend on local.make that BUILDARCH
 238 # and Platform_arch and Platform_arch_model will get set in local.make
 239 # and there is no need to pass them thru here on the command line
 240 #
 241 product release optimized: checks $(variantDir) $(variantDir)\local.make sanity
 242         cd $(variantDir)
 243         nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=product ARCH=$(ARCH)
 244 
 245 # The debug build is an optional build
 246 debug: checks $(variantDir) $(variantDir)\local.make sanity
 247         cd $(variantDir)
 248         nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=debug ARCH=$(ARCH)
 249 fastdebug: checks $(variantDir) $(variantDir)\local.make sanity
 250         cd $(variantDir)
 251         nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=fastdebug ARCH=$(ARCH)
 252 
 253 # target to create just the directory structure
 254 tree: checks $(variantDir) $(variantDir)\local.make sanity
 255         mkdir $(variantDir)\product
 256         mkdir $(variantDir)\debug
 257         mkdir $(variantDir)\fastdebug
 258 
 259 sanity:
 260         @ echo;
 261         @ cd $(variantDir)
 262         @ nmake -nologo -f $(WorkSpace)\make\windows\makefiles\sanity.make
 263         @ cd ..
 264         @ echo;
 265 
 266 clean: checkVariant
 267         - rm -r -f $(variantDir)
 268 
 269 $(variantDir):
 270         mkdir $(variantDir)
 271 
 272 $(variantDir)\local.make: checks
 273         @ echo # Generated file                                 >  $@
 274         @ echo Variant=$(realVariant)                           >> $@
 275         @ echo WorkSpace=$(WorkSpace)                           >> $@
 276         @ echo BootStrapDir=$(BootStrapDir)                     >> $@
 277         @ if "$(USERNAME)" NEQ "" echo BuildUser=$(USERNAME)    >> $@
 278         @ echo HS_VER=$(HS_VER)                                 >> $@
 279         @ echo HS_DOTVER=$(HS_DOTVER)                           >> $@
 280         @ echo HS_COMPANY=$(COMPANY_NAME)                       >> $@
 281         @ echo HS_FILEDESC=$(HS_FILEDESC)                       >> $@
 282         @ echo HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO)           >> $@
 283         @ echo VENDOR=$(VENDOR)                                 >> $@
 284         @ echo VENDOR_URL=$(VENDOR_URL)                         >> $@
 285         @ echo VENDOR_URL_BUG=$(VENDOR_URL_BUG)                 >> $@
 286         @ echo VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG)           >> $@
 287         @ if "$(OPENJDK)" NEQ "" echo OPENJDK=$(OPENJDK)        >> $@
 288         @ echo HS_COPYRIGHT=$(HOTSPOT_VM_COPYRIGHT)             >> $@
 289         @ echo HS_NAME=$(PRODUCT_NAME) $(JDK_MKTG_VERSION)      >> $@
 290         @ echo HS_BUILD_VER=$(HS_BUILD_VER)                     >> $@
 291         @ echo BUILD_WIN_SA=$(BUILD_WIN_SA)                     >> $@
 292         @ echo SA_BUILD_VERSION=$(HS_BUILD_VER)                 >> $@
 293         @ echo SA_INCLUDE=$(SA_INCLUDE)                         >> $@
 294         @ echo SA_LIB=$(SA_LIB)                                 >> $@
 295         @ echo JDK_VER=$(JDK_VER)                               >> $@
 296         @ echo JDK_DOTVER=$(JDK_DOTVER)                         >> $@
 297         @ echo JRE_RELEASE_VER=$(JRE_RELEASE_VER)               >> $@
 298         @ echo BUILDARCH=$(BUILDARCH)                           >> $@
 299         @ echo Platform_arch=$(Platform_arch)                   >> $@
 300         @ echo Platform_arch_model=$(Platform_arch_model)       >> $@
 301         @ echo CXX=$(CXX)                                       >> $@
 302         @ echo LD=$(LD)                                         >> $@
 303         @ echo MT=$(MT)                                         >> $@
 304         @ echo RC=$(RC)                                         >> $@
 305         @ echo ENABLE_JFR=$(ENABLE_JFR)                         >> $@
 306         @ sh $(WorkSpace)/make/windows/get_msc_ver.sh           >> $@
 307         @ if "$(ENABLE_FULL_DEBUG_SYMBOLS)" NEQ "" echo ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) >> $@
 308         @ if "$(ZIP_DEBUGINFO_FILES)" NEQ "" echo ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) >> $@
 309         @ if "$(RM)" NEQ "" echo RM=$(RM)                       >> $@
 310         @ if "$(ZIPEXE)" NEQ "" echo ZIPEXE=$(ZIPEXE)           >> $@
 311 
 312 checks: checkVariant checkWorkSpace checkSA
 313 
 314 checkVariant:
 315         @ if "$(Variant)"=="" echo Need to specify "Variant=[tiered|compiler2|compiler1|core]" && false
 316         @ if "$(Variant)" NEQ "tiered" if "$(Variant)" NEQ "compiler2" if "$(Variant)" NEQ "compiler1" if "$(Variant)" NEQ "core" \
 317           echo Need to specify "Variant=[tiered|compiler2|compiler1|core]" && false
 318 
 319 checkWorkSpace:
 320         @ if "$(WorkSpace)"=="" echo Need to specify "WorkSpace=..." && false
 321 
 322 checkBuildID:
 323         @ if "$(BuildID)"=="" echo Need to specify "BuildID=..." && false