jdk/make/gensrc/GensrcIcons.gmk
author ihse
Tue, 11 Oct 2016 09:50:04 +0200
changeset 41472 ca054ba21d38
parent 39504 96c700e62710
permissions -rw-r--r--
8167424: Various trivial fixes in build system Reviewed-by: erikj, tbell

#
# 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.
#

$(eval $(call IncludeCustomExtension, jdk, gensrc/GensrcIcons.gmk))

GENSRC_AWT_ICONS :=
GENSRC_AWT_ICONS_SRC :=
GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/

# Allow this to be overridden from a custom makefile
X11_ICONS_PATH_PREFIX ?= $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)

GENSRC_AWT_ICONS_SRC += \
    $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
    $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
    $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
    $(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png


AWT_ICONPATH := $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/awt/resources

GENSRC_AWT_ICONS_SRC += \
    $(AWT_ICONPATH)/security-icon-bw16.png \
    $(AWT_ICONPATH)/security-icon-interim16.png \
    $(AWT_ICONPATH)/security-icon-yellow16.png \
    $(AWT_ICONPATH)/security-icon-bw24.png \
    $(AWT_ICONPATH)/security-icon-interim24.png \
    $(AWT_ICONPATH)/security-icon-yellow24.png \
    $(AWT_ICONPATH)/security-icon-bw32.png \
    $(AWT_ICONPATH)/security-icon-interim32.png \
    $(AWT_ICONPATH)/security-icon-yellow32.png \
    $(AWT_ICONPATH)/security-icon-bw48.png \
    $(AWT_ICONPATH)/security-icon-interim48.png \
    $(AWT_ICONPATH)/security-icon-yellow48.png

GENSRC_AWT_ICONS_FILES := $(notdir $(GENSRC_AWT_ICONS_SRC))

GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))

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

$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
	$(call LogInfo, Generating icon classes)
	$(call MakeDir, $(GENSRC_AWT_ICONS_DST))
	$(TOUCH) $@

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

define SetupGensrcAWTIcon
  # param 1 is for src-file
  # param 2 is for src-dir
  $1_SHORTNAME := $(call GENSRC_AWT_ICONS_SHORT_NAME,$1)
  $1_NAME32 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,32)
  $1_TARGET32 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME32).java
  $1_NAME64 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,64)
  $1_TARGET64 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME64).java

  $$($1_TARGET32): $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir $(BUILD_TOOLS_JDK)
	$(RM) $$@ $$@.tmp
	$(ECHO) "package sun.awt;" > $$@.tmp
	$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
	$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
	$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
	$(ECHO) "}; }" >> $$@.tmp
	$(MV) $$@.tmp $$@

  GENSRC_AWT_ICONS += $$($1_TARGET32)

  $$($1_TARGET64): $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir $(BUILD_TOOLS_JDK)
	$(RM) $$@ $$@.tmp
	$(ECHO) "package sun.awt;" > $$@.tmp
	$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
	$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
	$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
	$(ECHO) "}; }" >> $$@.tmp
	$(MV) $$@.tmp $$@

  GENSRC_AWT_ICONS += $$($1_TARGET64)
endef

$(foreach I, $(GENSRC_AWT_ICONS_SRC), $(eval $(call SetupGensrcAWTIcon,$(notdir $(I)),$(dir $(I)))))

GENSRC_JAVA_DESKTOP += $(GENSRC_AWT_ICONS)

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

ifeq ($(OPENJDK_TARGET_OS), macosx)

  GENSRC_OSX_ICONS_DST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop
  GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h

  GENSRC_OSX_ICONS_SRC ?= $(JDK_TOPDIR)/make/data/macosxicons/JavaApp.icns


  $(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
	$(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
	$(call MakeDir, $(@D))
	$(RM) $@ $@.tmp
	$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
	$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
	$(ECHO) "};" >> $@.tmp
	$(MV) $@.tmp $@

  GENSRC_JAVA_DESKTOP += $(GENSRC_OSX_ICONS)
endif