Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

samples: uhid: 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.

Add the entry to samples/Makefile to put this into the build bot
coverage.

I also added the CONFIG option guarded 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>

+12 -6
+6
samples/Kconfig
··· 131 131 Build samples of seccomp filters using various methods of 132 132 BPF filter construction. 133 133 134 + config SAMPLE_UHID 135 + bool "UHID sample" 136 + depends on CC_CAN_LINK && HEADERS_INSTALL 137 + help 138 + Build UHID sample program. 139 + 134 140 config SAMPLE_VFIO_MDEV_MTTY 135 141 tristate "Build VFIO mtty example mediated device sample code -- loadable modules only" 136 142 depends on VFIO_MDEV_DEVICE && m
+1
samples/Makefile
··· 19 19 obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/ 20 20 obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace/ 21 21 obj-$(CONFIG_SAMPLE_TRACE_ARRAY) += ftrace/ 22 + subdir-$(CONFIG_SAMPLE_UHID) += uhid 22 23 obj-$(CONFIG_VIDEO_PCI_SKELETON) += v4l/ 23 24 obj-y += vfio-mdev/ 24 25 subdir-$(CONFIG_SAMPLE_VFS) += vfs
+2
samples/uhid/.gitignore
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + /uhid-example
+3 -6
samples/uhid/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - # List of programs to build 3 - hostprogs := uhid-example 2 + userprogs := uhid-example 3 + always-y := $(userprogs) 4 4 5 - # Tell kbuild to always build the programs 6 - always-y := $(hostprogs) 7 - 8 - HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include 5 + userccflags += -I usr/include