1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Install the launcher name, release version string, full version
# string and the runtime name into the VersionProps.java file.
$(eval $(call SetupTextFileProcessing, BUILD_VERSION_JAVA, \
SOURCE_FILES := $(TOPDIR)/src/java.base/share/classes/java/lang/VersionProps.java.template, \
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/VersionProps.java, \
REPLACEMENTS := \
@@LAUNCHER_NAME@@ => $(LAUNCHER_NAME) ; \
@@RUNTIME_NAME@@ => $(RUNTIME_NAME) ; \
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
@@VERSION_STRING@@ => $(VERSION_STRING) ; \
@@VERSION_NUMBER@@ => $(VERSION_NUMBER) ; \
@@VERSION_PRE@@ => $(VERSION_PRE) ; \
@@VERSION_BUILD@@ => $(VERSION_BUILD) ; \
@@VERSION_OPT@@ => $(VERSION_OPT) ; \
@@VERSION_DATE@@ => $(VERSION_DATE) ; \
@@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
@@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; \
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
@@VENDOR_VERSION_STRING@@ => $(VENDOR_VERSION_STRING) ; \
@@VENDOR@@ => $(COMPANY_NAME) ; \
@@VENDOR_URL@@ => $(VENDOR_URL) ; \
@@VENDOR_URL_BUG@@ => $(VENDOR_URL_BUG) ; \
@@VENDOR_URL_VM_BUG@@ => $(VENDOR_URL_VM_BUG), \
))
# Normalize OPENJDK_TARGET_CPU name to match jdk.internal.util.Architecture enum
ifneq ($(filter $(OPENJDK_TARGET_CPU), s390x), )
OPENJDK_TARGET_ARCH_CANONICAL = s390
else ifneq ($(filter $(OPENJDK_TARGET_CPU), x86_64 amd64), )
OPENJDK_TARGET_ARCH_CANONICAL = x64
else
OPENJDK_TARGET_ARCH_CANONICAL := $(OPENJDK_TARGET_CPU)
endif
# Normalize OPENJDK_TARGET_OS operating system name to match jdk.internal.util.OperatingSystem enum
ifeq ($(OPENJDK_TARGET_OS), macosx)
OPENJDK_TARGET_OS_CANONICAL = macos
else
OPENJDK_TARGET_OS_CANONICAL := $(OPENJDK_TARGET_OS)
endif
$(eval $(call SetupTextFileProcessing, BUILD_PLATFORMPROPERTIES_JAVA, \
SOURCE_FILES := $(TOPDIR)/src/java.base/share/classes/jdk/internal/util/PlatformProps.java.template, \
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/util/PlatformProps.java, \
REPLACEMENTS := \
@@OPENJDK_TARGET_OS@@ => $(OPENJDK_TARGET_OS_CANONICAL) ; \
@@OPENJDK_TARGET_CPU@@ => $(OPENJDK_TARGET_ARCH_CANONICAL) ; \
@@OPENJDK_TARGET_CPU_ENDIAN@@ => $(OPENJDK_TARGET_CPU_ENDIAN) ; \
@@OPENJDK_TARGET_CPU_BITS@@ => $(OPENJDK_TARGET_CPU_BITS), \
))
TARGETS += $(BUILD_VERSION_JAVA) $(BUILD_PLATFORMPROPERTIES_JAVA)
################################################################################
ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang), )
# Need to specify language since the template file has a non standard
# extension.
CPP_FLAGS += -x c
else ifeq ($(TOOLCHAIN_TYPE), microsoft)
CPP_FLAGS += -nologo
ifeq ($(OPENJDK_TARGET_CPU), aarch64)
# cl.exe does only recognize few file extensions as valid (ex: .c, .h, .cpp), so
# make sure *.java.template files are recognized as valid input files
CPP_FILEPREFIX = -Tc
endif
endif
# Generate a java source file from a template through the C preprocessor for the
# target system. First extract the copyright notice at the start of the file.
# Run the preprocessor. Filter out the default compiler stderr output on
# Windows. Filter out all the header files output. Remove all "PREFIX_" strings
# that were added to variable references in the template files to avoid being
# matched by the preprocessor. Remove any #line directives left by the
# preprocessor.
define generate-preproc-src
$(call MakeDir, $(@D))
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_$(@F), \
( $(AWK) '/@@END_COPYRIGHT@@/{exit}1' $< && \
$(CPP) $(CPP_FLAGS) $(SYSROOT_CFLAGS) $(CFLAGS_JDKLIB) $(CPP_FILEPREFIX) $< \
2> >($(GREP) -v '^$(<F)$$' >&2) \
| $(AWK) '/@@START_HERE@@/,0' \
| $(SED) -e 's/@@START_HERE@@/\/\/ AUTOMATICALLY GENERATED FILE - DO NOT EDIT/' \
-e 's/PREFIX_//' -e 's/^#.*//' \
) > $@ \
)
endef
GENSRC_SOR_FILE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
$(GENSRC_SOR_FILE): \
$(TOPDIR)/src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template
$(generate-preproc-src)
TARGETS += $(GENSRC_SOR_FILE)
################################################################################
ifeq ($(call isTargetOs, windows), false)
GENSRC_UC_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
$(GENSRC_UC_FILE): \
$(TOPDIR)/src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
$(generate-preproc-src)
TARGETS += $(GENSRC_UC_FILE)
endif
# Create the javax/crypto/JceSecurity.class, using the build default.
#
ifeq ($(UNLIMITED_CRYPTO), true)
JCE_DEFAULT_POLICY = unlimited
else
JCE_DEFAULT_POLICY = limited
endif
ifneq ($(wildcard $(TOPDIR)/src/java.base/share/classes/javax/crypto/JceSecurity.java.template), )
$(eval $(call SetupTextFileProcessing, BUILD_JCESECURITY_JAVA, \
SOURCE_FILES := $(TOPDIR)/src/java.base/share/classes/javax/crypto/JceSecurity.java.template, \
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/javax/crypto/JceSecurity.java, \
REPLACEMENTS := \
@@JCE_DEFAULT_POLICY@@ => $(JCE_DEFAULT_POLICY), \
))
TARGETS += $(BUILD_JCESECURITY_JAVA)
endif
|