jdk/make/gensrc/GensrcMisc.gmk
author chegar
Thu, 03 Mar 2016 12:07:13 +0000
changeset 36225 6ae0eebc46e9
parent 36110 91a3a6df36ec
child 36672 9e18f32e76c9
permissions -rw-r--r--
8150162: Move sun.misc.Version to a truly internal package Reviewed-by: alanb, iris, mchung, rriggs

#
# Copyright (c) 2011, 2016, 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 := $(JDK_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), \
))

GENSRC_JAVA_BASE += $(BUILD_VERSION_JAVA)

##########################################################################################

GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java

GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch
GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c
GENSRC_SOR_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSocketOptionRegistry

SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
    $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')

$(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOR_EXE, \
    SRC := $(GENSRC_SOR_SRC), \
    INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
    CFLAGS_windows := -nologo, \
    LDFLAGS_windows := -nologo, \
    TOOLCHAIN := TOOLCHAIN_BUILD, \
    OBJECT_DIR := $(GENSRC_SOR_BIN), \
    OUTPUT_DIR := $(GENSRC_SOR_BIN), \
    PROGRAM := genSocketOptionRegistry))

SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template

ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE_TARGET)
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
	$(BUILD_GENSRC_SOR_EXE_TARGET) >> $@.tmp
	$(MV) $@.tmp $@
else
  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
	$(call install-file)
endif

##########################################################################################

ifneq ($(OPENJDK_TARGET_OS), windows)

  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java

  GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
  GENSRC_UC_SRC_FILE := genUnixConstants.c
  GENSRC_UC_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genUnixConstants

  UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
      $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')

  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_UC_EXE, \
      SRC := $(GENSRC_UC_SRC), \
      INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
      TOOLCHAIN := TOOLCHAIN_BUILD, \
      OBJECT_DIR := $(GENSRC_UC_BIN), \
      OUTPUT_DIR := $(GENSRC_UC_BIN), \
      PROGRAM := genUnixConstants))

  UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template

  ifeq ($(wildcard $(UC_PREGEN_FILE)), )
    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE_TARGET)
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
	$(BUILD_GENSRC_UC_EXE_TARGET) >> $@.tmp
	$(MV) $@.tmp $@
  else
    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
	$(call install-file)
  endif

endif

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS), solaris)

  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java

  GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
  GENSRC_SOL_SRC_FILE := genSolarisConstants.c
  GENSRC_SOL_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSolarisConstants

  SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
      $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')

  $(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOL_EXE, \
      SRC := $(GENSRC_SOL_SRC), \
      INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
      TOOLCHAIN := TOOLCHAIN_BUILD, \
      OBJECT_DIR := $(GENSRC_SOL_BIN), \
      OUTPUT_DIR := $(GENSRC_SOL_BIN), \
      PROGRAM := genSolarisConstants))

  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE_TARGET)
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
	$(BUILD_GENSRC_SOL_EXE_TARGET) >> $@.tmp
	$(MV) $@.tmp $@


endif

##########################################################################################