Skip to content

Commit 987458c

Browse files
committed
rules.mk: make toolchain dirs define more consistent
Make toolchain dirs define more consistent between internal and external toolchains. Make use of specific dirs also for intenral toolchain and generilize include and lib inclusion. Also set TOOLCHAIN_ROOT_DIR for internal toolchain as this is what packages should use to reference staging toolchain directory. Signed-off-by: Christian Marangi <[email protected]>
1 parent 28420cd commit 987458c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

rules.mk

+14-14
Original file line numberDiff line numberDiff line change
@@ -184,32 +184,32 @@ ifndef DUMP
184184
-include $(TOOLCHAIN_DIR)/info.mk
185185
export GCC_HONOUR_COPTS:=0
186186
TARGET_CROSS:=$(if $(TARGET_CROSS),$(TARGET_CROSS),$(OPTIMIZE_FOR_CPU)-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX))-)
187+
TOOLCHAIN_ROOT_DIR:=$(TOPDIR)/staging_dir/$(TOOLCHAIN_DIR_NAME)
188+
TOOLCHAIN_BIN_DIRS:=$(TOOLCHAIN_ROOT_DIR)/bin
189+
TOOLCHAIN_INC_DIRS:=$(TOOLCHAIN_ROOT_DIR)/usr/include $(TOOLCHAIN_ROOT_DIR)/include
190+
TOOLCHAIN_LIB_DIRS:=$(TOOLCHAIN_ROOT_DIR)/usr/lib $(TOOLCHAIN_ROOT_DIR)/lib
187191
TARGET_CFLAGS+= -fhonour-copts
188-
TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/usr/include
189192
ifeq ($(CONFIG_USE_MUSL),y)
190-
TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include/fortify
193+
TOOLCHAIN_INC_DIRS+= $(TOOLCHAIN_DIR)/include/fortify
191194
endif
192-
TARGET_CPPFLAGS+= -I$(TOOLCHAIN_DIR)/include
193-
TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib
194-
TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH)
195195
else
196196
ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
197197
TARGET_CROSS:=$(call qstrip,$(CONFIG_TOOLCHAIN_PREFIX))
198198
TOOLCHAIN_ROOT_DIR:=$(call qstrip,$(CONFIG_TOOLCHAIN_ROOT))
199199
TOOLCHAIN_BIN_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_BIN_PATH)))
200200
TOOLCHAIN_INC_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_INC_PATH)))
201201
TOOLCHAIN_LIB_DIRS:=$(patsubst ./%,$(TOOLCHAIN_ROOT_DIR)/%,$(call qstrip,$(CONFIG_TOOLCHAIN_LIB_PATH)))
202-
ifneq ($(TOOLCHAIN_BIN_DIRS),)
203-
TARGET_PATH:=$(subst $(space),:,$(TOOLCHAIN_BIN_DIRS)):$(TARGET_PATH)
204-
endif
205-
ifneq ($(TOOLCHAIN_INC_DIRS),)
206-
TARGET_CPPFLAGS+= $(patsubst %,-I%,$(TOOLCHAIN_INC_DIRS))
207-
endif
208-
ifneq ($(TOOLCHAIN_LIB_DIRS),)
209-
TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS))
210-
endif
211202
endif
212203
endif
204+
ifneq ($(TOOLCHAIN_BIN_DIRS),)
205+
TARGET_PATH:=$(subst $(space),:,$(TOOLCHAIN_BIN_DIRS)):$(TARGET_PATH)
206+
endif
207+
ifneq ($(TOOLCHAIN_INC_DIRS),)
208+
TARGET_CPPFLAGS+= $(patsubst %,-I%,$(TOOLCHAIN_INC_DIRS))
209+
endif
210+
ifneq ($(TOOLCHAIN_LIB_DIRS),)
211+
TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS))
212+
endif
213213
endif
214214

215215
TARGET_LINKER?=bfd

0 commit comments

Comments
 (0)