From c137f14fade2ae3c23ab389b2e3e99f8bb5a55ab Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Sun, 6 Aug 2017 23:35:06 +0000 Subject: [PATCH] add TOOLS_DIR and SYSROOT_DIR to control output The sysroot directory is essential to our purpose of building a relocatable toolchain, as GCC will look for it relative to the path to the compiler. Because we use a two-stage process to build our compiler, we want to distinguish between our intermediate sysroot where libraries and headers from our temporary musl and kernel builds are installed, and our final sysroot which should be empty of everything except the libraries and headers from GCC itself. We also expose an output directory for the final toolchain. In normal operation, Buildroot treats the toolchain as the means to the end of an embedded system image, while we only care about the toolchain. Signed-off-by: Ben Cressey --- Makefile | 7 +++++-- package/Makefile.in | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 89f3648bb7..84591e22de 100644 --- a/Makefile +++ b/Makefile @@ -218,6 +218,7 @@ PER_PACKAGE_DIR := $(BASE_DIR)/per-package # .config. HOST_DIR will be overwritten later when .config is included. HOST_DIR := $(BASE_DIR)/host GRAPHS_DIR := $(BASE_DIR)/graphs +TOOLS_DIR := $(BASE_DIR)/toolchain LEGAL_INFO_DIR = $(BASE_DIR)/legal-info REDIST_SOURCES_DIR_TARGET = $(LEGAL_INFO_DIR)/sources @@ -487,7 +488,9 @@ export BR2_CONFIG export BR2_REPRODUCIBLE export TARGET_DIR export STAGING_DIR +export SYSROOT_DIR export HOST_DIR +export TOOLS_DIR export BINARIES_DIR export BASE_DIR @@ -1036,7 +1039,7 @@ savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile # staging and target directories do NOT list these as # dependencies anywhere else -$(BUILD_DIR) $(BASE_TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST) $(PER_PACKAGE_DIR): +$(BUILD_DIR) $(BASE_TARGET_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST) $(PER_PACKAGE_DIR) $(TOOLS_DIR): @mkdir -p $@ # outputmakefile generates a Makefile in the output directory, if using a @@ -1099,7 +1102,7 @@ show-vars: clean: rm -rf $(BASE_TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) $(HOST_DIR_SYMLINK) \ $(BUILD_DIR) $(BASE_DIR)/staging \ - $(LEGAL_INFO_DIR) $(GRAPHS_DIR) $(PER_PACKAGE_DIR) $(CPE_UPDATES_DIR) \ + $(LEGAL_INFO_DIR) $(GRAPHS_DIR) $(PER_PACKAGE_DIR) $(CPE_UPDATES_DIR) $(TOOLS_DIR) \ $(O)/pkg-stats.* .PHONY: distclean diff --git a/package/Makefile.in b/package/Makefile.in index 3e9036b96f..75dd28daa4 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -108,8 +108,9 @@ ifeq ($(BR2_xtensa),y) TARGET_ABI += -mlongcalls -mauto-litpools endif -STAGING_SUBDIR = $(GNU_TARGET_NAME)/sysroot +STAGING_SUBDIR = $(GNU_TARGET_NAME)/sys-root STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR) +SYSROOT_DIR = /$(STAGING_SUBDIR) ifeq ($(BR2_OPTIMIZE_0),y) TARGET_OPTIMIZATION = -O0 -- 2.37.2