2006-06-27 08:44:04 +08:00
|
|
|
#
|
2009-09-23 10:27:38 +08:00
|
|
|
# Copyright (C) 2007-2009 OpenWrt.org
|
2006-06-27 08:44:04 +08:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2005-03-06 11:34:52 +08:00
|
|
|
# Main makefile for the toolchain
|
2006-06-27 08:44:04 +08:00
|
|
|
#
|
2009-01-08 09:49:11 +08:00
|
|
|
# Steps:
|
|
|
|
# 1) toolchain/binutils/install
|
|
|
|
# build & install binutils
|
2014-02-19 06:15:58 +08:00
|
|
|
# 2) toolchain/gcc/minimal/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install a minimal gcc, needed for steps 3 & 4
|
|
|
|
# 3) toolchain/kernel-headers/install
|
|
|
|
# install kernel headers, needed for step 4
|
2014-02-19 06:15:58 +08:00
|
|
|
# 4) toolchain/libc/headers/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install libc headers & support files, needed for step 5
|
2014-02-19 06:15:58 +08:00
|
|
|
# 5) toolchain/gcc/initial/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install an initial gcc, needed for step 6
|
2014-02-19 06:15:58 +08:00
|
|
|
# 6) toolchain/libc/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install the final libc
|
2014-02-19 06:15:58 +08:00
|
|
|
# 7) toolchain/gcc/final/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install the final gcc
|
2014-02-19 06:15:58 +08:00
|
|
|
# 8) toolchain/libc/utils/install
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install libc utilities
|
|
|
|
#
|
2016-07-07 20:12:30 +08:00
|
|
|
# For musl, steps 2 and 4 are skipped, and step 3 is done after 5
|
2009-01-08 09:49:11 +08:00
|
|
|
|
2007-07-30 23:00:27 +08:00
|
|
|
curdir:=toolchain
|
2006-09-27 22:06:46 +08:00
|
|
|
|
2007-07-28 21:29:03 +08:00
|
|
|
# subdirectories to descend into
|
2016-07-07 20:12:30 +08:00
|
|
|
$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers)
|
2012-07-01 05:44:05 +08:00
|
|
|
ifdef CONFIG_USE_UCLIBC
|
|
|
|
$(curdir)/builddirs += $(LIBC)/utils
|
|
|
|
endif
|
2005-03-06 11:34:52 +08:00
|
|
|
|
2007-07-28 21:29:03 +08:00
|
|
|
# builddir dependencies
|
2009-09-23 10:27:38 +08:00
|
|
|
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
|
2016-07-07 20:12:30 +08:00
|
|
|
ifdef CONFIG_USE_MUSL
|
|
|
|
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/install
|
|
|
|
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/install
|
|
|
|
else
|
|
|
|
$(curdir)/builddirs += $(LIBC)/headers gcc/minimal
|
|
|
|
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
|
|
|
|
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/install
|
|
|
|
$(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
|
|
|
|
$(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
|
|
|
|
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
|
|
|
|
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
|
|
|
|
endif
|
2012-07-01 05:44:05 +08:00
|
|
|
|
2016-07-07 20:12:30 +08:00
|
|
|
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/install
|
|
|
|
$(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
|
2012-07-03 22:23:32 +08:00
|
|
|
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
|
|
|
|
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install
|
|
|
|
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
|
|
|
|
$(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
|
2006-08-11 03:25:26 +08:00
|
|
|
endif
|
2007-08-07 08:04:25 +08:00
|
|
|
|
2016-07-07 20:12:30 +08:00
|
|
|
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
|
|
|
|
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
|
|
|
|
|
2010-09-02 01:51:36 +08:00
|
|
|
ifndef DUMP_TARGET_DB
|
2008-06-15 22:34:00 +08:00
|
|
|
ifneq ($(ARCH),)
|
|
|
|
$(TOOLCHAIN_DIR)/info.mk: .config
|
2007-08-07 08:04:25 +08:00
|
|
|
@for dir in $(TOOLCHAIN_DIR); do ( \
|
2011-04-04 08:54:37 +08:00
|
|
|
$(if $(QUIET),,set -x;) \
|
2007-08-07 08:04:25 +08:00
|
|
|
mkdir -p "$$dir"; \
|
|
|
|
cd "$$dir"; \
|
2013-03-28 20:16:39 +08:00
|
|
|
ln -nsf lib lib64; \
|
2013-04-05 20:36:23 +08:00
|
|
|
ln -nsf lib lib32; \
|
2009-01-08 09:49:11 +08:00
|
|
|
mkdir -p stamp lib usr/include usr/lib ; \
|
2007-08-07 08:04:25 +08:00
|
|
|
); done
|
|
|
|
@grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
|
|
|
|
@touch $@
|
2008-06-15 22:34:00 +08:00
|
|
|
endif
|
2010-09-02 01:51:36 +08:00
|
|
|
endif
|
2005-03-06 11:34:52 +08:00
|
|
|
|
2007-07-28 21:29:03 +08:00
|
|
|
# prerequisites for the individual targets
|
2007-07-31 05:14:08 +08:00
|
|
|
$(curdir)/ := .config prereq
|
2014-12-13 19:57:14 +08:00
|
|
|
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk $(tools/stamp-install)
|
2007-07-28 21:44:04 +08:00
|
|
|
$(curdir)//compile = $(1)/prepare
|
|
|
|
$(curdir)//install = $(1)/compile
|
2005-03-06 11:34:52 +08:00
|
|
|
|
2010-09-02 01:51:36 +08:00
|
|
|
ifndef DUMP_TARGET_DB
|
2007-09-09 03:55:42 +08:00
|
|
|
$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
|
2010-09-02 01:51:36 +08:00
|
|
|
endif
|
2007-09-09 03:55:42 +08:00
|
|
|
|
2009-07-11 20:48:59 +08:00
|
|
|
$(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
|
2007-07-28 21:44:04 +08:00
|
|
|
$(eval $(call subdir,$(curdir)))
|
2007-04-19 01:35:46 +08:00
|
|
|
|