~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/hid/Makefile

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/hid/Makefile (Version linux-6.12-rc7) and /tools/testing/selftests/hid/Makefile (Version linux-6.4.16)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 # based on tools/testing/selftest/bpf/Makefile      3 # based on tools/testing/selftest/bpf/Makefile
  4 include ../../../build/Build.include                4 include ../../../build/Build.include
  5 include ../../../scripts/Makefile.arch              5 include ../../../scripts/Makefile.arch
  6 include ../../../scripts/Makefile.include           6 include ../../../scripts/Makefile.include
  7                                                     7 
  8 TEST_PROGS := hid-core.sh                           8 TEST_PROGS := hid-core.sh
  9 TEST_PROGS += hid-apple.sh                          9 TEST_PROGS += hid-apple.sh
 10 TEST_PROGS += hid-gamepad.sh                       10 TEST_PROGS += hid-gamepad.sh
 11 TEST_PROGS += hid-ite.sh                           11 TEST_PROGS += hid-ite.sh
 12 TEST_PROGS += hid-keyboard.sh                      12 TEST_PROGS += hid-keyboard.sh
 13 TEST_PROGS += hid-mouse.sh                         13 TEST_PROGS += hid-mouse.sh
 14 TEST_PROGS += hid-multitouch.sh                    14 TEST_PROGS += hid-multitouch.sh
 15 TEST_PROGS += hid-sony.sh                          15 TEST_PROGS += hid-sony.sh
 16 TEST_PROGS += hid-tablet.sh                        16 TEST_PROGS += hid-tablet.sh
 17 TEST_PROGS += hid-usb_crash.sh                     17 TEST_PROGS += hid-usb_crash.sh
 18 TEST_PROGS += hid-wacom.sh                         18 TEST_PROGS += hid-wacom.sh
 19                                                    19 
 20 TEST_FILES := run-hid-tools-tests.sh           << 
 21 TEST_FILES += tests                            << 
 22                                                << 
 23 CXX ?= $(CROSS_COMPILE)g++                         20 CXX ?= $(CROSS_COMPILE)g++
 24                                                    21 
 25 HOSTPKG_CONFIG := pkg-config                       22 HOSTPKG_CONFIG := pkg-config
 26                                                    23 
 27 CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(O !!  24 CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(KHDR_INCLUDES) -I$(OUTPUT)
 28 CFLAGS += -I$(OUTPUT)/tools/include            << 
 29                                                << 
 30 LDLIBS += -lelf -lz -lrt -lpthread                 25 LDLIBS += -lelf -lz -lrt -lpthread
 31                                                    26 
 32 # Silence some warnings when compiled with cla     27 # Silence some warnings when compiled with clang
 33 ifneq ($(LLVM),)                                   28 ifneq ($(LLVM),)
 34 CFLAGS += -Wno-unused-command-line-argument        29 CFLAGS += -Wno-unused-command-line-argument
 35 endif                                              30 endif
 36                                                    31 
 37 # Order correspond to 'make run_tests' order       32 # Order correspond to 'make run_tests' order
 38 TEST_GEN_PROGS = hid_bpf hidraw                !!  33 TEST_GEN_PROGS = hid_bpf
 39                                                    34 
 40 # Emit succinct information message describing     35 # Emit succinct information message describing current building step
 41 # $1 - generic step name (e.g., CC, LINK, etc)     36 # $1 - generic step name (e.g., CC, LINK, etc);
 42 # $2 - optional "flavor" specifier; if provide     37 # $2 - optional "flavor" specifier; if provided, will be emitted as [flavor];
 43 # $3 - target (assumed to be file); only file      38 # $3 - target (assumed to be file); only file name will be emitted;
 44 # $4 - optional extra arg, emitted as-is, if p     39 # $4 - optional extra arg, emitted as-is, if provided.
 45 ifeq ($(V),1)                                      40 ifeq ($(V),1)
 46 Q =                                                41 Q =
 47 msg =                                              42 msg =
 48 else                                               43 else
 49 Q = @                                              44 Q = @
 50 msg = @printf '  %-8s%s %s%s\n' "$(1)" "$(if $     45 msg = @printf '  %-8s%s %s%s\n' "$(1)" "$(if $(2), [$(2)])" "$(notdir $(3))" "$(if $(4), $(4))";
 51 MAKEFLAGS += --no-print-directory                  46 MAKEFLAGS += --no-print-directory
 52 submake_extras := feature_display=0                47 submake_extras := feature_display=0
 53 endif                                              48 endif
 54                                                    49 
 55 # override lib.mk's default rules                  50 # override lib.mk's default rules
 56 OVERRIDE_TARGETS := 1                              51 OVERRIDE_TARGETS := 1
 57 override define CLEAN                              52 override define CLEAN
 58         $(call msg,CLEAN)                          53         $(call msg,CLEAN)
 59         $(Q)$(RM) -r $(TEST_GEN_PROGS)             54         $(Q)$(RM) -r $(TEST_GEN_PROGS)
 60         $(Q)$(RM) -r $(EXTRA_CLEAN)                55         $(Q)$(RM) -r $(EXTRA_CLEAN)
 61 endef                                              56 endef
 62                                                    57 
 63 include ../lib.mk                                  58 include ../lib.mk
 64                                                    59 
 65 TOOLSDIR := $(top_srcdir)/tools                    60 TOOLSDIR := $(top_srcdir)/tools
 66 LIBDIR := $(TOOLSDIR)/lib                          61 LIBDIR := $(TOOLSDIR)/lib
 67 BPFDIR := $(LIBDIR)/bpf                            62 BPFDIR := $(LIBDIR)/bpf
 68 TOOLSINCDIR := $(TOOLSDIR)/include                 63 TOOLSINCDIR := $(TOOLSDIR)/include
 69 BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool              64 BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
 70 SCRATCH_DIR := $(OUTPUT)/tools                     65 SCRATCH_DIR := $(OUTPUT)/tools
 71 BUILD_DIR := $(SCRATCH_DIR)/build                  66 BUILD_DIR := $(SCRATCH_DIR)/build
 72 INCLUDE_DIR := $(SCRATCH_DIR)/include              67 INCLUDE_DIR := $(SCRATCH_DIR)/include
                                                   >>  68 KHDR_INCLUDES := $(SCRATCH_DIR)/uapi/include
 73 BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a             69 BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
 74 ifneq ($(CROSS_COMPILE),)                          70 ifneq ($(CROSS_COMPILE),)
 75 HOST_BUILD_DIR          := $(BUILD_DIR)/host       71 HOST_BUILD_DIR          := $(BUILD_DIR)/host
 76 HOST_SCRATCH_DIR        := $(OUTPUT)/host-tool     72 HOST_SCRATCH_DIR        := $(OUTPUT)/host-tools
 77 HOST_INCLUDE_DIR        := $(HOST_SCRATCH_DIR)     73 HOST_INCLUDE_DIR        := $(HOST_SCRATCH_DIR)/include
 78 else                                               74 else
 79 HOST_BUILD_DIR          := $(BUILD_DIR)            75 HOST_BUILD_DIR          := $(BUILD_DIR)
 80 HOST_SCRATCH_DIR        := $(SCRATCH_DIR)          76 HOST_SCRATCH_DIR        := $(SCRATCH_DIR)
 81 HOST_INCLUDE_DIR        := $(INCLUDE_DIR)          77 HOST_INCLUDE_DIR        := $(INCLUDE_DIR)
 82 endif                                              78 endif
 83 HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf     79 HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf.a
 84 RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_bt     80 RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_btfids/resolve_btfids
 85                                                    81 
 86 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)       82 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)                            \
 87                      $(if $(KBUILD_OUTPUT),$(K     83                      $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)    \
 88                      ../../../../vmlinux           84                      ../../../../vmlinux                                \
 89                      /sys/kernel/btf/vmlinux       85                      /sys/kernel/btf/vmlinux                            \
 90                      /boot/vmlinux-$(shell una     86                      /boot/vmlinux-$(shell uname -r)
 91 VMLINUX_BTF ?= $(abspath $(firstword $(wildcar     87 VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
 92 ifeq ($(VMLINUX_BTF),)                             88 ifeq ($(VMLINUX_BTF),)
 93 $(error Cannot find a vmlinux for VMLINUX_BTF      89 $(error Cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)")
 94 endif                                              90 endif
 95                                                    91 
 96 # Define simple and short `make test_progs`, `     92 # Define simple and short `make test_progs`, `make test_sysctl`, etc targets
 97 # to build individual tests.                       93 # to build individual tests.
 98 # NOTE: Semicolon at the end is critical to ov     94 # NOTE: Semicolon at the end is critical to override lib.mk's default static
 99 # rule for binaries.                               95 # rule for binaries.
100 $(notdir $(TEST_GEN_PROGS)): %: $(OUTPUT)/% ;      96 $(notdir $(TEST_GEN_PROGS)): %: $(OUTPUT)/% ;
101                                                    97 
102 # sort removes libbpf duplicates when not cros     98 # sort removes libbpf duplicates when not cross-building
103 MAKE_DIRS := $(sort $(BUILD_DIR)/libbpf $(HOST     99 MAKE_DIRS := $(sort $(BUILD_DIR)/libbpf $(HOST_BUILD_DIR)/libbpf                \
104                $(HOST_BUILD_DIR)/bpftool $(HOS    100                $(HOST_BUILD_DIR)/bpftool $(HOST_BUILD_DIR)/resolve_btfids       \
105                $(INCLUDE_DIR))                    101                $(INCLUDE_DIR))
106 $(MAKE_DIRS):                                     102 $(MAKE_DIRS):
107         $(call msg,MKDIR,,$@)                     103         $(call msg,MKDIR,,$@)
108         $(Q)mkdir -p $@                           104         $(Q)mkdir -p $@
109                                                   105 
110 # LLVM's ld.lld doesn't support all the archit    106 # LLVM's ld.lld doesn't support all the architectures, so use it only on x86
111 ifeq ($(SRCARCH),x86)                             107 ifeq ($(SRCARCH),x86)
112 LLD := lld                                        108 LLD := lld
113 else                                              109 else
114 LLD := ld                                         110 LLD := ld
115 endif                                             111 endif
116                                                   112 
117 DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bp    113 DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
118                                                   114 
119 TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL)     115 TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPFTOOL)
120                                                   116 
121 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED):     117 $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(BPFOBJ)
122                                                   118 
123 BPFTOOL ?= $(DEFAULT_BPFTOOL)                     119 BPFTOOL ?= $(DEFAULT_BPFTOOL)
124 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*    120 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
125                     $(HOST_BPFOBJ) | $(HOST_BU    121                     $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
126         $(Q)$(MAKE) $(submake_extras)  -C $(BP    122         $(Q)$(MAKE) $(submake_extras)  -C $(BPFTOOLDIR)                        \
127                     ARCH= CROSS_COMPILE= CC=$(    123                     ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD)             \
128                     EXTRA_CFLAGS='-g -O0'         124                     EXTRA_CFLAGS='-g -O0'                                      \
129                     OUTPUT=$(HOST_BUILD_DIR)/b    125                     OUTPUT=$(HOST_BUILD_DIR)/bpftool/                          \
130                     LIBBPF_OUTPUT=$(HOST_BUILD    126                     LIBBPF_OUTPUT=$(HOST_BUILD_DIR)/libbpf/                    \
131                     LIBBPF_DESTDIR=$(HOST_SCRA    127                     LIBBPF_DESTDIR=$(HOST_SCRATCH_DIR)/                        \
132                     prefix= DESTDIR=$(HOST_SCR    128                     prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install-bin
133                                                   129 
134 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDI    130 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)                     \
135            | $(BUILD_DIR)/libbpf                  131            | $(BUILD_DIR)/libbpf
136         $(Q)$(MAKE) $(submake_extras) -C $(BPF    132         $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
137                     EXTRA_CFLAGS='-g -O0'         133                     EXTRA_CFLAGS='-g -O0'                                      \
138                     DESTDIR=$(SCRATCH_DIR) pre    134                     DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
139                                                   135 
140 ifneq ($(BPFOBJ),$(HOST_BPFOBJ))                  136 ifneq ($(BPFOBJ),$(HOST_BPFOBJ))
141 $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(    137 $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)                \
142                 | $(HOST_BUILD_DIR)/libbpf        138                 | $(HOST_BUILD_DIR)/libbpf
143         $(Q)$(MAKE) $(submake_extras) -C $(BPF    139         $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR)                             \
144                     EXTRA_CFLAGS='-g -O0' ARCH    140                     EXTRA_CFLAGS='-g -O0' ARCH= CROSS_COMPILE=                 \
145                     OUTPUT=$(HOST_BUILD_DIR)/l    141                     OUTPUT=$(HOST_BUILD_DIR)/libbpf/ CC=$(HOSTCC) LD=$(HOSTLD) \
146                     DESTDIR=$(HOST_SCRATCH_DIR    142                     DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
147 endif                                             143 endif
148                                                   144 
149 $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPF    145 $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)
150 ifeq ($(VMLINUX_H),)                              146 ifeq ($(VMLINUX_H),)
151         $(call msg,GEN,,$@)                       147         $(call msg,GEN,,$@)
152         $(Q)$(BPFTOOL) btf dump file $(VMLINUX    148         $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
153 else                                              149 else
154         $(call msg,CP,,$@)                        150         $(call msg,CP,,$@)
155         $(Q)cp "$(VMLINUX_H)" $@                  151         $(Q)cp "$(VMLINUX_H)" $@
156 endif                                             152 endif
157                                                   153 
                                                   >> 154 $(KHDR_INCLUDES)/linux/hid.h: $(top_srcdir)/include/uapi/linux/hid.h
                                                   >> 155         $(MAKE) -C $(top_srcdir) INSTALL_HDR_PATH=$(SCRATCH_DIR)/uapi headers_install
                                                   >> 156 
158 $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUI    157 $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids    \
159                        $(TOOLSDIR)/bpf/resolve    158                        $(TOOLSDIR)/bpf/resolve_btfids/main.c    \
160                        $(TOOLSDIR)/lib/rbtree.    159                        $(TOOLSDIR)/lib/rbtree.c                 \
161                        $(TOOLSDIR)/lib/zalloc.    160                        $(TOOLSDIR)/lib/zalloc.c                 \
162                        $(TOOLSDIR)/lib/string.    161                        $(TOOLSDIR)/lib/string.c                 \
163                        $(TOOLSDIR)/lib/ctype.c    162                        $(TOOLSDIR)/lib/ctype.c                  \
164                        $(TOOLSDIR)/lib/str_err    163                        $(TOOLSDIR)/lib/str_error_r.c
165         $(Q)$(MAKE) $(submake_extras) -C $(TOO    164         $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/resolve_btfids \
166                 CC=$(HOSTCC) LD=$(HOSTLD) AR=$    165                 CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) \
167                 LIBBPF_INCLUDE=$(HOST_INCLUDE_    166                 LIBBPF_INCLUDE=$(HOST_INCLUDE_DIR) \
168                 OUTPUT=$(HOST_BUILD_DIR)/resol    167                 OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)
169                                                   168 
170 # Get Clang's default includes on this system,    169 # Get Clang's default includes on this system, as opposed to those seen by
171 # '--target=bpf'. This fixes "missing" files o !! 170 # '-target bpf'. This fixes "missing" files on some architectures/distros,
172 # such as asm/byteorder.h, asm/socket.h, asm/s    171 # such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
173 #                                                 172 #
174 # Use '-idirafter': Don't interfere with inclu    173 # Use '-idirafter': Don't interfere with include mechanics except where the
175 # build would have failed anyways.                174 # build would have failed anyways.
176 define get_sys_includes                           175 define get_sys_includes
177 $(shell $(1) -v -E - </dev/null 2>&1 \            176 $(shell $(1) -v -E - </dev/null 2>&1 \
178         | sed -n '/<...> search starts here:/,    177         | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
179 $(shell $(1) -dM -E - </dev/null | grep '__ris    178 $(shell $(1) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
180 endef                                             179 endef
181                                                   180 
182 # Determine target endianness.                    181 # Determine target endianness.
183 IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </de    182 IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
184                         grep 'define __BYTE_OR    183                         grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
185 MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endi    184 MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
186                                                   185 
187 CLANG_SYS_INCLUDES = $(call get_sys_includes,$    186 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
188 BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCA    187 BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN)           \
189              -I$(INCLUDE_DIR)                     188              -I$(INCLUDE_DIR)
190                                                   189 
191 CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \            190 CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \
192                -Wno-compare-distinct-pointer-t    191                -Wno-compare-distinct-pointer-types
193                                                   192 
194 # Build BPF object using Clang                    193 # Build BPF object using Clang
195 # $1 - input .c file                              194 # $1 - input .c file
196 # $2 - output .o file                             195 # $2 - output .o file
197 # $3 - CFLAGS                                     196 # $3 - CFLAGS
198 define CLANG_BPF_BUILD_RULE                       197 define CLANG_BPF_BUILD_RULE
199         $(call msg,CLNG-BPF,$(TRUNNER_BINARY),    198         $(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
200         $(Q)$(CLANG) $3 -O2 --target=bpf -c $1 !! 199         $(Q)$(CLANG) $3 -O2 -target bpf -c $1 -mcpu=v3 -o $2
201 endef                                             200 endef
202 # Similar to CLANG_BPF_BUILD_RULE, but with di    201 # Similar to CLANG_BPF_BUILD_RULE, but with disabled alu32
203 define CLANG_NOALU32_BPF_BUILD_RULE               202 define CLANG_NOALU32_BPF_BUILD_RULE
204         $(call msg,CLNG-BPF,$(TRUNNER_BINARY),    203         $(call msg,CLNG-BPF,$(TRUNNER_BINARY),$2)
205         $(Q)$(CLANG) $3 -O2 --target=bpf -c $1 !! 204         $(Q)$(CLANG) $3 -O2 -target bpf -c $1 -mcpu=v2 -o $2
206 endef                                             205 endef
207 # Build BPF object using GCC                      206 # Build BPF object using GCC
208 define GCC_BPF_BUILD_RULE                         207 define GCC_BPF_BUILD_RULE
209         $(call msg,GCC-BPF,$(TRUNNER_BINARY),$    208         $(call msg,GCC-BPF,$(TRUNNER_BINARY),$2)
210         $(Q)$(BPF_GCC) $3 -O2 -c $1 -o $2         209         $(Q)$(BPF_GCC) $3 -O2 -c $1 -o $2
211 endef                                             210 endef
212                                                   211 
213 BPF_PROGS_DIR := progs                            212 BPF_PROGS_DIR := progs
214 BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE            213 BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE
215 BPF_SRCS := $(notdir $(wildcard $(BPF_PROGS_DI    214 BPF_SRCS := $(notdir $(wildcard $(BPF_PROGS_DIR)/*.c))
216 BPF_OBJS := $(patsubst %.c,$(OUTPUT)/%.bpf.o,     215 BPF_OBJS := $(patsubst %.c,$(OUTPUT)/%.bpf.o, $(BPF_SRCS))
217 BPF_SKELS := $(patsubst %.c,$(OUTPUT)/%.skel.h    216 BPF_SKELS := $(patsubst %.c,$(OUTPUT)/%.skel.h, $(BPF_SRCS))
218 TEST_GEN_FILES += $(BPF_OBJS)                     217 TEST_GEN_FILES += $(BPF_OBJS)
219                                                   218 
220 $(BPF_PROGS_DIR)-bpfobjs := y                     219 $(BPF_PROGS_DIR)-bpfobjs := y
221 $(BPF_OBJS): $(OUTPUT)/%.bpf.o:                   220 $(BPF_OBJS): $(OUTPUT)/%.bpf.o:                         \
222              $(BPF_PROGS_DIR)/%.c                 221              $(BPF_PROGS_DIR)/%.c                       \
223              $(wildcard $(BPF_PROGS_DIR)/*.h)     222              $(wildcard $(BPF_PROGS_DIR)/*.h)           \
224              $(INCLUDE_DIR)/vmlinux.h             223              $(INCLUDE_DIR)/vmlinux.h                           \
225              $(wildcard $(BPFDIR)/hid_bpf_*.h)    224              $(wildcard $(BPFDIR)/hid_bpf_*.h)                  \
226              $(wildcard $(BPFDIR)/*.bpf.h)        225              $(wildcard $(BPFDIR)/*.bpf.h)                      \
227              | $(OUTPUT) $(BPFOBJ)                226              | $(OUTPUT) $(BPFOBJ)
228         $(call $(BPF_BUILD_RULE),$<,$@, $(BPF_    227         $(call $(BPF_BUILD_RULE),$<,$@, $(BPF_CFLAGS))
229                                                   228 
230 $(BPF_SKELS): %.skel.h: %.bpf.o $(BPFTOOL) | $    229 $(BPF_SKELS): %.skel.h: %.bpf.o $(BPFTOOL) | $(OUTPUT)
231         $(call msg,GEN-SKEL,$(BINARY),$@)         230         $(call msg,GEN-SKEL,$(BINARY),$@)
232         $(Q)$(BPFTOOL) gen object $(<:.o=.link    231         $(Q)$(BPFTOOL) gen object $(<:.o=.linked1.o) $<
233         $(Q)$(BPFTOOL) gen skeleton $(<:.o=.li    232         $(Q)$(BPFTOOL) gen skeleton $(<:.o=.linked1.o) name $(notdir $(<:.bpf.o=)) > $@
234                                                   233 
235 $(OUTPUT)/%.o: %.c $(BPF_SKELS)                !! 234 $(OUTPUT)/%.o: %.c $(BPF_SKELS) $(KHDR_INCLUDES)/linux/hid.h
236         $(call msg,CC,,$@)                        235         $(call msg,CC,,$@)
237         $(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^    236         $(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
238                                                   237 
239 $(OUTPUT)/%: $(OUTPUT)/%.o                        238 $(OUTPUT)/%: $(OUTPUT)/%.o
240         $(call msg,BINARY,,$@)                    239         $(call msg,BINARY,,$@)
241         $(Q)$(LINK.c) $^ $(LDLIBS) -o $@          240         $(Q)$(LINK.c) $^ $(LDLIBS) -o $@
242                                                   241 
243 EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_D    242 EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) feature bpftool       \
244         $(addprefix $(OUTPUT)/,*.o *.skel.h no    243         $(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32)
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php