make/gensrc/GensrcX11Wrappers.gmk
author ihse
Mon, 04 Dec 2017 23:55:52 +0100
changeset 48300 8a5edac3d5a2
parent 47217 72e3ae9a25eb
child 48355 4944950606ef
permissions -rw-r--r--
8190484: Move jvm.h, jmm.h et al to hotspot/*/include Reviewed-by: dholmes, erikj, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     1
#
48300
8a5edac3d5a2 8190484: Move jvm.h, jmm.h et al to hotspot/*/include
ihse
parents: 47217
diff changeset
     2
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     4
#
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    10
#
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    15
# accompanied this code).
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    16
#
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    20
#
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    23
# questions.
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    24
#
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    25
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    26
# This file is responsible for extracting the x11 native struct offsets to
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    27
# the xawt Java library. The tool needs to be run on the os/arch that
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    28
# will host the final jvm, thus the tool cannot be used when cross compiling.
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    29
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    30
# To enable cross compiling, the two versions of the generated offset file,
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    31
# sizes.32 and sizes.64 are committed into the source code repository.
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    32
# These are the ones used.
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    33
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    34
# However when not cross compiling, the offset generator tool is built and
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    35
# run, to verify that it still generates the same sizes.32 and sizes.64.
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    36
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    37
GENSRC_X11WRAPPERS :=
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    38
# Put temporary c-code and executable to calculate offsets here.
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    39
# Also put verification offset file here as well.
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26751
diff changeset
    40
GENSRC_X11WRAPPERS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_x11wrappers
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    41
# Put the generated Java classes used to interface X11 from awt here.
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26751
diff changeset
    42
GENSRC_X11WRAPPERS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    43
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    44
# The pre-calculated offset file are stored here:
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    45
GENSRC_SIZER_DIR := $(TOPDIR)/make/data/x11wrappergen
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    46
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    47
# Normal case is to generate only according to target bits
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    48
GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    49
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    50
  ifneq ($(OPENJDK_TARGET_OS), linux)
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    51
    # On all 64-bit systems except Linux, generate both 32 and 64 bit versions
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    52
    GENSRC_X11_VERSION := 32 64
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    53
  endif
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    54
else
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    55
  ifeq ($(OPENJDK_TARGET_OS), solaris)
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    56
    # As a special case, solaris 32-bit also generates the 64-bit version
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    57
    GENSRC_X11_VERSION := 32 64
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    58
  endif
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    59
endif
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    60
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    61
GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes., $(GENSRC_X11_VERSION))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    62
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    63
# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    64
# file prefix it is given so those not needed need to be hidden.
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    65
$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    66
	$(call MakeDir, $(@D))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    67
	$(RM) '$@'
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    68
	$(SORT) $< > $@
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    69
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    70
# Run the tool on the offset files copied from the source repository to generate several Java classes
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    71
# used in awt.
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26751
diff changeset
    72
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    73
	$(call MakeDir, $(GENSRC_X11WRAPPERS_DST))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    74
	$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    75
	$(TOUCH) $@
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    76
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26751
diff changeset
    77
GENSRC_X11WRAPPERS += $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    78
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    79
ifneq ($(COMPILE_TYPE), cross)
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    80
  # This is not a cross compile, regenerate the offset file, so that we
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    81
  # can compare it with the version in the source code repository.
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    82
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    83
  # Generate the C code for the program that will output the offset file.
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
    84
  $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c: $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    85
	$(call LogInfo, Generating X11 wrapper ($*-bit version))
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    86
	$(call MakeDir, $(@D))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    87
	$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    88
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    89
  # use -m32/-m64 only if the compiler supports it
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    90
  ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG), true)
22593
938340719ac2 8024900: PPC64: Enable new build on AIX (jdk part)
simonis
parents: 17046
diff changeset
    91
    MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
    92
  endif
17046
72254abdba83 8013480: fix zero build on arm
omajid
parents: 15149
diff changeset
    93
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 26751
diff changeset
    94
  SIZER_CFLAGS := \
48300
8a5edac3d5a2 8190484: Move jvm.h, jmm.h et al to hotspot/*/include
ihse
parents: 47217
diff changeset
    95
      -I${TOPDIR}/src/hotspot/share/include \
8a5edac3d5a2 8190484: Move jvm.h, jmm.h et al to hotspot/*/include
ihse
parents: 47217
diff changeset
    96
      -I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    97
      -I$(TOPDIR)/src/java.base/share/native/include \
48300
8a5edac3d5a2 8190484: Move jvm.h, jmm.h et al to hotspot/*/include
ihse
parents: 47217
diff changeset
    98
      -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    99
      -I$(TOPDIR)/src/java.base/share/native/libjava \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   100
      -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   101
      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   102
      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
   103
      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   104
      #
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   105
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   106
  # Compile the C code into an executable.
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   107
  $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
   108
	$(call MakeDir, $(@D))
17046
72254abdba83 8013480: fix zero build on arm
omajid
parents: 15149
diff changeset
   109
	(cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   110
	    $(X_CFLAGS) \
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   111
	    $(X_LIBS) \
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   112
	    $(SIZER_CFLAGS) -lc)
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
   113
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   114
  .PRECIOUS: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
   115
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   116
  # Run the executable create the offset file and check that it is identical
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   117
  # to the offset file in the source code repository.
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   118
  $(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
   119
	$(call LogInfo, Verifying X11 wrapper sizes)
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
   120
	$(call MakeDir, $(@D))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
   121
	$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
   122
	$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
   123
	mv $@.tmp $@
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
   124
20547
453837141fac 8001931: The new build system whitespace cleanup
ihse
parents: 17046
diff changeset
   125
  GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/sizes.$(OPENJDK_TARGET_CPU_BITS).verification
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
   126
endif
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   127
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   128
GENSRC_JAVA_DESKTOP += $(GENSRC_X11WRAPPERS)