Skip to content

Commit 214377e

Browse files
committed
samples: watch_queue: 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 <[email protected]>
1 parent 2c6d963 commit 214377e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

samples/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ config SAMPLE_WATCHDOG
211211

212212
config SAMPLE_WATCH_QUEUE
213213
bool "Build example /dev/watch_queue notification consumer"
214-
depends on HEADERS_INSTALL
214+
depends on CC_CAN_LINK && HEADERS_INSTALL
215215
help
216216
Build example userspace program to use the new mount_notify(),
217217
sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function.

samples/watch_queue/Makefile

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

4-
# Tell kbuild to always build the programs
5-
always-y := $(hostprogs)
6-
7-
HOSTCFLAGS_watch_test.o += -I$(objtree)/usr/include
5+
userccflags += -I usr/include

0 commit comments

Comments
 (0)