jdk/makefiles/GensrcIcons.gmk
author dholmes
Tue, 19 Feb 2013 06:27:20 -0500
changeset 15692 859ed6bd0841
parent 14429 f930c8da4439
child 18241 3e009b5be123
permissions -rw-r--r--
8008424: Isolate PROFILE make variable from incidental setting in the environment Reviewed-by: erikj, alanb

#
# Copyright (c) 2011, 2012, 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_X11_ICONS :=
GENSRC_X11_ICONS_SRC :=
GENSRC_X11_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
GENSRC_X11_ICONS_DST := $(GENSRC_X11_ICONS_TMP)/sun/awt/X11

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_X11_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


X11_ICONPATH := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/X11

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

GENSRC_X11_ICONS_FILES := $(notdir $(GENSRC_X11_ICONS_SRC))

GENSRC_X11_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
GENSRC_X11_ICONS_DST_NAME = XAWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))

###

$(GENSRC_X11_ICONS_TMP)/_the.icons.dir :
	$(ECHO) Generating icon classes
	$(MKDIR) -p $(GENSRC_X11_ICONS_DST)
	$(TOUCH) $@

###

define SetupGensrcX11Icon
        # param 1 is for src-file
        # param 2 is for src-dir
	$1_SHORTNAME := $(call GENSRC_X11_ICONS_SHORT_NAME,$1)
	$1_NAME32 := $(call GENSRC_X11_ICONS_DST_NAME,$1,32)
	$1_TARGET32 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME32).java
	$1_NAME64 := $(call GENSRC_X11_ICONS_DST_NAME,$1,64)
	$1_TARGET64 := $(GENSRC_X11_ICONS_DST)/$$($1_NAME64).java

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

GENSRC_X11_ICONS += $$($1_TARGET32)

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

GENSRC_X11_ICONS += $$($1_TARGET64)
endef

$(foreach I,$(GENSRC_X11_ICONS_SRC), $(eval $(call SetupGensrcX11Icon,$(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