samples: timers: use 'userprogs' syntax
Kbuild now supports the 'userprogs' syntax to compile userspace programs for the same architecture as the kernel. 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>
This commit is contained in:
parent
87ffbba9a9
commit
b98ccc7150
|
@ -135,6 +135,10 @@ config SAMPLE_SECCOMP
|
||||||
Build samples of seccomp filters using various methods of
|
Build samples of seccomp filters using various methods of
|
||||||
BPF filter construction.
|
BPF filter construction.
|
||||||
|
|
||||||
|
config SAMPLE_TIMER
|
||||||
|
bool "Timer sample"
|
||||||
|
depends on CC_CAN_LINK && HEADERS_INSTALL
|
||||||
|
|
||||||
config SAMPLE_UHID
|
config SAMPLE_UHID
|
||||||
bool "UHID sample"
|
bool "UHID sample"
|
||||||
depends on CC_CAN_LINK && HEADERS_INSTALL
|
depends on CC_CAN_LINK && HEADERS_INSTALL
|
||||||
|
|
|
@ -16,6 +16,7 @@ subdir-$(CONFIG_SAMPLE_PIDFD) += pidfd
|
||||||
obj-$(CONFIG_SAMPLE_QMI_CLIENT) += qmi/
|
obj-$(CONFIG_SAMPLE_QMI_CLIENT) += qmi/
|
||||||
obj-$(CONFIG_SAMPLE_RPMSG_CLIENT) += rpmsg/
|
obj-$(CONFIG_SAMPLE_RPMSG_CLIENT) += rpmsg/
|
||||||
subdir-$(CONFIG_SAMPLE_SECCOMP) += seccomp
|
subdir-$(CONFIG_SAMPLE_SECCOMP) += seccomp
|
||||||
|
subdir-$(CONFIG_SAMPLE_TIMER) += timers
|
||||||
obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace_events/
|
obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace_events/
|
||||||
obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/
|
obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/
|
||||||
obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace/
|
obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace/
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
ifndef CROSS_COMPILE
|
userprogs := hpet_example
|
||||||
uname_M := $(shell uname -m 2>/dev/null || echo not)
|
always-y := $(userprogs)
|
||||||
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
|
|
||||||
|
|
||||||
ifeq ($(ARCH),x86)
|
userccflags += -I usr/include
|
||||||
CC := $(CROSS_COMPILE)gcc
|
|
||||||
PROGS := hpet_example
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -fr $(PROGS)
|
|
||||||
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
Loading…
Reference in New Issue