view make/Images.gmk @ 1197:3d7b88817c42

Fixed echo line in images build
author erikj
date Tue, 23 Sep 2014 11:05:40 +0200
parents 0f1024cadf20
children e4198a8029d1
line wrap: on
line source
#
# Copyright (c) 2014, 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.
#

default: all

include $(SPEC)
include MakeBase.gmk

TOOL_TARGETS :=
JDK_TARGETS := 
JRE_TARGETS :=

# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Images.gmk))

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

# Dropping jdk.deploy since it currently doesn't exist.
MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
               jdk.security.auth jdk.runtime

# providers
PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
               jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs

# tools
TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
               jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
               jdk.xml.bind jdk.xml.ws

ifeq ($(OPENJDK_TARGET_OS), windows)
  PROVIDER_MODULES += jdk.crypto.mscapi
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
  MAIN_MODULES += jdk.deploy.osx
endif

JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)

# Replacing double-comma with a single comma is to workaround the issue
# with some version of make on windows that doesn't substitute spaces 
# with one comma properly as with make 4.0

JRE_MODULES_LIST := $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(JRE_MODULES)))
JDK_MODULES_LIST := $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(JDK_MODULES)))

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

MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped

JIMAGE_TOOL := $(JAVA_SMALL) \
    -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_bt_classes build.tools.module.ImageBuilder \
    --cmds $(MODULES_CMDS) \
    --libs $(MODULES_LIBS) \
    --classes $(JDK_OUTPUTDIR)/modules \
    #

MODULES_XML += $(SRC_ROOT)/modules.xml
DEPENDENCIES := $(call CacheFind, \
    $(SUPPORT_OUTPUTDIR)/modules_cmds \
    $(SUPPORT_OUTPUTDIR)/modules_libs) \
    $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
    $(MODULES_XML)
    #

$(IMAGES_OUTPUTDIR)/_jdk-jimages-create.marker: $(DEPENDENCIES)
	$(ECHO) Creating jdk jimage
	$(RM) -r $(JDK_IMAGE_DIR)
	$(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
	    $(MODULES_XML)
	$(TOUCH) $@

$(IMAGES_OUTPUTDIR)/_jre-jimages-create.marker: $(DEPENDENCIES)
	$(ECHO) Creating jre jimage
	$(RM) -r $(JRE_IMAGE_DIR)
	$(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
	    $(MODULES_XML)
	$(TOUCH) $@

TOOL_JRE_TARGETS := $(IMAGES_OUTPUTDIR)/_jre-jimages-create.marker
TOOL_JDK_TARGETS := $(IMAGES_OUTPUTDIR)/_jdk-jimages-create.marker

################################################################################
# /man dir
#
# All variables in this section are assigned with simple =, without :, to enable
# more selective overriding from the custom version of this file.
#
# Avoid evaluating this whole section on windows for speed and stability
ifneq ($(OPENJDK_TARGET_OS), windows)
  JRE_MAN_PAGES += \
      java.1 \
      jjs.1 \
      keytool.1 \
      orbd.1 \
      pack200.1 \
      policytool.1 \
      rmid.1 \
      rmiregistry.1 \
      servertool.1 \
      tnameserv.1 \
      unpack200.1

  ifndef OPENJDK
    ifneq ($(OPENJDK_TARGET_OS), solaris)
      JRE_MAN_PAGES += javaws.1
    endif
  endif

  JDK_MAN_PAGES += \
      $(JRE_MAN_PAGES) \
      appletviewer.1 \
      extcheck.1 \
      idlj.1 \
      jar.1 \
      jarsigner.1 \
      javac.1 \
      javadoc.1 \
      javah.1 \
      javap.1 \
      jconsole.1 \
      jcmd.1 \
      jdb.1 \
      jdeps.1 \
      jhat.1 \
      jinfo.1 \
      jmap.1 \
      jps.1 \
      jrunscript.1 \
      jsadebugd.1 \
      jstack.1 \
      jstat.1 \
      jstatd.1 \
      native2ascii.1 \
      rmic.1 \
      schemagen.1 \
      serialver.1 \
      wsgen.1 \
      wsimport.1 \
      xjc.1

  # This variable is potentially overridden in the closed makefile.
  MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src

  ifeq ($(OPENJDK_TARGET_OS), linux)
    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
    MAN1_SUBDIR = man
  endif
  ifeq ($(OPENJDK_TARGET_OS), solaris)
    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
    MAN1_SUBDIR = sun/man/man1
  endif
  ifeq ($(OPENJDK_TARGET_OS), macosx)
    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
    MAN1_SUBDIR = man
  endif

  $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)

  $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)

  define install-ja-manpage
	$(MKDIR) -p $(@D)
	$(CAT) $< \
	    | $(NATIVE2ASCII) -encoding eucJP \
	    | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
	    | $(NATIVE2ASCII) -reverse -encoding $1 \
	    > $@
  endef

  $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call install-ja-manpage, UTF-8)

  $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call install-ja-manpage, UTF-8)

  $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call install-ja-manpage, PCK)

  $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call install-ja-manpage, PCK)

  ifeq ($(OPENJDK_TARGET_OS), solaris)
    $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)

    $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)
  endif

  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
    $(JRE_IMAGE_DIR)/man/ja:
	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja

    $(JDK_IMAGE_DIR)/man/ja:
	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
  endif

  ifeq ($(OPENJDK_TARGET_OS), solaris)
    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
        $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))

    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
        $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
  endif

  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
        $(JRE_IMAGE_DIR)/man/ja

    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
        $(JDK_IMAGE_DIR)/man/ja
  endif

  JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
  JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
endif # Windows

################################################################################
# /include dir

$(eval $(call SetupCopyFiles,COPY_INCLUDES, \
    SRC := $(JDK_OUTPUTDIR)/include, \
    DEST := $(JDK_IMAGE_DIR)/include, \
    FILES := $(call CacheFind,$(JDK_OUTPUTDIR)/include)))

JDK_TARGETS += $(COPY_INCLUDES)

################################################################################
# doc files

JRE_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
JDK_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
JRE_DOC_LOCATION ?= $(JDK_TOPDIR)
JDK_DOC_LOCATION ?= $(JDK_TOPDIR)

JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))

# Processing license files from source area to image area
# These are modified to have the platform specific EOL chars.
define process-doc-file
	$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(MKDIR) -p $(@D)
	$(RM) $@
	LC_ALL=C $(SED) 's/$$//g' $< > $@
	$(CHMOD) 444 $@
endef

$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
	$(process-doc-file)

$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
	$(process-doc-file)

JRE_TARGETS += $(JRE_DOC_TARGETS)
JDK_TARGETS += $(JDK_DOC_TARGETS)

################################################################################
# Release file

JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release

# Common way to emit a line into the release or info file
define info-file-item # name value
	$(PRINTF) '%s="%s"\n' $1 $2 >> $@
endef

define create-info-file
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
	$(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
	$(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
	$(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
	$(if $(JDK_ARCH_ABI_PROP_NAME), \
	  $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
	$(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
endef

ALL_SOURCE_TIPS = $(shell \
    if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
      $(CAT) $(OUTPUT_ROOT)/source_tips ; \
    fi)

$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call create-info-file)

$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(call create-info-file)

JRE_TARGETS += $(JRE_INFO_FILE)
JDK_TARGETS += $(JDK_INFO_FILE)

################################################################################
# src.zip

$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(install-file)

JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip

################################################################################
# /demo dir

# The db demo contains an empty dir that needs to be copied. The other
# directories will always trigger the rule for recompile since
# _the.list_of_packages files are touched.
$(JDK_IMAGE_DIR)/demo/%: $(IMAGES_OUTPUTDIR)/demo/%
	if [ ! -d "$@" ]; then \
	  $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
	  $(MKDIR) -p $(@D); \
	  if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
	fi

# Find all files including directories
JDK_DEMO_TARGETS := $(patsubst $(IMAGES_OUTPUTDIR)/demo/%, $(JDK_IMAGE_DIR)/demo/%, \
    $(shell $(FIND) $(IMAGES_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))

JDK_TARGETS += $(JDK_DEMO_TARGETS)

################################################################################
# /sample dir

$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
    SRC := $(IMAGES_OUTPUTDIR)/sample, \
    DEST := $(JDK_IMAGE_DIR)/sample, \
    FILES := $(call CacheFind,$(IMAGES_OUTPUTDIR)/sample)))

JDK_TARGETS += $(COPY_SAMPLES)

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

$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
$(JDK_TARGETS): $(TOOL_JDK_TARGETS)

all: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)

.PHONY: default all

# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Images-post.gmk))