make/UpdateX11Wrappers.gmk
author zgu
Fri, 15 Nov 2019 15:33:34 -0500
changeset 59113 700a2ad8fc19
parent 53995 ecc2bcc3beb0
child 58665 30a5049a36bb
child 58834 f78e7ce060b0
permissions -rw-r--r--
8204128: NMT might report incorrect numbers for Compiler area Reviewed-by: stuefe, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     1
#
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
     2
# Copyright (c) 2012, 2019, 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
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    26
################################################################################
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    27
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    28
default: all
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    29
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    30
include $(SPEC)
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    31
include MakeBase.gmk
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    32
include Execute.gmk
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    33
include NativeCompilation.gmk
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    34
include ToolsJdk.gmk
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    35
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    36
################################################################################
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    37
# 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
    38
# 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
    39
# will host the final jvm, thus the tool cannot be used when cross compiling.
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    40
#
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    41
# Two versions of the generated offset file, sizes-32.txt and sizes-64.txt are
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    42
# committed into the source code repository. These are the ones used in
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    43
# GensrcX11Wrappers.gmk to generate the Java code during the build.
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    44
################################################################################
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    45
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    46
ifeq ($(COMPILE_TYPE), cross)
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    47
  $(error It is not possible to update the x11wrappers when cross-compiling)
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13164
diff changeset
    48
endif
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    49
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    50
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    51
GENERATOR_SOURCE_FILE := $(X11WRAPPERS_OUTPUT)/src/data_generator.c
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    52
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    53
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    54
WRAPPER_OUTPUT_FILE := $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    55
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    56
BITS := $(OPENJDK_TARGET_CPU_BITS)
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    57
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    58
# Generate the C code for the program that will output the offset file.
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    59
$(eval $(call SetupExecute, gensrc_generator, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    60
    INFO := Generating X11 wrapper data generator source code, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    61
    DEPS := $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    62
    OUTPUT_FILE := $(GENERATOR_SOURCE_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    63
    COMMAND := $(TOOL_WRAPPERGENERATOR) gen_c_source $(GENERATOR_SOURCE_FILE) \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    64
        $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    65
))
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    66
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    67
DATA_GENERATOR_INCLUDES := \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    68
    -I$(TOPDIR)/src/hotspot/share/include \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    69
    -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    70
    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    71
    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    72
    -I$(TOPDIR)/src/java.base/share/native/libjava \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    73
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    74
    -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    75
    -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    76
    -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    77
    #
17046
72254abdba83 8013480: fix zero build on arm
omajid
parents: 15149
diff changeset
    78
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    79
# Compile the generated C code into an executable.
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    80
$(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    81
    PROGRAM := data_generator, \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    82
    OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    83
    EXTRA_FILES := $(GENERATOR_SOURCE_FILE), \
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    84
    CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES) $(CFLAGS_JDKEXE), \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    85
    LDFLAGS := $(LDFLAGS_JDKEXE), \
49241
de4b3a04feae 8199606: Set -lc as global LIBS on solstudio
ihse
parents: 49133
diff changeset
    86
    LIBS := $(X_LIBS), \
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    87
    OBJECT_DIR := $(X11WRAPPERS_OUTPUT)/objs, \
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    88
))
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
    89
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    90
# Run the executable to create the data file.
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    91
$(eval $(call SetupExecute, run_wrappergen, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    92
    INFO := Generating X11 wrapper data files, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    93
    DEPS := $(BUILD_DATA_GENERATOR), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    94
    OUTPUT_FILE := $(WRAPPER_OUTPUT_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    95
    COMMAND := $(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $(WRAPPER_OUTPUT_FILE), \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    96
))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    97
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
    98
wrapper-information: $(run_wrappergen)
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
    99
	$(ECHO) IMPORTANT: If you update the X11 wrapper data files, they most certainly
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   100
	$(ECHO) need to be updated for both 32 and 64 bit platforms. You have now
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   101
	$(ECHO) updated them for $(BITS) bit platforms only.
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
   102
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents: 49241
diff changeset
   103
TARGETS += $(run_wrappergen) wrapper-information
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   104
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   105
################################################################################
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
   106
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   107
all: $(TARGETS)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
   108
49133
a5b237cfccef 8198844: Clean up GensrcX11Wrappers
ihse
parents: 48355
diff changeset
   109
.PHONY: all default