mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tools: ynl: Allow cross-compiling ynl and associated tools
The ynl tool and libraries may be built standalone or through the drivers/net/hw selftest machinery. This may target a different arch, so we need to take the CROSS_COMPILE variable into account for LLVM and gcc. Let's include the tools/scripts/Makefile.include that deals with the CC/AR resolution. Fixup the ynltool CFLAGS handling to use +=, so that we don't override the ones set in Makefile.include. Makefile.include also sets the Q variable for verbose mode, so we can drop it from the ynltool Makefile. This will allow properly selection the verbosity of ynltool builds with the V=1 make flag. Reviewed-by: Matthieu Baerts (Netdev Foundation) <matttbe@kernel.org> Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260907161438.755125-2-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
58c3d01c66
commit
917f713b4e
|
|
@ -1,5 +1,6 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
include ../../scripts/Makefile.include
|
||||||
include ../../scripts/Makefile.arch
|
include ../../scripts/Makefile.arch
|
||||||
|
|
||||||
INSTALL ?= install
|
INSTALL ?= install
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
CC=gcc
|
include ../../../scripts/Makefile.include
|
||||||
|
|
||||||
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
||||||
-I../lib/ -idirafter $(UAPI_PATH)
|
-I../lib/ -idirafter $(UAPI_PATH)
|
||||||
ifeq ("$(DEBUG)","1")
|
ifeq ("$(DEBUG)","1")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
CC=gcc
|
include ../../../scripts/Makefile.include
|
||||||
|
|
||||||
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow
|
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow
|
||||||
ifeq ("$(DEBUG)","1")
|
ifeq ("$(DEBUG)","1")
|
||||||
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
|
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# Makefile for YNL tests
|
# Makefile for YNL tests
|
||||||
|
|
||||||
include ../Makefile.deps
|
include ../Makefile.deps
|
||||||
|
include ../../../scripts/Makefile.include
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
CFLAGS += -std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
||||||
-I../lib/ -I../generated/ -I../../../testing/selftests/ \
|
-I../lib/ -I../generated/ -I../../../testing/selftests/ \
|
||||||
-idirafter $(UAPI_PATH)
|
-idirafter $(UAPI_PATH)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
include ../Makefile.deps
|
include ../Makefile.deps
|
||||||
|
include ../../../scripts/Makefile.include
|
||||||
|
|
||||||
INSTALL ?= install
|
INSTALL ?= install
|
||||||
prefix ?= /usr
|
prefix ?= /usr
|
||||||
|
|
||||||
CC := gcc
|
CFLAGS += -Wall -Wextra -Werror -O2
|
||||||
CFLAGS := -Wall -Wextra -Werror -O2
|
|
||||||
ifeq ("$(DEBUG)","1")
|
ifeq ("$(DEBUG)","1")
|
||||||
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
|
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
|
||||||
endif
|
endif
|
||||||
|
|
@ -27,8 +27,6 @@ include $(wildcard *.d)
|
||||||
|
|
||||||
all: $(YNLTOOL)
|
all: $(YNLTOOL)
|
||||||
|
|
||||||
Q = @
|
|
||||||
|
|
||||||
$(YNLTOOL): ../libynl.a $(OBJS)
|
$(YNLTOOL): ../libynl.a $(OBJS)
|
||||||
$(Q)echo -e "\tLINK $@"
|
$(Q)echo -e "\tLINK $@"
|
||||||
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lm
|
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS) ../libynl.a -lm
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user