Skip to content

Commit 82d00a9

Browse files
committed
samples: hidraw: build sample program for target architecture
This userspace program includes UAPI headers exported to usr/include/. 'make headers' always works for the target architecture (i.e. the same architecture as the kernel), so the sample program should be built for the target as well. Kbuild now supports 'userprogs' for that. I also guarded the CONFIG option by 'depends on CC_CAN_LINK' because $(CC) may not provide libc. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 87ecdf4 commit 82d00a9

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎samples/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ config SAMPLE_CONNECTOR
118118

119119
config SAMPLE_HIDRAW
120120
bool "hidraw sample"
121-
depends on HEADERS_INSTALL
121+
depends on CC_CAN_LINK && HEADERS_INSTALL
122122

123123
config SAMPLE_PIDFD
124124
bool "pidfd sample"

‎samples/hidraw/Makefile‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
# List of programs to build
3-
hostprogs := hid-example
4-
always-y := $(hostprogs)
2+
userprogs := hid-example
3+
always-y := $(userprogs)
54

6-
HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include
7-
8-
all: hid-example
5+
userccflags += -I usr/include

0 commit comments

Comments
 (0)