jdk/make/gensrc/GensrcIcons.gmk
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 22957 99352a8b3052
child 27736 8c9bd4be4a86
child 27565 729f9700483a
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com

#
# Copyright (c) 2011, 2013, 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.
#

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

ifdef OPENJDK
  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
else
  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
endif

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:
	$(ECHO) Generating icon classes
	$(MKDIR) -p $(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 := $(JDK_OUTPUTDIR)/gensrc_headers_icons
  GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h

  ifdef OPENJDK
    GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/make/data/macosxicons/JavaApp.icns
  else
    GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/make/closed/data/macosxicons/JavaApp.icns
  endif

  $(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
	$(RM) $@ $@.tmp
	$(MKDIR) -p $(dir $@)
	$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
	$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
	$(ECHO) "};" >> $@.tmp
	$(MV) $@.tmp $@

  GENSRC_JAVA_DESKTOP += $(GENSRC_OSX_ICONS)
endif