1 #
   2 # Copyright (c) 2014, 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.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 include CopyCommon.gmk
  27 
  28 $(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.base.gmk))
  29 
  30 ################################################################################
  31 #
  32 # Copy exported header files to outputdir.
  33 #
  34 JAVA_BASE_HEADERS := \
  35     $(INCLUDE_DST_DIR)/jni.h \
  36     $(INCLUDE_DST_DIR)/jvmti.h \
  37     $(INCLUDE_DST_DIR)/jvmticmlr.h \
  38     $(INCLUDE_DST_DIR)/classfile_constants.h \
  39     $(INCLUDE_DST_OS_DIR)/jni_md.h \
  40     #
  41 
  42 $(INCLUDE_DST_DIR)/%.h: $(JDK_TOPDIR)/src/java.base/share/native/include/%.h
  43         $(call install-file)
  44 
  45 $(INCLUDE_DST_OS_DIR)/%.h: \
  46     $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include/%.h
  47         $(call install-file)
  48 
  49 ################################################################################
  50 
  51 CALENDARS_SRC := $(JDK_TOPDIR)/src/java.base/share/conf
  52 
  53 $(LIB_DST_DIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties
  54         $(call install-file)
  55 
  56 BASE_CONF_FILES += $(LIB_DST_DIR)/calendars.properties
  57 
  58 $(LIB_DST_DIR)/hijrah-config-umalqura.properties: $(CALENDARS_SRC)/hijrah-config-umalqura.properties
  59         $(MKDIR) -p $(@D)
  60         $(RM) $@
  61         $(CP) $< $@
  62 
  63 BASE_CONF_FILES += $(LIB_DST_DIR)/hijrah-config-umalqura.properties
  64 
  65 ################################################################################
  66 
  67 ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
  68 
  69   TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
  70 
  71   $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
  72         $(call install-file)
  73 
  74   BASE_CONF_FILES += $(LIB_DST_DIR)/tzmappings
  75 
  76 endif
  77 
  78 ################################################################################
  79 # Copy msvcrXX.dll on windows
  80 
  81 ifeq ($(OPENJDK_TARGET_OS), windows)
  82   MSVCR_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCR_DLL))
  83   # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
  84   $(MSVCR_TARGET): $(MSVCR_DLL)
  85         $(call install-file)
  86         $(CHMOD) a+rx $@
  87 endif
  88 
  89 ################################################################################
  90 #
  91 # How to install jvm.cfg.
  92 #
  93 ifeq ($(JVM_VARIANT_ZERO), true)
  94   JVMCFG_ARCH := zero
  95 else
  96   JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
  97 endif
  98 
  99 ifeq ($(OPENJDK_TARGET_OS), macosx)
 100   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
 101 else
 102   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg
 103 endif
 104 JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 105 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
 106 
 107 # To do: should this also support -zeroshark?
 108 
 109 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
 110   COPY_JVM_CFG_FILE := true
 111 else
 112   # On 32-bit machines we have three potential VMs: client, server and minimal.
 113   # Historically we usually have both client and server and so that is what the
 114   # committed jvm.cfg expects (including platform specific ergonomics switches
 115   # to decide whether to use client or server by default). So when we have anything
 116   # other than client and server we need to define a new jvm.cfg file.
 117   # The main problem is deciding whether to use aliases for the VMs that are not
 118   # present and the current position is that we add aliases for client and server, but
 119   # not for minimal.
 120   CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
 121   ifeq ($(CLIENT_AND_SERVER), true)
 122     COPY_JVM_CFG_FILE := true
 123   else
 124     # For zero, the default jvm.cfg file is sufficient
 125     ifeq ($(JVM_VARIANT_ZERO), true)
 126       COPY_JVM_CFG_FILE := true
 127     endif
 128   endif
 129 endif
 130 
 131 ifeq ($(COPY_JVM_CFG_FILE), true)
 132   $(JVMCFG): $(JVMCFG_SRC)
 133         $(call install-file)
 134 else
 135   $(JVMCFG):
 136         $(MKDIR) -p $(@D)
 137         $(RM) $(@)
 138         # Now check for other permutations
 139         ifeq ($(JVM_VARIANT_SERVER), true)
 140           $(PRINTF) "-server KNOWN\n">>$(@)
 141           $(PRINTF) "-client ALIASED_TO -server\n">>$(@)
 142           ifeq ($(JVM_VARIANT_MINIMAL1), true)
 143             $(PRINTF) "-minimal KNOWN\n">>$(@)
 144           endif
 145         else
 146           ifeq ($(JVM_VARIANT_CLIENT), true)
 147             $(PRINTF) "-client KNOWN\n">>$(@)
 148             $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
 149             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 150               $(PRINTF) "-minimal KNOWN\n">>$(@)
 151             endif
 152           else
 153             ifeq ($(JVM_VARIANT_MINIMAL1), true)
 154               $(PRINTF) "-minimal KNOWN\n">>$(@)
 155               $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
 156               $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
 157             endif
 158           endif
 159         endif
 160 endif
 161 
 162 BASE_CONF_FILES += $(JVMCFG)
 163 
 164 ################################################################################
 165 
 166 POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
 167 POLICY_DST := $(JDK_OUTPUTDIR)/lib/security/java.policy
 168 
 169 POLICY_SRC_LIST :=
 170 
 171 ifeq ($(OPENJDK_TARGET_OS), windows)
 172   POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 173 endif
 174 ifndef OPENJDK
 175   ifeq ($(OPENJDK_TARGET_OS), windows)
 176     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
 177       POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy-win32
 178     else
 179       POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy-win64
 180     endif
 181   endif
 182   ifeq ($(OPENJDK_TARGET_OS), solaris)
 183     POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
 184   endif
 185 endif
 186 
 187 POLICY_SRC_LIST += $(POLICY_SRC)
 188 
 189 $(POLICY_DST): $(POLICY_SRC_LIST)
 190         $(MKDIR) -p $(@D)
 191         $(RM) $@ $@.tmp
 192         $(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
 193         $(MV) $@.tmp $@
 194 
 195 BASE_CONF_FILES += $(POLICY_DST)
 196 
 197 ################################################################################
 198 
 199 ifeq ($(CACERTS_FILE), )
 200   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 201 endif
 202 CACERTS_DST := $(JDK_OUTPUTDIR)/lib/security/cacerts
 203 
 204 $(CACERTS_DST): $(CACERTS_FILE)
 205         $(call install-file)
 206 
 207 BASE_CONF_FILES += $(CACERTS_DST)
 208 
 209 ################################################################################
 210 
 211 ifeq ($(OPENJDK_TARGET_OS), solaris)
 212 
 213   SUNPKCS11_CFG_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/sunpkcs11-solaris.cfg
 214   SUNPKCS11_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/sunpkcs11-solaris.cfg
 215 
 216   $(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC)
 217         $(call install-file)
 218 
 219   BASE_CONF_FILES += $(SUNPKCS11_CFG_DST)
 220 
 221 endif
 222 
 223 ################################################################################
 224 
 225 $(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
 226         $(ECHO) $(LOG_INFO) Copying $(@F)
 227         $(call install-file)
 228 
 229 NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
 230 
 231 ifeq ($(OPENJDK_TARGET_OS), solaris)
 232   $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
 233         $(ECHO) $(LOG_INFO) Copying $(@F)
 234         $(call install-file)
 235 
 236   NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
 237 endif
 238 
 239 ################################################################################
 240 
 241 java.base: $(BASE_CONF_FILES) $(NET_CONF_FILES) $(JAVA_BASE_HEADERS) $(MSVCR_TARGET)
 242 
 243 all: java.base
 244 
 245 .PHONY: all java.base