2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-02-09 21:58:40 +00:00
|
|
|
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
2013-06-18 09:30:36 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
2018-02-09 21:58:40 +00:00
|
|
|
################################################################################
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2013-10-10 12:58:19 +00:00
|
|
|
# This Makefile, together with Tools.gmk, can be used to compile a set of
|
|
|
|
# gcc based cross compilation, portable, self contained packages, capable
|
2013-06-18 09:30:36 +00:00
|
|
|
# of building OpenJDK.
|
2013-10-10 12:58:19 +00:00
|
|
|
#
|
|
|
|
# In addition to the makefiles, access to Oracle Linux installation
|
|
|
|
# media is required. This has been tested against Oracle Enterprise Linux
|
2018-02-09 21:58:40 +00:00
|
|
|
# 6.4.
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-02-09 21:58:40 +00:00
|
|
|
# By default this Makefile will build a native toolchain for the current
|
|
|
|
# platform if called with something like this:
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-10-31 20:14:52 +00:00
|
|
|
# make tars BASE_OS=OEL6
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-02-09 21:58:40 +00:00
|
|
|
# To build the full set of crosstools for additional platforms, use a command
|
|
|
|
# line looking like this:
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-03-12 16:00:54 +00:00
|
|
|
# make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27
|
2018-06-08 16:15:58 +00:00
|
|
|
# or
|
|
|
|
# make cross_compile_target="arm-linux-gnueabihf" BASE_OS=Fedora27
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
2018-02-09 21:58:40 +00:00
|
|
|
# This is the makefile which iterates over all host and target platforms.
|
2013-06-18 09:30:36 +00:00
|
|
|
#
|
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
os := $(shell uname -o)
|
2018-02-09 21:58:40 +00:00
|
|
|
cpu := $(shell uname -p)
|
2013-06-18 09:30:36 +00:00
|
|
|
|
|
|
|
# Figure out what platform this is building on.
|
2013-10-10 12:58:19 +00:00
|
|
|
me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
|
2013-06-18 09:30:36 +00:00
|
|
|
|
|
|
|
$(info Building on platform $(me))
|
|
|
|
|
2018-02-09 21:58:40 +00:00
|
|
|
#
|
|
|
|
# By default just build for the current platform, which is assumed to be Linux
|
|
|
|
#
|
2018-03-12 16:00:54 +00:00
|
|
|
ifeq ($(cross_compile_target), )
|
|
|
|
platforms := $(me)
|
|
|
|
host_platforms := $(platforms)
|
|
|
|
else
|
|
|
|
platforms := $(cross_compile_target)
|
|
|
|
host_platforms := $(me)
|
|
|
|
endif
|
2018-02-09 21:58:40 +00:00
|
|
|
target_platforms := $(platforms)
|
|
|
|
$(info host_platforms $(host_platforms))
|
|
|
|
$(info target_platforms $(target_platforms))
|
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
all compile : $(platforms)
|
2013-06-18 09:30:36 +00:00
|
|
|
|
|
|
|
ifeq (,$(SKIP_ME))
|
2013-10-10 12:58:19 +00:00
|
|
|
$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
|
2013-06-18 09:30:36 +00:00
|
|
|
endif
|
|
|
|
|
2018-02-09 21:58:40 +00:00
|
|
|
OUTPUT_ROOT = $(abspath ../../build/devkit)
|
|
|
|
RESULT = $(OUTPUT_ROOT)/result
|
2013-10-10 12:58:19 +00:00
|
|
|
|
|
|
|
submakevars = HOST=$@ BUILD=$(me) \
|
|
|
|
RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
|
2018-02-09 21:58:40 +00:00
|
|
|
OUTPUT_ROOT=$(OUTPUT_ROOT)
|
|
|
|
$(host_platforms) :
|
2013-10-10 12:58:19 +00:00
|
|
|
@echo 'Building compilers for $@'
|
2018-02-09 21:58:40 +00:00
|
|
|
@echo 'Targets: $(target_platforms)'
|
|
|
|
for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \
|
|
|
|
$(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \
|
2013-10-10 12:58:19 +00:00
|
|
|
$(MAKE) -f Tools.gmk all $(submakevars) \
|
|
|
|
TARGET=$$p || exit 1 ; \
|
|
|
|
done
|
|
|
|
@echo 'Building ccache program for $@'
|
|
|
|
$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
|
|
|
|
@echo 'All done"'
|
2013-06-18 09:30:36 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
today := $(shell date +%Y%m%d)
|
2013-06-18 09:30:36 +00:00
|
|
|
|
|
|
|
define Mktar
|
2013-10-10 12:58:19 +00:00
|
|
|
$(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
|
|
|
|
$$($(1)_tar) : PLATFORM = $(1)
|
|
|
|
TARFILES += $$($(1)_tar)
|
|
|
|
$$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
|
2013-06-18 09:30:36 +00:00
|
|
|
endef
|
|
|
|
|
2018-02-09 21:58:40 +00:00
|
|
|
$(foreach p,$(host_platforms),$(eval $(call Mktar,$(p))))
|
2013-06-18 09:30:36 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
tars : all $(TARFILES)
|
|
|
|
onlytars : $(TARFILES)
|
|
|
|
%.tar.gz :
|
|
|
|
@echo 'Creating compiler package $@'
|
|
|
|
cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
|
|
|
|
touch $@
|
2013-06-18 09:30:36 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
clean :
|
2018-02-09 21:58:40 +00:00
|
|
|
rm -rf $(addprefix ../../build/devkit/, result $(host_platforms))
|
|
|
|
dist-clean: clean
|
|
|
|
rm -rf $(addprefix ../../build/devkit/, src download)
|
2013-06-18 09:30:36 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
FORCE :
|
2018-02-09 21:58:40 +00:00
|
|
|
.PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean
|