jdk
127 строк · 4.8 Кб
1#
2# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26GENSRC_AWT_ICONS :=
27GENSRC_AWT_ICONS_SRC :=
28GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
29GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/
30
31# Allow this to be overridden from a custom makefile
32X11_ICONS_PATH_PREFIX ?= $(MODULE_SRC)/$(OPENJDK_TARGET_OS_TYPE)
33
34GENSRC_AWT_ICONS_SRC += \
35$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
36$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
37$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
38$(X11_ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
39
40
41AWT_ICONPATH := $(MODULE_SRC)/share/classes/sun/awt/resources
42
43GENSRC_AWT_ICONS_SRC += \
44$(AWT_ICONPATH)/security-icon-bw16.png \
45$(AWT_ICONPATH)/security-icon-interim16.png \
46$(AWT_ICONPATH)/security-icon-yellow16.png \
47$(AWT_ICONPATH)/security-icon-bw24.png \
48$(AWT_ICONPATH)/security-icon-interim24.png \
49$(AWT_ICONPATH)/security-icon-yellow24.png \
50$(AWT_ICONPATH)/security-icon-bw32.png \
51$(AWT_ICONPATH)/security-icon-interim32.png \
52$(AWT_ICONPATH)/security-icon-yellow32.png \
53$(AWT_ICONPATH)/security-icon-bw48.png \
54$(AWT_ICONPATH)/security-icon-interim48.png \
55$(AWT_ICONPATH)/security-icon-yellow48.png
56
57GENSRC_AWT_ICONS_FILES := $(notdir $(GENSRC_AWT_ICONS_SRC))
58
59GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
60GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
61
62################################################################################
63
64$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
65$(call LogInfo, Generating icon classes)
66$(call MakeDir, $(GENSRC_AWT_ICONS_DST))
67$(TOUCH) $@
68
69################################################################################
70
71define SetupGensrcAWTIcon
72# param 1 is for src-file
73# param 2 is for src-dir
74$1_SHORTNAME := $(call GENSRC_AWT_ICONS_SHORT_NAME,$1)
75$1_NAME32 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,32)
76$1_TARGET32 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME32).java
77$1_NAME64 := $(call GENSRC_AWT_ICONS_DST_NAME,$1,64)
78$1_TARGET64 := $(GENSRC_AWT_ICONS_DST)/$$($1_NAME64).java
79
80$$($1_TARGET32): $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir $(BUILD_TOOLS_JDK)
81$(RM) $$@ $$@.tmp
82$(ECHO) "package sun.awt;" > $$@.tmp
83$(ECHO) "public class $$($1_NAME32) {" >> $$@.tmp
84$(ECHO) "public static int[] $$($1_SHORTNAME) = { " >> $$@.tmp
85$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
86$(ECHO) "}; }" >> $$@.tmp
87$(MV) $$@.tmp $$@
88
89GENSRC_AWT_ICONS += $$($1_TARGET32)
90
91$$($1_TARGET64): $2/$1 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir $(BUILD_TOOLS_JDK)
92$(RM) $$@ $$@.tmp
93$(ECHO) "package sun.awt;" > $$@.tmp
94$(ECHO) "public class $$($1_NAME64) {" >> $$@.tmp
95$(ECHO) "public static long[] $$($1_SHORTNAME) = { " >> $$@.tmp
96$(CAT) $$< | $(TOOL_AWT_TOBIN) >> $$@.tmp
97$(ECHO) "}; }" >> $$@.tmp
98$(MV) $$@.tmp $$@
99
100GENSRC_AWT_ICONS += $$($1_TARGET64)
101endef
102
103$(foreach I, $(GENSRC_AWT_ICONS_SRC), $(eval $(call SetupGensrcAWTIcon,$(notdir $(I)),$(dir $(I)))))
104
105TARGETS += $(GENSRC_AWT_ICONS)
106
107################################################################################
108
109ifeq ($(call isTargetOs, macosx), true)
110
111GENSRC_OSX_ICONS_DST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop
112GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h
113
114GENSRC_OSX_ICONS_SRC ?= $(MODULE_SRC)/macosx/data/macosxicons/JavaApp.icns
115
116
117$(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
118$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
119$(call MakeDir, $(@D))
120$(RM) $@ $@.tmp
121$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
122$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
123$(ECHO) "};" >> $@.tmp
124$(MV) $@.tmp $@
125
126TARGETS += $(GENSRC_OSX_ICONS)
127endif
128