jdk/makefiles/GensrcIcons.gmk
author ihse
Thu, 10 Oct 2013 15:06:21 +0200
changeset 20547 453837141fac
parent 18241 3e009b5be123
permissions -rw-r--r--
8001931: The new build system whitespace cleanup Reviewed-by: tbell, simonis, erikj

#
# 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)/sun/awt/

ifdef OPENJDK
  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)
else
  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/solaris
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/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
	$(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
	$(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)))))

###

ifeq ($(OPENJDK_TARGET_OS), macosx)

  GENSRC_OSX_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
  GENSRC_OSX_ICONS_DST := $(GENSRC_OSX_ICONS_TMP)/sun/osxapp
  GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h

  ifdef OPENJDK
    GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/src/macosx/native/sun/osxapp/resource/icons/JavaApp.icns
  else
    GENSRC_OSX_ICONS_SRC := $(JDK_TOPDIR)/src/closed/macosx/native/sun/osxapp/resource/icons/JavaApp.icns
  endif

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

endif