author | pbansal |
Wed, 28 Mar 2018 17:54:44 +0530 | |
changeset 49497 | 1f87bf473c9a |
parent 49204 | 564802b01ded |
child 50472 | ee1a0ddb2590 |
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 |
# |
32 |
# In addition to the makefiles, access to Oracle Linux installation |
|
33 |
# media is required. This has been tested against Oracle Enterprise Linux |
|
48839 | 34 |
# 6.4. |
18021 | 35 |
# |
48839 | 36 |
# By default this Makefile will build a native toolchain for the current |
37 |
# platform if called with something like this: |
|
38 |
# |
|
39 |
# make tars |
|
18021 | 40 |
# |
48839 | 41 |
# To build the full set of crosstools for additional platforms, use a command |
42 |
# line looking like this: |
|
18021 | 43 |
# |
49204
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
44 |
# make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27 |
18021 | 45 |
# |
48839 | 46 |
# This is the makefile which iterates over all host and target platforms. |
18021 | 47 |
# |
48 |
||
20363 | 49 |
os := $(shell uname -o) |
48839 | 50 |
cpu := $(shell uname -p) |
18021 | 51 |
|
52 |
# Figure out what platform this is building on. |
|
20363 | 53 |
me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) |
18021 | 54 |
|
55 |
$(info Building on platform $(me)) |
|
56 |
||
48839 | 57 |
# |
58 |
# By default just build for the current platform, which is assumed to be Linux |
|
59 |
# |
|
49204
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
60 |
ifeq ($(cross_compile_target), ) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
61 |
platforms := $(me) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
62 |
host_platforms := $(platforms) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
63 |
else |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
64 |
platforms := $(cross_compile_target) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
65 |
host_platforms := $(me) |
564802b01ded
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
ihse
parents:
48839
diff
changeset
|
66 |
endif |
48839 | 67 |
target_platforms := $(platforms) |
68 |
$(info host_platforms $(host_platforms)) |
|
69 |
$(info target_platforms $(target_platforms)) |
|
70 |
||
20363 | 71 |
all compile : $(platforms) |
18021 | 72 |
|
73 |
ifeq (,$(SKIP_ME)) |
|
20363 | 74 |
$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) |
18021 | 75 |
endif |
76 |
||
48839 | 77 |
OUTPUT_ROOT = $(abspath ../../build/devkit) |
78 |
RESULT = $(OUTPUT_ROOT)/result |
|
18021 | 79 |
|
20363 | 80 |
submakevars = HOST=$@ BUILD=$(me) \ |
81 |
RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ |
|
48839 | 82 |
OUTPUT_ROOT=$(OUTPUT_ROOT) |
83 |
$(host_platforms) : |
|
20363 | 84 |
@echo 'Building compilers for $@' |
48839 | 85 |
@echo 'Targets: $(target_platforms)' |
86 |
for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \ |
|
87 |
$(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \ |
|
20363 | 88 |
$(MAKE) -f Tools.gmk all $(submakevars) \ |
89 |
TARGET=$$p || exit 1 ; \ |
|
90 |
done |
|
91 |
@echo 'Building ccache program for $@' |
|
92 |
$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ |
|
93 |
@echo 'All done"' |
|
18021 | 94 |
|
20363 | 95 |
today := $(shell date +%Y%m%d) |
18021 | 96 |
|
97 |
define Mktar |
|
20363 | 98 |
$(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz |
99 |
$$($(1)_tar) : PLATFORM = $(1) |
|
100 |
TARFILES += $$($(1)_tar) |
|
101 |
$$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) |
|
18021 | 102 |
endef |
103 |
||
48839 | 104 |
$(foreach p,$(host_platforms),$(eval $(call Mktar,$(p)))) |
18021 | 105 |
|
20363 | 106 |
tars : all $(TARFILES) |
107 |
onlytars : $(TARFILES) |
|
108 |
%.tar.gz : |
|
109 |
@echo 'Creating compiler package $@' |
|
110 |
cd $(RESULT)/$(PLATFORM) && tar -czf $@ * |
|
111 |
touch $@ |
|
18021 | 112 |
|
20363 | 113 |
clean : |
48839 | 114 |
rm -rf $(addprefix ../../build/devkit/, result $(host_platforms)) |
115 |
dist-clean: clean |
|
116 |
rm -rf $(addprefix ../../build/devkit/, src download) |
|
18021 | 117 |
|
20363 | 118 |
FORCE : |
48839 | 119 |
.PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean |