Skip to content

Commit 3d71786

Browse files
committed
build: move STAGING_DIR_HOSTPKG and BUILD_DIR_HOST back to a common directory for all targets
Using a single host package staging dir (and build dir) significantly speeds up builds when multiple targets are built in succession, especially for large host packages like NodeJS. $(STAGING_DIR)/host is kept in addition to $(STAGING_DIR_HOSTPKG) in most places; it is still used as destination for host files in Build/InstallDev. Signed-off-by: Matthias Schiffer <[email protected]>
1 parent 5f7a081 commit 3d71786

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ clean: FORCE
5555
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
5656

5757
dirclean: clean
58-
rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
58+
rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
5959
rm -rf $(TMP_DIR)
6060

6161
ifndef DUMP_TARGET_DB

include/autotools.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ define autoreconf_target
7575
$(strip $(call autoreconf, \
7676
$(PKG_BUILD_DIR), $(PKG_REMOVE_FILES), \
7777
$(PKG_AUTOMAKE_PATHS), $(PKG_LIBTOOL_PATHS), \
78-
$(STAGING_DIR)/host/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
78+
$(STAGING_DIR)/host/share/aclocal $(STAGING_DIR_HOSTPKG)/share/aclocal $(STAGING_DIR)/usr/share/aclocal $(PKG_MACRO_PATHS)))
7979
endef
8080

8181
define patch_libtool_target

include/cmake.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
3434
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
3535

3636
CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
37-
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOST)
37+
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
3838
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
3939

4040
define Build/Configure/Default

include/host-build.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),)
122122
endif
123123

124124
define Host/Exports/Default
125-
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-* $(if $(IS_PACKAGE_BUILD),$$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*)),-I $$(p))
125+
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-* $(if $(IS_PACKAGE_BUILD),$$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*)),-I $$(p))
126126
$(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
127127
$(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
128128
$(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig

include/package.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ifdef USE_SOURCE_DIR
130130
endif
131131

132132
define Build/Exports/Default
133-
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
133+
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
134134
$(1) : export STAGING_PREFIX=$$(STAGING_DIR)/usr
135135
$(1) : export PATH=$$(TARGET_PATH_PKG)
136136
$(1) : export CONFIG_SITE:=$$(CONFIG_SITE)

rules.mk

+5-5
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ STAGING_DIR_ROOT:=$(STAGING_DIR)/root-$(BOARD)
145145
BUILD_LOG_DIR:=$(TOPDIR)/logs
146146
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
147147

148-
BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR)/host,$(BUILD_DIR_BASE)/host)
148+
BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR_BASE)/hostpkg,$(BUILD_DIR_BASE)/host)
149149
STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host
150-
STAGING_DIR_HOSTPKG:=$(STAGING_DIR)/host
150+
STAGING_DIR_HOSTPKG:=$(TOPDIR)/staging_dir/hostpkg
151151

152152
TARGET_PATH:=$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH)))))
153153
TARGET_INIT_PATH:=$(call qstrip,$(CONFIG_TARGET_INIT_PATH))
@@ -206,7 +206,7 @@ ifndef DUMP
206206
endif
207207
endif
208208
endif
209-
TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(TARGET_PATH)
209+
TARGET_PATH_PKG:=$(STAGING_DIR)/host/bin:$(STAGING_DIR_HOSTPKG)/bin:$(TARGET_PATH)
210210

211211
ifeq ($(CONFIG_SOFT_FLOAT),y)
212212
SOFT_FLOAT_CONFIG_OPTION:=--with-float=soft
@@ -232,9 +232,9 @@ export PKG_CONFIG
232232

233233
HOSTCC:=gcc
234234
HOSTCXX:=g++
235-
HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR)/host/include)
235+
HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include -I$(STAGING_DIR_HOST)/usr/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
236236
HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
237-
HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR)/host/lib)
237+
HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib -L$(STAGING_DIR_HOST)/usr/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib)
238238

239239
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
240240
TARGET_AR:=$(TARGET_CROSS)gcc-ar

0 commit comments

Comments
 (0)