annotate makefiles/GensrcX11Wrappers.gmk @ 9185:3ac08cd5e2e8

8024900: PPC64: Enable new build on AIX (jdk part) Reviewed-by: erikj
author simonis
date Tue, 17 Sep 2013 14:48:14 +0200
parents 12af7c32c648
children
rev   line source
erikj@5507 1 #
erikj@5507 2 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
erikj@5507 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@5507 4 #
erikj@5507 5 # This code is free software; you can redistribute it and/or modify it
erikj@5507 6 # under the terms of the GNU General Public License version 2 only, as
erikj@5507 7 # published by the Free Software Foundation. Oracle designates this
erikj@5507 8 # particular file as subject to the "Classpath" exception as provided
erikj@5507 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@5507 10 #
erikj@5507 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@5507 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@5507 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@5507 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@5507 15 # accompanied this code).
erikj@5507 16 #
erikj@5507 17 # You should have received a copy of the GNU General Public License version
erikj@5507 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@5507 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@5507 20 #
erikj@5507 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@5507 22 # or visit www.oracle.com if you need additional information or have any
erikj@5507 23 # questions.
erikj@5507 24 #
erikj@5507 25
erikj@6377 26 # This file is responsible for extracting the x11 native struct offsets to
erikj@6377 27 # the xawt Java library. The tool needs to be run on the os/arch that
erikj@6377 28 # will host the final jvm, thus the tool cannot be used when cross compiling.
ohair@5819 29
erikj@6377 30 # To enable cross compiling, the two versions of the generated offset file,
erikj@6377 31 # sizes.32 and sizes.64 are committed into the source code repository.
erikj@6377 32 # These are the ones used.
ohair@5819 33
erikj@6377 34 # However when not cross compiling, the offset generator tool is built and
erikj@6377 35 # run, to verify that it still generates the same sizes.32 and sizes.64.
ohair@5819 36
erikj@5507 37 GENSRC_X11WRAPPERS :=
erikj@6377 38 # Put temporary c-code and executable to calculate offsets here.
erikj@6377 39 # Also put verification offset file here as well.
erikj@5507 40 GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
erikj@6377 41 # Put the generated Java classes used to interface X11 from awt here.
erikj@6377 42 GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11
erikj@5507 43
erikj@6377 44 # The pre-calculated offset file are stored here:
erikj@6377 45 GENSRC_SIZER_DIR := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
erikj@5507 46
erikj@6377 47 # Normal case is to generate only according to target bits
erikj@6377 48 GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)
ohair@5819 49 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
erikj@6377 50 ifneq ($(OPENJDK_TARGET_OS), linux)
erikj@6377 51 # On all 64-bit systems except Linux, generate both 32 and 64 bit versions
erikj@6377 52 GENSRC_X11_VERSION := 32 64
erikj@6377 53 endif
ohair@5819 54 else
erikj@6377 55 ifeq ($(OPENJDK_TARGET_OS), solaris)
erikj@6377 56 # As a special case, solaris 32-bit also generates the 64-bit version
erikj@6377 57 GENSRC_X11_VERSION := 32 64
erikj@6377 58 endif
ohair@5819 59 endif
erikj@5507 60
erikj@6377 61 GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes.,$(GENSRC_X11_VERSION))
erikj@5507 62
erikj@6377 63 # Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
erikj@6377 64 # file prefix it is given so those not needed need to be hidden.
erikj@6377 65 $(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
erikj@6377 66 $(MKDIR) -p $(@D)
erikj@6377 67 $(RM) '$@'
erikj@6377 68 $(SORT) $< > $@
erikj@6377 69
erikj@6377 70 # Run the tool on the offset files copied from the source repository to generate several Java classes
erikj@6377 71 # used in awt.
erikj@6377 72 $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11 : $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS)
erikj@6377 73 $(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
erikj@6377 74 $(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
erikj@6377 75 $(TOUCH) $@
erikj@6377 76
erikj@6377 77 GENSRC_X11WRAPPERS += $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11
erikj@6377 78
erikj@6377 79 ifneq ($(COMPILE_TYPE),cross)
erikj@6377 80 # This is not a cross compile, regenerate the offset file, so that we
erikj@6377 81 # can compare it with the version in the source code repository.
erikj@6377 82
erikj@6377 83 # Generate the C code for the program that will output the offset file.
erikj@6377 84 $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c : $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS)
ohair@6025 85 $(ECHO) "Generating X11 wrapper ($*-bit version)"
erikj@5507 86 $(MKDIR) -p $(@D)
erikj@6377 87 $(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
erikj@5507 88
omajid@6982 89 # use -m32/-m64 only if the compiler supports it
omajid@6982 90 ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG),true)
simonis@9185 91 MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
omajid@6982 92 endif
omajid@6982 93
erikj@6377 94 # Compile the C code into an executable.
erikj@6377 95 $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
ohair@5819 96 $(MKDIR) -p $(@D)
omajid@6982 97 (cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
ohrstrom@6027 98 $(X_CFLAGS) \
ohrstrom@6027 99 $(X_LIBS) \
erikj@5596 100 -I$(JDK_OUTPUTDIR)/include \
erikj@5596 101 -I$(JDK_TOPDIR)/src/share/javavm/export \
ohair@5819 102 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
erikj@6377 103 -I$(JDK_TOPDIR)/src/share/native/common \
ohair@5819 104 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
erikj@5507 105 -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
erikj@5507 106 -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
erikj@5507 107 -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
erikj@5507 108
erikj@6377 109 .PRECIOUS: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
erikj@6377 110
erikj@6377 111 # Run the executable create the offset file and check that it is identical
erikj@6377 112 # to the offset file in the source code repository.
erikj@6377 113 $(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
ohair@5819 114 $(MKDIR) -p $(@D)
erikj@6377 115 $(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
erikj@6377 116 $(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
erikj@6377 117 $(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
erikj@6377 118 mv $@.tmp $@
erikj@5507 119
erikj@6377 120 GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/sizes.$(OPENJDK_TARGET_CPU_BITS).verification
erikj@5507 121 endif
erikj@5507 122