aboutsummaryrefslogtreecommitdiff
path: root/make/sun/xawt/Makefile
blob: 394e9cc8baab5362188c6f2cb5560b917a1283a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#
# Copyright 2002-2008 Sun Microsystems, Inc.  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.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

BUILDDIR = ../..
MODULE  = awt
PACKAGE = sun.awt.X11
LIBRARY = mawt
LIBRARY_OUTPUT = xawt
LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/xawt
PRODUCT = sun

include $(BUILDDIR)/common/Defs.gmk

GEN_DIR=$(GENSRCDIR)/sun/awt/X11

CLASSES_INIT += $(TEMPDIR)/.gen.wrappers $(TEMPDIR)/.gen_icons touch.wrappers

.PHONY: generated.clean

#
# Files
#
include FILES_c_unix.gmk
include FILES_export_unix.gmk
AUTO_FILES_JAVA_DIRS = sun/awt/X11
AUTO_JAVA_PRUNE = WrapperGenerator.java

LDFLAGS += -L$(OPENWIN_LIB)

# For Xrender extension.
ifeq ($(PLATFORM), solaris)
LDFLAGS += -L/usr/openwin/sfw/lib$(ISA_DIR) -R/usr/openwin/sfw/lib$(ISA_DIR)
endif

ifeq ($(PLATFORM), linux)
LDFLAGS += -lpthread
dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
endif

# Since this library will be living in a subdirectory below the other libraries
#   we need to add an extra runpath so that libraries in the upper directory
#   are found at runtime.
LD_RUNPATH_EXTRAS = ..

#
# Rules.
#
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk

#
# Add to the ambient vpath to pick up files in subdirectories
#
vpath %.c   $(SHARE_SRC)/native/sunawt/alphacomposite
vpath %.c   $(PLATFORM_SRC)/native/sun/xawt
vpath %.c   $(PLATFORM_SRC)/native/sun/awt
vpath %.c   $(SHARE_SRC)/native/sun/awt/debug
vpath %.c   $(SHARE_SRC)/native/sun/awt/image
vpath %.c   $(SHARE_SRC)/native/sun/awt/image/gif
vpath %.c   $(SHARE_SRC)/native/sun/awt/image/cvutils
vpath %.c   $(SHARE_SRC)/native/sun/awt/shell
vpath %.c   $(SHARE_SRC)/native/sun/java2d
vpath %.c   $(SHARE_SRC)/native/sun/java2d/loops
vpath %.c   $(SHARE_SRC)/native/sun/java2d/pipe
vpath %.c   $(SHARE_SRC)/native/sun/awt/medialib
vpath %.c   $(SHARE_SRC)/native/sun/awt/utility
vpath %.cpp $(SHARE_SRC)/native/sun/image
vpath %.c   $(SHARE_SRC)/native/sun/font
vpath %.c   $(PLATFORM_SRC)/native/sun/awt/robot_child
vpath %.c   $(SHARE_SRC)/native/sun/java2d/opengl
vpath %.c   $(PLATFORM_SRC)/native/sun/java2d/opengl
vpath %.c   $(PLATFORM_SRC)/native/sun/java2d/x11

OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender -ldl \
                   $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi

ifeq  ($(PLATFORM), solaris)
CPPFLAGS += -DFUNCPROTO=15
dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
endif

CPPFLAGS += -I$(CUPS_HEADERS_PATH)

CPPFLAGS += -DXAWT -DXAWT_HACK \
        -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders \
        -I$(PLATFORM_SRC)/native/sun/awt \
	-I$(PLATFORM_SRC)/native/sun/xawt \
        -I$(PLATFORM_SRC)/native/sun/jdga \
        -I$(SHARE_SRC)/native/sun/awt/debug \
        -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
        -I$(SHARE_SRC)/native/sun/java2d \
	-I$(SHARE_SRC)/native/sun/java2d/loops \
	-I$(SHARE_SRC)/native/sun/awt/image/cvutils \
	-I$(SHARE_SRC)/native/sun/awt/image \
	-I$(SHARE_SRC)/native/sun/font \
	-I$(PLATFORM_SRC)/native/sun/java2d \
	-I$(SHARE_SRC)/native/sun/java2d/pipe \
	-I$(SHARE_SRC)/native/sun/java2d/opengl \
	-I$(PLATFORM_SRC)/native/sun/java2d/opengl \
	-I$(PLATFORM_SRC)/native/sun/java2d/x11 \
	-I$(SHARE_SRC)/native/sun/dc/path \
	-I$(SHARE_SRC)/native/sun/dc/doe \
	-I$(SHARE_SRC)/native/sun/awt/alphacomposite \
        -I$(SHARE_SRC)/native/sun/awt/medialib \
	-I$(PLATFORM_SRC)/native/sun/awt/medialib \
        -I$(PLATFORM_SRC)/native/sun/font \
        -I$(SHARE_SRC)/native/sun/awt \
        -I$(PLATFORM_SRC)/native/sun/awt

ifeq ($(PLATFORM), linux)
# Allows for builds on Debian GNU Linux, X11 is in a different place 
  CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
              -I/usr/include/X11/extensions \
              -I$(OPENWIN_HOME)/include 
endif

ifeq ($(PLATFORM), solaris)
  CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
endif

ifeq ($(MILESTONE), internal)
  CPPFLAGS += -DINTERNAL_BUILD
endif

#
# Generation of wrappers
#
SIZER_DIR=$(GEN_DIR)/generator
SIZER = $(SIZER_DIR)/sizer
SIZER_32_C = $(SIZER).32.c
SIZER_64_C = $(SIZER).64.c
CFLAGS_32=$(CFLAGS)
CFLAGS_64=$(CFLAGS)

ifeq ($(PLATFORM), solaris)

isalist:=$(shell $(ISAINFO))

ifneq (,$(findstring sparcv9, $(isalist)))
# On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
# On sparcv9 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option.
CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS))
SIZERS = $(SIZER).32 $(SIZER).64
SIZERS_C = $(SIZER_32_C) $(SIZER_64_C)
SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64
CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64)
else
ifneq (,$(findstring amd64, $(isalist)))
# On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
# On amd64 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option.
CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS))
SIZERS = $(SIZER).32 $(SIZER).64
SIZERS_C = $(SIZER_32_C) $(SIZER_64_C)
SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64
CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64)
else # !sparcv9 : includes (32-bit) sparc, i586
SIZERS = $(SIZER).32
SIZERS_C = $(SIZER_32_C)
SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32
endif # amd64
endif # sparcv9

else # !solaris

ifeq ($(ARCH_DATA_MODEL), 32)
SIZERS = $(SIZER).32
SIZERS_C = $(SIZER_32_C)
SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32
else # !32
SIZERS = $(SIZER).64
SIZERS_C = $(SIZER_64_C)
SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.64
endif # 32

endif # solaris

# XXX Hack for 6185483 - use hard-coded sizes.
# Add the 64-bit platforms that need to be included into 32-bit build
# and have sizes.64-$(PLATFORM)-$(LIBARCH) hardcoded in the workspace
ifeq ($(PLATFORM)-$(LIBARCH), solaris-i386)
# If you define DOHACK=true for some combination of $(PLATFORM)-$(LIBARCH),
# make sure you have sizes.64-$(PLATFORM)-$(LIBARCH) pre-generated in
# $(PLATFORM_SRC)/classes/sun/awt/X11/generator/
DOHACK=true
endif # Hack

ifeq ($(DOHACK), true)
PREDEFINED_SIZES_TMPL=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-$(PLATFORM)-$(LIBARCH)
PREDEFINED_SIZES=$(WRAPPER_GENERATOR_DIR)/sizes.64
SIZES += $(WRAPPER_GENERATOR_DIR)/sizes.64
endif

ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
DOCOMPARE=true
endif
# 64 bit sizers are generated on platform-libarch (left) for use 
# on platform-libarch (right) and stored under the latter name.
# Do compare manually stored and automatically generated pair(s) 
# if DOCOMPARE=true, just after the generation.
STORED_SIZES_TMPL_solaris_amd64=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-solaris-i386

WRAPPER_GENERATOR_JAVA=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/WrapperGenerator.java
WRAPPER_GENERATOR_DIR=$(GENSRCDIR)/sun/awt/X11/generator
WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator
WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class 
XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt

$(SIZERS): $(SIZERS_C) 
	$(prep-target)
	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c

$(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
	$(prep-target)
	$(BOOT_JAVAC_CMD) -d $(WRAPPER_GENERATOR_TEMPDIR) $(WRAPPER_GENERATOR_JAVA)

$(SIZERS_C): $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
	$(prep-target)
	$(MKDIR) -p $(WRAPPER_GENERATOR_TEMPDIR)
	$(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \
	    $(SIZER_DIR) $(XLIBTYPES) "sizer" $(subst .,,$(suffix $(basename $@)))

$(SIZES): $(SIZERS)
	@if [ "$(DOHACK)$@" = "true$(PREDEFINED_SIZES)" ]; then \
	    $(ECHO) COPYING $(PREDEFINED_SIZES_TMPL) into $@; \
	    $(CP) $(PREDEFINED_SIZES_TMPL) $@; \
	    $(CHMOD) +w $@;\
	else	\
	    $(ECHO) GENERATING $@; \
	    $(WRAPPER_GENERATOR_DIR)/sizer$(suffix $@) > $@; \
	fi
	@if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \
	    $(ECHO) COMPARING $@ and $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
	    $(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
	fi

$(TEMPDIR)/.gen.wrappers: $(SIZES) $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
	$(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \
	    $(GEN_DIR) $(XLIBTYPES) "gen" $(WRAPPER_GENERATOR_DIR)/sizes

touch.wrappers: $(TEMPDIR)/.gen.wrappers
	$(MKDIR) -p $(TEMPDIR)
	$(TOUCH) $(TEMPDIR)/.gen.wrappers

generated.clean:
	$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
	$(RM) -r $(WRAPPER_GENERATOR_DIR)
	$(RM) -r $(GEN_DIR)/*.java
	$(RM) -r $(TEMPDIR)/.gen_icons

ifdef OPENJDK
    ICONS_PATH_PREFIX=$(PLATFORM_SRC)
else
    ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris
endif

ICONS = \
    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
    $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png


ICONPATH=$(PLATFORM_SRC)/classes/sun/awt/X11

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

TEMPDIR_CLASSES = $(TEMPDIR)/classes

$(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class: ToBin.java
	@$(prep-target)
	$(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $<

$(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class $(ICONS)
	$(prep-target)
	for i in $(ICONS); do \
            filename=`basename $$i`; \
	    name=`$(ECHO) $$filename | $(TR) '\-.' '__'`;  \
            classname=$(GEN_DIR)/XAWTIcon32_$$name.java; \
	    $(RM) $$classname; \
	    $(ECHO) "package sun.awt.X11;" >> $$classname ; \
	    $(ECHO) "public class XAWTIcon32_$$name {" >> $$classname; \
	    $(ECHO) "public static int[] $$name = { " >> $$classname;  \
	    $(CAT) $$i | \
	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
		-Djava.awt.headless=true \
		sun.awt.X11.ToBin >> $$classname; \
	    $(ECHO) "}; }" >> $$classname;  \
            classname=$(GEN_DIR)/XAWTIcon64_$$name.java; \
	    $(RM) $$classname; \
	    $(ECHO) "package sun.awt.X11;" >> $$classname ; \
	    $(ECHO) "public class XAWTIcon64_$$name {" >> $$classname; \
	    $(ECHO) "public static long[] $$name = { " >> $$classname;  \
	    $(CAT) $$i | \
	      $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
		-Djava.awt.headless=true \
		sun.awt.X11.ToBin >> $$classname; \
	    $(ECHO) "}; }" >> $$classname;  \
	done
	$(TOUCH) $@

clean clobber:: generated.clean

.PHONY: generated.clean robot_child