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