make/UpdateX11Wrappers.gmk
author ihse
Sat, 03 Mar 2018 09:14:01 +0100
branchihse-cflags-rewrite-branch
changeset 56236 97746cb303aa
parent 56212 d1a4766aa7ac
child 56312 a52bcf4118eb
permissions -rw-r--r--
Do not always disable doubunder.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
     1
#
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
     2
# Copyright (c) 2012, 2018, 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
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    26
################################################################################
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    27
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    28
default: all
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    29
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    30
include $(SPEC)
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    31
include MakeBase.gmk
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    32
include NativeCompilation.gmk
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    33
include ToolsJdk.gmk
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    34
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    35
################################################################################
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    36
# 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
    37
# 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
    38
# will host the final jvm, thus the tool cannot be used when cross compiling.
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    39
#
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    40
# Two versions of the generated offset file, sizes-32.txt and sizes-64.txt are
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    41
# committed into the source code repository. These are the ones used in
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    42
# GensrcX11Wrappers.gmk to generate the Java code during the build.
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    43
################################################################################
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    44
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    45
ifeq ($(COMPILE_TYPE), cross)
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    46
  $(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
    47
endif
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    48
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    49
X11WRAPPERS_OUTPUT := $(SUPPORT_OUTPUTDIR)/x11wrappers
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    50
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    51
GENSRC_X11WRAPPERS_DATADIR := $(TOPDIR)/make/data/x11wrappergen
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    52
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    53
BITS := $(OPENJDK_TARGET_CPU_BITS)
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    54
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    55
# Generate the C code for the program that will output the offset file.
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    56
$(X11WRAPPERS_OUTPUT)/src/data_generator.c: $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    57
	$(call LogInfo, Generating X11 wrapper data generator source code)
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    58
	$(call MakeDir, $(@D))
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    59
	$(TOOL_WRAPPERGENERATOR) gen_c_source $@ $(GENSRC_X11WRAPPERS_DATADIR)/xlibtypes.txt $(BITS)
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    60
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    61
DATA_GENERATOR_INCLUDES := \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    62
    -I$(TOPDIR)/src/hotspot/share/include \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    63
    -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    64
    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    65
    -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    66
    -I$(TOPDIR)/src/java.base/share/native/libjava \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    67
    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    68
    -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    69
    -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    70
    -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    71
    #
17046
72254abdba83 8013480: fix zero build on arm
omajid
parents: 15149
diff changeset
    72
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    73
# Compile the generated C code into an executable.
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    74
$(eval $(call SetupNativeCompilation, BUILD_DATA_GENERATOR, \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    75
    PROGRAM := data_generator, \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    76
    OUTPUT_DIR := $(X11WRAPPERS_OUTPUT)/bin, \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    77
    EXTRA_FILES := $(X11WRAPPERS_OUTPUT)/src/data_generator.c, \
56212
d1a4766aa7ac Use proper flags for compilation.
ihse
parents: 56211
diff changeset
    78
    CFLAGS := $(X_CFLAGS) $(DATA_GENERATOR_INCLUDES) $(CFLAGS_JDKEXE), \
d1a4766aa7ac Use proper flags for compilation.
ihse
parents: 56211
diff changeset
    79
    LDFLAGS := $(LDFLAGS_JDKEXE), \
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    80
    LIBS := $(X_LIBS) -lc, \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    81
    OBJECT_DIR := $(X11WRAPPERS_OUTPUT)/objs, \
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    82
))
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
    83
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    84
# Run the executable to create the data file.
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    85
$(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt: $(BUILD_DATA_GENERATOR_TARGET)
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    86
	$(call LogInfo, Generating X11 wrapper data files)
35241
075bbb8f2423 8146403: Windows build can be faster
erikj
parents: 27799
diff changeset
    87
	$(call MakeDir, $(@D))
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    88
	$(BUILD_DATA_GENERATOR_TARGET) | $(SORT) > $@
15149
64054e252871 8004151: build-infra: Generating X11 wrapper offset file is not cross compilable
erikj
parents: 15126
diff changeset
    89
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    90
TARGETS += $(GENSRC_X11WRAPPERS_DATADIR)/sizes-$(BITS).txt
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    91
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    92
################################################################################
12892
3ef14bab6254 7170079: Adjustments to build-infra makefiles
erikj
parents:
diff changeset
    93
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    94
all: $(TARGETS)
25859
3317bb8137f4 8054834: Modular Source Code
chegar
parents: 23010
diff changeset
    95
56211
657780f239c4 Fix X11Wrappers.
ihse
parents: 48355
diff changeset
    96
.PHONY: all default