author | michaelm |
Wed, 30 Oct 2019 11:53:07 +0000 | |
branch | unixdomainchannels |
changeset 58856 | b2f0339a4cad |
parent 54148 | 62e4ada7c4c8 |
permissions | -rw-r--r-- |
18021 | 1 |
# |
48839 | 2 |
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
18021 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
48839 | 26 |
################################################################################ |
18021 | 27 |
# |
20363 | 28 |
# This Makefile, together with Tools.gmk, can be used to compile a set of |
29 |
# gcc based cross compilation, portable, self contained packages, capable |
|
18021 | 30 |
# of building OpenJDK. |
20363 | 31 |
# |
48839 | 32 |
# By default this Makefile will build a native toolchain for the current |
33 |
# platform if called with something like this: |
|
34 |
# |
|
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
35 |
# make tars BASE_OS=OL |
18021 | 36 |
# |
48839 | 37 |
# To build the full set of crosstools for additional platforms, use a command |
38 |
# line looking like this: |
|
18021 | 39 |
# |
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
40 |
# make TARGETS="aarch64-linux-gnu" BASE_OS=Fedora |
50472 | 41 |
# or |
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
42 |
# make TARGETS="arm-linux-gnueabihf ppc64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=17 |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
43 |
# |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
44 |
# to build several devkits for a specific OS version at once. |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
45 |
# You can find the final results under ../../build/devkit/result/<host>-to-<target> |
18021 | 46 |
# |
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
47 |
# You may want the native toolchain to be used when compiling the cross |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
48 |
# compilation toolchains. To achieve this, first build the native toolchain, |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
49 |
# then add the bin directory from this build to the path when invoking this |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
50 |
# makefile again for cross compilation. Ex: |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
51 |
# |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
52 |
# PATH=$PWD/../../build/devkit/result/x86_64-linux-gnu-to-x86_64-linux-gnu/bin:$PATH \ |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
53 |
# make TARGETS="arm-linux-gnueabihf,ppc64-linux-gnu" BASE_OS=Fedora |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
54 |
# |
48839 | 55 |
# This is the makefile which iterates over all host and target platforms. |
18021 | 56 |
# |
57 |
||
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
58 |
COMMA := , |
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
59 |
|
20363 | 60 |
os := $(shell uname -o) |
48839 | 61 |
cpu := $(shell uname -p) |
18021 | 62 |
|
63 |
# Figure out what platform this is building on. |
|
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
64 |
me := $(cpu)-$(if $(findstring Linux,$(os)),linux-gnu) |
18021 | 65 |
|
66 |
$(info Building on platform $(me)) |
|
67 |
||
48839 | 68 |
# |
69 |
# By default just build for the current platform, which is assumed to be Linux |
|
70 |
# |
|
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
71 |
ifeq ($(TARGETS), ) |
49204
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
72 |
platforms := $(me) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
73 |
host_platforms := $(platforms) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
74 |
else |
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
75 |
platforms := $(subst $(COMMA), , $(TARGETS)) |
49204
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
76 |
host_platforms := $(me) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
77 |
endif |
48839 | 78 |
target_platforms := $(platforms) |
79 |
$(info host_platforms $(host_platforms)) |
|
80 |
$(info target_platforms $(target_platforms)) |
|
81 |
||
20363 | 82 |
all compile : $(platforms) |
18021 | 83 |
|
84 |
ifeq (,$(SKIP_ME)) |
|
20363 | 85 |
$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) |
18021 | 86 |
endif |
87 |
||
48839 | 88 |
OUTPUT_ROOT = $(abspath ../../build/devkit) |
89 |
RESULT = $(OUTPUT_ROOT)/result |
|
18021 | 90 |
|
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
91 |
submakevars = HOST=$@ BUILD=$(me) RESULT=$(RESULT) OUTPUT_ROOT=$(OUTPUT_ROOT) |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
92 |
|
48839 | 93 |
$(host_platforms) : |
20363 | 94 |
@echo 'Building compilers for $@' |
48839 | 95 |
@echo 'Targets: $(target_platforms)' |
96 |
for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \ |
|
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
97 |
$(MAKE) -f Tools.gmk download-rpms $(submakevars) \ |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
98 |
TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \ |
20363 | 99 |
$(MAKE) -f Tools.gmk all $(submakevars) \ |
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
100 |
TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \ |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
101 |
$(MAKE) -f Tools.gmk ccache $(submakevars) \ |
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
102 |
TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p || exit 1 ; \ |
20363 | 103 |
done |
104 |
@echo 'All done"' |
|
18021 | 105 |
|
20363 | 106 |
today := $(shell date +%Y%m%d) |
18021 | 107 |
|
108 |
define Mktar |
|
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
109 |
$(1)-to-$(2)_tar = $$(RESULT)/sdk-$(1)-to-$(2)-$$(today).tar.gz |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
110 |
$$($(1)-to-$(2)_tar) : PLATFORM = $(1)-to-$(2) |
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
111 |
TARFILES += $$($(1)-to-$(2)_tar) |
18021 | 112 |
endef |
113 |
||
52665
61dcd7cd48c3
8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents:
52357
diff
changeset
|
114 |
$(foreach p,$(host_platforms),$(foreach t,$(target_platforms),$(eval $(call Mktar,$(p),$(t))))) |
18021 | 115 |
|
20363 | 116 |
tars : all $(TARFILES) |
117 |
onlytars : $(TARFILES) |
|
118 |
%.tar.gz : |
|
54148
62e4ada7c4c8
8220093: Change to GCC 8.2 for building on Linux at Oracle
erikj
parents:
52665
diff
changeset
|
119 |
$(MAKE) -r -f Tars.gmk SRC_DIR=$(RESULT)/$(PLATFORM) TAR_FILE=$@ |
18021 | 120 |
|
20363 | 121 |
clean : |
48839 | 122 |
rm -rf $(addprefix ../../build/devkit/, result $(host_platforms)) |
123 |
dist-clean: clean |
|
124 |
rm -rf $(addprefix ../../build/devkit/, src download) |
|
18021 | 125 |
|
20363 | 126 |
FORCE : |
48839 | 127 |
.PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean |