2012-06-08 03:40:50 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 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.
|
|
|
|
#
|
|
|
|
|
2012-09-18 18:29:24 +00:00
|
|
|
# This file is responsible for extracting the x11 native struct offsets to
|
2013-01-22 08:01:35 +00:00
|
|
|
# the xawt Java library. The tool needs to be run on the os/arch that
|
|
|
|
# will host the final jvm, thus the tool cannot be used when cross compiling.
|
|
|
|
|
|
|
|
# To enable cross compiling, the two versions of the generated offset file,
|
|
|
|
# sizes.32 and sizes.64 are committed into the source code repository.
|
|
|
|
# These are the ones used.
|
2012-09-18 18:29:24 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
# However when not cross compiling, the offset generator tool is built and
|
|
|
|
# run, to verify that it still generates the same sizes.32 and sizes.64.
|
2012-09-18 18:29:24 +00:00
|
|
|
|
2012-06-08 03:40:50 +00:00
|
|
|
GENSRC_X11WRAPPERS :=
|
2013-01-22 08:01:35 +00:00
|
|
|
# Put temporary c-code and executable to calculate offsets here.
|
|
|
|
# Also put verification offset file here as well.
|
2012-06-08 03:40:50 +00:00
|
|
|
GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
|
2013-01-22 08:01:35 +00:00
|
|
|
# Put the generated Java classes used to interface X11 from awt here.
|
|
|
|
GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
# The pre-calculated offset file are stored here:
|
|
|
|
GENSRC_SIZER_DIR := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
# Normal case is to generate only according to target bits
|
|
|
|
GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)
|
2012-09-18 18:29:24 +00:00
|
|
|
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
|
2013-01-22 08:01:35 +00:00
|
|
|
ifneq ($(OPENJDK_TARGET_OS), linux)
|
|
|
|
# On all 64-bit systems except Linux, generate both 32 and 64 bit versions
|
|
|
|
GENSRC_X11_VERSION := 32 64
|
|
|
|
endif
|
2012-06-08 03:40:50 +00:00
|
|
|
else
|
2013-01-22 08:01:35 +00:00
|
|
|
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
|
|
|
# As a special case, solaris 32-bit also generates the 64-bit version
|
|
|
|
GENSRC_X11_VERSION := 32 64
|
|
|
|
endif
|
2012-09-18 18:29:24 +00:00
|
|
|
endif
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes.,$(GENSRC_X11_VERSION))
|
|
|
|
|
|
|
|
# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
|
|
|
|
# file prefix it is given so those not needed need to be hidden.
|
|
|
|
$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
|
|
|
|
$(MKDIR) -p $(@D)
|
|
|
|
$(RM) '$@'
|
|
|
|
$(SORT) $< > $@
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
# Run the tool on the offset files copied from the source repository to generate several Java classes
|
|
|
|
# used in awt.
|
|
|
|
$(JDK_OUTPUTDIR)/gensrc/_the.generated.x11 : $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS)
|
|
|
|
$(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
|
|
|
|
$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
|
|
|
|
$(TOUCH) $@
|
|
|
|
|
|
|
|
GENSRC_X11WRAPPERS += $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11
|
|
|
|
|
|
|
|
ifneq ($(COMPILE_TYPE),cross)
|
|
|
|
# This is not a cross compile, regenerate the offset file, so that we
|
|
|
|
# can compare it with the version in the source code repository.
|
|
|
|
|
|
|
|
# Generate the C code for the program that will output the offset file.
|
|
|
|
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.c : $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS)
|
2012-10-26 21:23:29 +00:00
|
|
|
$(ECHO) "Generating X11 wrapper ($*-bit version)"
|
2012-06-08 03:40:50 +00:00
|
|
|
$(MKDIR) -p $(@D)
|
2013-01-22 08:01:35 +00:00
|
|
|
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
# Compile the C code into an executable.
|
|
|
|
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
|
2012-09-18 18:29:24 +00:00
|
|
|
$(MKDIR) -p $(@D)
|
2013-01-22 08:01:35 +00:00
|
|
|
(cd $(@D) && $(CC) -m$* -o $@ $< \
|
2012-10-29 20:41:38 +00:00
|
|
|
$(X_CFLAGS) \
|
|
|
|
$(X_LIBS) \
|
2012-07-03 23:10:44 +00:00
|
|
|
-I$(JDK_OUTPUTDIR)/include \
|
|
|
|
-I$(JDK_TOPDIR)/src/share/javavm/export \
|
2012-09-18 18:29:24 +00:00
|
|
|
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
|
2013-01-22 08:01:35 +00:00
|
|
|
-I$(JDK_TOPDIR)/src/share/native/common \
|
2012-09-18 18:29:24 +00:00
|
|
|
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
|
2012-06-08 03:40:50 +00:00
|
|
|
-I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
|
|
|
|
-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
|
|
|
|
-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
|
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
.PRECIOUS: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
|
|
|
|
|
|
|
|
# Run the executable create the offset file and check that it is identical
|
|
|
|
# to the offset file in the source code repository.
|
|
|
|
$(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
|
2012-09-18 18:29:24 +00:00
|
|
|
$(MKDIR) -p $(@D)
|
2013-01-22 08:01:35 +00:00
|
|
|
$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
|
|
|
|
$(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
|
|
|
|
$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
|
|
|
|
mv $@.tmp $@
|
2012-06-08 03:40:50 +00:00
|
|
|
|
2013-01-22 08:01:35 +00:00
|
|
|
GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/sizes.$(OPENJDK_TARGET_CPU_BITS).verification
|
2012-06-08 03:40:50 +00:00
|
|
|
endif
|
|
|
|
|