From: Olivier Houchard Date: Thu, 17 Sep 2026 09:18:48 +0000 (+0200) Subject: MINOR: makefile: add CROSS_TOOLCHAIN to prefix the target's tools X-Git-Tag: v3.5-dev9~230 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=refs%2Fheads%2F20261001-oho-debug-syms;p=haproxy.git MINOR: makefile: add CROSS_TOOLCHAIN to prefix the target's tools Cross-building also needs the target's nm, objcopy and readelf, since the host ones do not know a foreign object. Instead of setting each one, CROSS_TOOLCHAIN=arm-linux-gnueabi- prefixes them all, giving arm-linux- gnueabi-gcc, -nm and so on. Empty by default. --- diff --git a/Makefile b/Makefile index a968f26d9..c20ed3005 100644 --- a/Makefile +++ b/Makefile @@ -181,11 +181,15 @@ $(call $(complain),the "ARCH" variable was forced to "$(ARCH)" but is no \ endif #### Toolchain options. -CC = cc +# CROSS_TOOLCHAIN is an optional prefix for the target's tools, e.g. +# CROSS_TOOLCHAIN=arm-linux-gnueabi- for arm-linux-gnueabi-gcc, -nm, etc. +CROSS_TOOLCHAIN = +CC = $(if $(CROSS_TOOLCHAIN),$(CROSS_TOOLCHAIN)gcc,cc) LD = $(CC) -NM = nm -OBJCOPY = objcopy -READELF = readelf +NM = $(CROSS_TOOLCHAIN)nm +OBJCOPY = $(CROSS_TOOLCHAIN)objcopy +OBJDUMP = $(CROSS_TOOLCHAIN)objdump +READELF = $(CROSS_TOOLCHAIN)readelf XZ = xz #### Default optimizations @@ -1121,7 +1125,7 @@ ifneq ($(USE_MINIDEBUG:0=),) endif objsize: haproxy - $(Q)objdump -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort + $(Q)$(OBJDUMP) -t $^|grep ' g '|grep -F '.text'|awk '{print $$5 FS $$6}'|sort %.o: %.c $(DEP) $(cmd_CC) $(COPTS) -c -o $@ $<