mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-06 18:53:37 +00:00
542 lines
18 KiB
Plaintext
542 lines
18 KiB
Plaintext
#
|
|
# Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved.
|
|
# 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.
|
|
#
|
|
|
|
################################################################################
|
|
#
|
|
# Workhorse makefile for creating ONE cross compiler
|
|
# Needs either to be from BUILD -> BUILD OR have
|
|
# BUILD -> HOST prebuilt
|
|
#
|
|
# NOTE: There is a bug here. We don't limit the
|
|
# PATH when building BUILD -> BUILD, which means that
|
|
# if you configure after you've once build the BUILD->BUILD
|
|
# compiler THAT one will be picked up as the compiler for itself.
|
|
# This is not so great, especially if you did a partial delete
|
|
# of the target tree.
|
|
#
|
|
# Fix this...
|
|
#
|
|
|
|
include Common.gmk
|
|
|
|
lowercase = $(shell echo $1 | tr A-Z a-z)
|
|
|
|
$(info TARGET=$(TARGET))
|
|
$(info HOST=$(HOST))
|
|
$(info BUILD=$(BUILD))
|
|
|
|
################################################################################
|
|
# Define external dependencies
|
|
|
|
GNU_BASE_URL := https://ftp.gnu.org/pub/gnu
|
|
|
|
BINUTILS_VER_ONLY := 2.43
|
|
BINUTILS_BASE_URL := $(GNU_BASE_URL)/binutils
|
|
BINUTILS_SHA512 := 93e063163e54d6a6ee2bd48dc754270bf757a3635b49a702ed6b310e929e94063958512d191e66beaf44275f7ea60865dbde138b624626739679fcc306b133bb
|
|
|
|
CCACHE_VER_ONLY := 4.10.2
|
|
CCACHE_BASE_URL := https://github.com/ccache/ccache/releases/download
|
|
CCACHE_CMAKE_BASED := 1
|
|
CCACHE_SHA512 := 3815c71d7266c32839acb306763268018acc58b3bbbd9ec79fc101e4217c1720d2ad2f01645bf69168c1c61d27700b6f3bb755cfa82689cca69824f015653f3c
|
|
|
|
GCC_VER_ONLY := 14.2.0
|
|
GCC_BASE_URL := $(GNU_BASE_URL)/gcc
|
|
GCC_SHA512 := 932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396
|
|
|
|
GDB_VER_ONLY := 15.2
|
|
GDB_BASE_URL := $(GNU_BASE_URL)/gdb
|
|
GDB_SHA512 := 624007deceb5b15ba89c0725883d1a699fa46714ef30887f3d0165e17c5d65d634671740a135aa69e437d916218abb08cfa2a38ed309ff19d48f51da56b2a8ba
|
|
|
|
GMP_VER_ONLY := 6.3.0
|
|
GMP_BASE_URL := $(GNU_BASE_URL)/gmp
|
|
GMP_SHA512 := e85a0dab5195889948a3462189f0e0598d331d3457612e2d3350799dba2e244316d256f8161df5219538eb003e4b5343f989aaa00f96321559063ed8c8f29fd2
|
|
|
|
MPC_VER_ONLY := 1.3.1
|
|
MPC_BASE_URL := $(GNU_BASE_URL)/mpc
|
|
MPC_SHA512 := 4bab4ef6076f8c5dfdc99d810b51108ced61ea2942ba0c1c932d624360a5473df20d32b300fc76f2ba4aa2a97e1f275c9fd494a1ba9f07c4cb2ad7ceaeb1ae97
|
|
|
|
MPFR_VER_ONLY := 4.2.1
|
|
MPFR_BASE_URL := https://www.mpfr.org
|
|
MPFR_SHA512 := bc68c0d755d5446403644833ecbb07e37360beca45f474297b5d5c40926df1efc3e2067eecffdf253f946288bcca39ca89b0613f545d46a9e767d1d4cf358475
|
|
|
|
DEPENDENCIES := BINUTILS CCACHE GCC GDB GMP MPC MPFR
|
|
|
|
$(foreach dep,$(DEPENDENCIES),$(eval $(dep)_VER := $(call lowercase,$(dep)-$($(dep)_VER_ONLY))))
|
|
|
|
BINUTILS_URL := $(BINUTILS_BASE_URL)/$(BINUTILS_VER).tar.xz
|
|
CCACHE_URL := $(CCACHE_BASE_URL)/v$(CCACHE_VER_ONLY)/$(CCACHE_VER).tar.xz
|
|
GCC_URL := $(GCC_BASE_URL)/$(GCC_VER)/$(GCC_VER).tar.xz
|
|
GDB_URL := $(GDB_BASE_URL)/$(GDB_VER).tar.xz
|
|
GMP_URL := $(GMP_BASE_URL)/$(GMP_VER).tar.xz
|
|
MPC_URL := $(MPC_BASE_URL)/$(MPC_VER).tar.gz
|
|
MPFR_URL := $(MPFR_BASE_URL)/$(MPFR_VER)/$(MPFR_VER).tar.xz
|
|
|
|
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
|
|
ifneq ($(REQUIRED_MIN_MAKE_MAJOR_VERSION),)
|
|
MAKE_MAJOR_VERSION := $(word 1,$(subst ., ,$(MAKE_VERSION)))
|
|
SUPPORTED_MAKE_VERSION := $(shell [ $(MAKE_MAJOR_VERSION) -ge $(REQUIRED_MIN_MAKE_MAJOR_VERSION) ] && echo true)
|
|
ifneq ($(SUPPORTED_MAKE_VERSION),true)
|
|
$(error "Make v$(MAKE_VERSION) is too old, must use v$(REQUIRED_MIN_MAKE_MAJOR_VERSION) or above")
|
|
endif
|
|
endif
|
|
|
|
################################################################################
|
|
# Define common directories and files
|
|
|
|
# Ensure we have 32-bit libs also for x64. We enable mixed-mode.
|
|
ifeq (x86_64,$(ARCH))
|
|
LIBDIRS := lib64 lib
|
|
CFLAGS_lib := -m32
|
|
else
|
|
LIBDIRS := lib
|
|
endif
|
|
|
|
# Define directories
|
|
DOWNLOAD := $(OUTPUT_ROOT)/download
|
|
SRCDIR := $(OUTPUT_ROOT)/src
|
|
|
|
# Marker files
|
|
LINK_LIBS_MARKER := $(BUILDDIR)/link_libs.marker
|
|
|
|
################################################################################
|
|
# Unpack source packages
|
|
|
|
# Generate downloading + checksum verification of sources.
|
|
define DownloadVerify
|
|
# Allow override
|
|
$(1)_DIRNAME ?= $(basename $(basename $(notdir $($(1)_URL))))
|
|
$(1)_DIR = $(abspath $(SRCDIR)/$$($(1)_DIRNAME))
|
|
ifeq ($$($(1)_CMAKE_BASED),)
|
|
$(1)_CFG = $$($(1)_DIR)/configure
|
|
$(1)_SRC_MARKER = $$($(1)_DIR)/configure
|
|
$(1)_CONFIG = $(CONFIG)
|
|
else
|
|
$(1)_CFG = cmake
|
|
$(1)_SRC_MARKER = $$($(1)_DIR)/CMakeLists.txt
|
|
$(1)_CONFIG = $$(CMAKE_CONFIG) $$($(1)_DIR)
|
|
endif
|
|
$(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)_URL))
|
|
|
|
$$($(1)_SRC_MARKER): $$($(1)_FILE)
|
|
mkdir -p $$(SRCDIR)
|
|
tar -C $$(SRCDIR) -xf $$<
|
|
$$(foreach p,$$(abspath $$(wildcard patches/$$(ARCH)-$$(notdir $$($(1)_DIR)).patch)), \
|
|
echo PATCHING $$(p); \
|
|
patch -d $$($(1)_DIR) -p1 -i $$(p); \
|
|
)
|
|
touch $$@
|
|
|
|
$$($(1)_FILE):
|
|
mkdir -p $$(@D)
|
|
wget -O - $$($(1)_URL) > $$@.tmp
|
|
sha512_actual="$$$$(sha512sum $$@.tmp | awk '{ print $$$$1; }')"; \
|
|
if [ x"$$$${sha512_actual}" != x"$$($(1)_SHA512)" ]; then \
|
|
echo "Checksum mismatch for $$@.tmp"; \
|
|
echo " Expected: $$($(1)_SHA512)"; \
|
|
echo " Actual: $$$${sha512_actual}"; \
|
|
exit 1; \
|
|
fi
|
|
mv $$@.tmp $$@
|
|
endef
|
|
|
|
# Download and unpack all source packages
|
|
$(foreach dep,$(DEPENDENCIES),$(eval $(call DownloadVerify,$(dep))))
|
|
|
|
# Define marker files for each source package to be compiled
|
|
$(foreach dep,$(DEPENDENCIES),$(eval $(dep) = $(TARGETDIR)/$($(dep)_VER).done))
|
|
|
|
################################################################################
|
|
|
|
# Default base config
|
|
CONFIG = \
|
|
--target=$(TARGET) \
|
|
--host=$(HOST) --build=$(BUILD) \
|
|
--prefix=$(PREFIX) \
|
|
#
|
|
|
|
CMAKE_CONFIG = -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
|
|
|
|
PATHEXT = $(PREFIX)/bin:
|
|
|
|
PATHPRE = PATH=$(PATHEXT)$(PATH)
|
|
NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor)
|
|
BUILDPAR = -j$(NUM_CORES)
|
|
|
|
# Default commands to when making
|
|
MAKECMD =
|
|
INSTALLCMD = install
|
|
|
|
declare_tools = CC$(1)=$(2)gcc LD$(1)=$(2)ld AR$(1)=$(2)ar AS$(1)=$(2)as RANLIB$(1)=$(2)ranlib CXX$(1)=$(2)g++ OBJDUMP$(1)=$(2)objdump
|
|
|
|
ifeq ($(HOST),$(BUILD))
|
|
ifeq ($(HOST),$(TARGET))
|
|
TOOLS = $(call declare_tools,_FOR_TARGET,)
|
|
endif
|
|
endif
|
|
|
|
TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-)
|
|
|
|
################################################################################
|
|
|
|
# Create a TARGET bfd + libiberty only.
|
|
# Configure one or two times depending on mulitlib arch.
|
|
# If multilib, the second should be 32-bit, and we resolve
|
|
# CFLAG_<name> to most likely -m32.
|
|
define mk_bfd
|
|
$$(info Libs for $(1))
|
|
$$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile: \
|
|
CFLAGS += $$(CFLAGS_$(1))
|
|
$$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile: \
|
|
LIBDIRS = --libdir=$(TARGETDIR)/$(1)
|
|
|
|
BFDLIB += $$(TARGETDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1)).done
|
|
BFDMAKES += $$(BUILDDIR)/$$(BINUTILS_VER)-$(subst /,-,$(1))/Makefile
|
|
endef
|
|
|
|
# Create one set of bfds etc for each multilib arch
|
|
$(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l))))
|
|
|
|
# Only build these two libs.
|
|
$(BFDLIB): MAKECMD = all-libiberty all-bfd
|
|
$(BFDLIB): INSTALLCMD = install-libiberty install-bfd
|
|
|
|
# Building targets libbfd + libiberty. HOST==TARGET, i.e not
|
|
# for a cross env.
|
|
$(BFDMAKES): CONFIG = --target=$(TARGET) \
|
|
--host=$(TARGET) --build=$(BUILD) \
|
|
--prefix=$(TARGETDIR) \
|
|
--with-sysroot=$(SYSROOT) \
|
|
$(LIBDIRS)
|
|
|
|
$(BFDMAKES): TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
|
|
|
|
################################################################################
|
|
|
|
$(GCC) \
|
|
$(BINUTILS) \
|
|
$(GMP) \
|
|
$(MPFR) \
|
|
$(MPC) \
|
|
$(BFDMAKES) \
|
|
$(CCACHE): ENVS += $(TOOLS)
|
|
|
|
# libdir to work around hateful bfd stuff installing into wrong dirs...
|
|
# ensure we have 64 bit bfd support in the HOST library. I.e our
|
|
# compiler on i686 will know 64 bit symbols, BUT later
|
|
# we build just the libs again for TARGET, then with whatever the arch
|
|
# wants.
|
|
$(BUILDDIR)/$(BINUTILS_VER)/Makefile: CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
|
|
|
|
ifeq ($(filter $(ARCH), s390x riscv64 ppc64le), )
|
|
# gold compiles but cannot link properly on s390x @ gcc 13.2 and Fedore 41
|
|
# gold is not available for riscv64 and ppc64le,
|
|
# and subsequent linking will fail if we try to enable it.
|
|
LINKER_CONFIG_ENABLE_GOLD := --enable-gold=default
|
|
endif
|
|
|
|
ifeq ($(filter riscv64 ppc64le s390x armhfp, $(ARCH)), )
|
|
ENABLE_MULTILIB := --enable-multilib
|
|
endif
|
|
|
|
# Makefile creation. Simply run configure in build dir.
|
|
# Setting CFLAGS to -O2 generates a much faster ld.
|
|
$(BFDMAKES) \
|
|
$(BUILDDIR)/$(BINUTILS_VER)/Makefile: $(BINUTILS_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
@mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) CFLAGS="-O2 $(CFLAGS)" \
|
|
$(BINUTILS_CFG) \
|
|
$(CONFIG) \
|
|
$(LINKER_CONFIG_ENABLE_GOLD) \
|
|
--with-sysroot=$(SYSROOT) \
|
|
--disable-nls \
|
|
--program-prefix=$(TARGET)- \
|
|
$(ENABLE_MULTILIB) \
|
|
--enable-threads \
|
|
--enable-plugins \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
$(BUILDDIR)/$(MPFR_VER)/Makefile: $(MPFR_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
@mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
|
|
$(MPFR_CFG) \
|
|
$(CONFIG) \
|
|
--program-prefix=$(TARGET)- \
|
|
--enable-shared=no \
|
|
--with-gmp=$(PREFIX) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
$(BUILDDIR)/$(GMP_VER)/Makefile: $(GMP_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
@mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
|
|
$(GMP_CFG) \
|
|
--host=$(HOST) --build=$(BUILD) \
|
|
--prefix=$(PREFIX) \
|
|
--disable-nls \
|
|
--program-prefix=$(TARGET)- \
|
|
--enable-shared=no \
|
|
--with-mpfr=$(PREFIX) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
$(BUILDDIR)/$(MPC_VER)/Makefile: $(MPC_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
@mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
|
|
$(MPC_CFG) \
|
|
$(CONFIG) \
|
|
--program-prefix=$(TARGET)- \
|
|
--enable-shared=no \
|
|
--with-mpfr=$(PREFIX) \
|
|
--with-gmp=$(PREFIX) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
# Only valid if glibc target -> linux
|
|
# proper destructor handling for c++
|
|
ifneq (,$(findstring linux,$(TARGET)))
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: CONFIG += --enable-__cxa_atexit
|
|
endif
|
|
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: CONFIG += --disable-libgomp
|
|
ifeq ($(ARCH), armhfp)
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: CONFIG += --with-float=hard
|
|
endif
|
|
ifeq ($(ARCH), riscv64)
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: CONFIG += --disable-libsanitizer
|
|
endif
|
|
|
|
ifneq ($(filter riscv64 ppc64le s390x armhfp, $(ARCH)), )
|
|
# We only support 64-bit on these platforms anyway
|
|
CONFIG += --disable-multilib
|
|
endif
|
|
|
|
# Want:
|
|
# c,c++
|
|
# shared libs
|
|
# multilib (-m32/-m64 on x64)
|
|
# skip native language.
|
|
# and link and assemble with the binutils we created
|
|
# earlier, so --with-gnu*
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: $(GCC_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
|
|
$(CONFIG) \
|
|
--with-sysroot=$(SYSROOT) \
|
|
--with-debug-prefix-map=$(OUTPUT_ROOT)=devkit \
|
|
--enable-languages=c,c++ \
|
|
--enable-shared \
|
|
--disable-nls \
|
|
--with-gnu-as \
|
|
--with-gnu-ld \
|
|
--with-mpfr=$(PREFIX) \
|
|
--with-gmp=$(PREFIX) \
|
|
--with-mpc=$(PREFIX) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
# need binutils for gcc
|
|
$(GCC): $(BINUTILS)
|
|
|
|
# as of 4.3 or so need these for doing config
|
|
$(BUILDDIR)/$(GCC_VER)/Makefile: $(GMP) $(MPFR) $(MPC)
|
|
$(MPFR): $(GMP)
|
|
$(MPC): $(GMP) $(MPFR)
|
|
|
|
################################################################################
|
|
# Build gdb but only where host and target match
|
|
ifeq ($(HOST), $(TARGET))
|
|
$(BUILDDIR)/$(GDB_VER)/Makefile: $(GDB_CFG)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
mkdir -p $(@D)
|
|
( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" $(GDB_CFG) \
|
|
$(CONFIG) \
|
|
--with-sysroot=$(SYSROOT) \
|
|
--with-mpfr=$(PREFIX) \
|
|
--with-gmp=$(PREFIX) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
$(GDB): $(GCC)
|
|
else
|
|
$(BUILDDIR)/$(GDB_VER)/Makefile:
|
|
$(info Faking $@, not used when cross-compiling)
|
|
mkdir -p $(@D)
|
|
echo "install:" > $@
|
|
@echo 'done'
|
|
endif
|
|
|
|
################################################################################
|
|
# very straightforward. just build a ccache. it is only for host.
|
|
$(BUILDDIR)/$(CCACHE_VER)/Makefile: $(CCACHE_SRC_MARKER)
|
|
$(info Configuring $@. Log in $(@D)/log.config)
|
|
@mkdir -p $(@D)
|
|
@( \
|
|
cd $(@D); \
|
|
$(PATHPRE) $(ENVS) $(CCACHE_CFG) $(CCACHE_CONFIG) \
|
|
) > $(@D)/log.config 2>&1
|
|
@echo 'done'
|
|
|
|
GCC_PATCHED = $(TARGETDIR)/gcc-patched
|
|
|
|
################################################################################
|
|
# For some reason cpp is not created as a target-compiler
|
|
ifeq ($(HOST),$(TARGET))
|
|
$(GCC_PATCHED): $(LINK_LIBS_MARKER)
|
|
@echo -n 'Creating compiler symlinks...'
|
|
@for f in cpp; do \
|
|
if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; then \
|
|
cd $(PREFIX)/bin && \
|
|
ln -fs $$f $(TARGET)-$$f; \
|
|
fi \
|
|
done
|
|
@touch $@
|
|
@echo 'done'
|
|
|
|
##############################################################################
|
|
# Ugly at best. Seems that when we compile host->host compiler, that are NOT
|
|
# the BUILD compiler, the result will not try searching for libs in package root.
|
|
# "Solve" this by create links from the target libdirs to where they are.
|
|
$(LINK_LIBS_MARKER): $(GCC)
|
|
@echo -n 'Creating library symlinks...'
|
|
@for l in $(LIBDIRS); do \
|
|
for f in `cd $(PREFIX)/$$l && ls`; do \
|
|
if [ ! -e $(TARGETDIR)/$$l/$$f ]; then \
|
|
mkdir -p $(TARGETDIR)/$$l && \
|
|
cd $(TARGETDIR)/$$l/ && \
|
|
ln -fs ../../$$l/$$f $$f; \
|
|
fi \
|
|
done \
|
|
done
|
|
@touch $@
|
|
@echo 'done'
|
|
else
|
|
$(GCC_PATCHED):
|
|
@echo 'done'
|
|
endif
|
|
|
|
################################################################################
|
|
# Build in two steps.
|
|
# make <default>
|
|
# make install.
|
|
# Use path to our build hosts cross tools
|
|
# Always need to build cross tools for build host self.
|
|
$(TARGETDIR)/%.done: $(BUILDDIR)/%/Makefile
|
|
$(info Building $(basename $@). Log in $(<D)/log.build)
|
|
$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
|
|
@echo -n 'installing...'
|
|
$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1
|
|
@mkdir -p $(@D)
|
|
@touch $@
|
|
@echo 'done'
|
|
|
|
################################################################################
|
|
|
|
$(PREFIX)/devkit.info:
|
|
@echo 'Creating devkit.info in the root of the kit'
|
|
rm -f $@
|
|
touch $@
|
|
echo '# This file describes to configure how to interpret the contents of this' >> $@
|
|
echo '# devkit' >> $@
|
|
echo '' >> $@
|
|
echo 'DEVKIT_NAME="$(GCC_VER) - $(BASE_OS_DESCRIPTION)"' >> $@
|
|
echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@
|
|
echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$(TARGET)/sysroot"' >> $@
|
|
echo 'DEVKIT_EXTRA_PATH="$$DEVKIT_ROOT/bin"' >> $@
|
|
|
|
################################################################################
|
|
# Copy these makefiles into the root of the kit
|
|
|
|
THESE_MAKEFILES := Makefile $(wildcard *.gmk) patches
|
|
COPIED_MAKEFILES := $(addprefix $(PREFIX)/, $(THESE_MAKEFILES))
|
|
|
|
$(PREFIX)/%: ./%
|
|
rm -rf $@
|
|
cp -r $< $@
|
|
|
|
################################################################################
|
|
|
|
ifeq ($(TARGET), $(HOST))
|
|
# To build with dtrace support, the build needs access to the dtrace executable from the
|
|
# sysroot. Generally we don't want to add binaries in the sysroot to the path, but
|
|
# luckily this seems to execute well enough on a different host Linux distro, so symlink
|
|
# it into the main bin dir.
|
|
$(PREFIX)/bin/dtrace:
|
|
@echo 'Creating dtrace soft link'
|
|
ln -s ../$(HOST)/sysroot/usr/bin/dtrace $@
|
|
|
|
$(PREFIX)/bin/%:
|
|
@echo 'Creating missing $* soft link'
|
|
ln -s $(TARGET)-$* $@
|
|
|
|
MISSING_LINK_NAMES = \
|
|
addr2line ar as c++ c++filt dwp elfedit g++ gcc gcc-$(GCC_VER_ONLY) gprof ld ld.bfd \
|
|
nm objcopy objdump ranlib readelf size strings strip
|
|
ifneq ($(LINKER_CONFIG_ENABLE_GOLD), )
|
|
MISSING_LINK_NAMES += ld.gold
|
|
endif
|
|
|
|
MISSING_LINKS := $(addprefix $(PREFIX)/bin/, $(MISSING_LINK_NAMES))
|
|
endif
|
|
|
|
# Add link to work around "plugin needed to handle lto object" (JDK-8344272)
|
|
$(PREFIX)/lib/bfd-plugins/liblto_plugin.so: $(PREFIX)/libexec/gcc/$(TARGET)/$(GCC_VER_ONLY)/liblto_plugin.so
|
|
@echo 'Creating missing $(@F) soft link'
|
|
@mkdir -p $(@D)
|
|
ln -s $$(realpath -s --relative-to=$(@D) $<) $@
|
|
|
|
MISSING_LINKS += $(PREFIX)/lib/bfd-plugins/liblto_plugin.so
|
|
|
|
################################################################################
|
|
|
|
bfdlib: $(BFDLIB)
|
|
binutils: $(BINUTILS)
|
|
gcc: $(GCC) $(GCC_PATCHED)
|
|
gdb: $(GDB)
|
|
all: binutils gcc bfdlib gdb \
|
|
$(MISSING_LINKS) $(COPIED_MAKEFILES) $(PREFIX)/devkit.info
|
|
|
|
# this is only built for host. so separate.
|
|
ccache: $(CCACHE)
|
|
|
|
.PHONY: bfdlib binutils gcc gdb all ccache
|