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:
|
2017-01-19 00:56:13 +08:00
|
|
|
# 1) toolchain/binutils/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install binutils
|
2017-01-19 00:56:13 +08:00
|
|
|
# 2) toolchain/gcc/minimal/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install a minimal gcc, needed for steps 3 & 4
|
2017-01-19 00:56:13 +08:00
|
|
|
# 3) toolchain/kernel-headers/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# install kernel headers, needed for step 4
|
2017-01-19 00:56:13 +08:00
|
|
|
# 4) toolchain/libc/headers/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install libc headers & support files, needed for step 5
|
2017-01-19 00:56:13 +08:00
|
|
|
# 5) toolchain/gcc/initial/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install an initial gcc, needed for step 6
|
2017-01-19 00:56:13 +08:00
|
|
|
# 6) toolchain/libc/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install the final libc
|
2017-01-19 00:56:13 +08:00
|
|
|
# 7) toolchain/gcc/final/compile
|
2009-01-08 09:49:11 +08:00
|
|
|
# build & install the final gcc
|
2017-01-19 00:56:13 +08:00
|
|
|
# 8) toolchain/libc/utils/compile
|
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
|
2021-03-02 19:34:24 +08:00
|
|
|
$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers) $(if $(CONFIG_NASM),nasm)
|
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
|
2017-01-19 00:56:13 +08:00
|
|
|
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/compile
|
|
|
|
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/compile
|
2016-07-07 20:12:30 +08:00
|
|
|
else
|
|
|
|
$(curdir)/builddirs += $(LIBC)/headers gcc/minimal
|
2017-01-19 00:56:13 +08:00
|
|
|
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/compile
|
|
|
|
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/compile
|
|
|
|
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/compile
|
|
|
|
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/compile
|
2016-07-07 20:12:30 +08:00
|
|
|
endif
|
2012-07-01 05:44:05 +08:00
|
|
|
|
2017-01-19 00:56:13 +08:00
|
|
|
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/compile
|
|
|
|
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile
|
2019-07-23 22:53:51 +08:00
|
|
|
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile $(curdir)/kernel-headers/compile
|
2017-01-19 00:56:13 +08:00
|
|
|
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/compile
|
2006-08-11 03:25:26 +08:00
|
|
|
endif
|
2007-08-07 08:04:25 +08:00
|
|
|
|
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
|
|
|
|
2017-02-15 22:15:46 +08:00
|
|
|
ifdef CONFIG_BUILDBOT
|
2018-09-24 17:02:30 +08:00
|
|
|
ifneq ($(wildcard $(TOPDIR)/.git),)
|
2017-02-16 14:43:27 +08:00
|
|
|
$(TOOLCHAIN_DIR)/stamp/.ver_check: $(TMP_DIR)/.build
|
|
|
|
cd "$(TOPDIR)"; git log --format=%h -1 toolchain > $(TMP_DIR)/.ver_check
|
|
|
|
cmp -s $(TMP_DIR)/.ver_check $@ || { \
|
|
|
|
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR_TOOLCHAIN); \
|
|
|
|
mkdir -p $(TOOLCHAIN_DIR)/stamp; \
|
|
|
|
mv $(TMP_DIR)/.ver_check $@; \
|
|
|
|
}
|
2017-02-15 22:15:46 +08:00
|
|
|
|
2017-02-16 14:43:27 +08:00
|
|
|
$(TOOLCHAIN_DIR)/info.mk $(STAGING_DIR)/.prepared: $(TOOLCHAIN_DIR)/stamp/.ver_check
|
2017-02-15 22:15:46 +08:00
|
|
|
endif
|
2018-09-24 17:02:30 +08:00
|
|
|
endif
|
2017-02-15 22:15:46 +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
|
2017-02-10 02:46:41 +08:00
|
|
|
$(curdir)//compile = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk $(tools/stamp-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
|
|
|
|
2017-01-19 00:56:13 +08:00
|
|
|
$(curdir)/install: $(curdir)/compile
|
|
|
|
|
|
|
|
$(eval $(call stampfile,$(curdir),toolchain,compile,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
|
2016-12-14 22:36:39 +08:00
|
|
|
$(eval $(call stampfile,$(curdir),toolchain,check,$(TMP_DIR)/.build))
|
2007-07-28 21:44:04 +08:00
|
|
|
$(eval $(call subdir,$(curdir)))
|
2007-04-19 01:35:46 +08:00
|
|
|
|