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

TOMOYO Linux Cross Reference
Linux/samples/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 /samples/hid/Makefile (Version linux-6.12-rc7) and /samples/hid/Makefile (Version linux-6.8.12)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2                                                     2 
  3 HID_SAMPLES_PATH ?= $(abspath $(src))          !!   3 HID_SAMPLES_PATH ?= $(abspath $(srctree)/$(src))
  4 TOOLS_PATH := $(HID_SAMPLES_PATH)/../../tools       4 TOOLS_PATH := $(HID_SAMPLES_PATH)/../../tools
  5                                                     5 
  6 pound := \#                                         6 pound := \#
  7                                                     7 
  8 # List of programs to build                         8 # List of programs to build
  9 tprogs-y += hid_mouse                               9 tprogs-y += hid_mouse
 10 tprogs-y += hid_surface_dial                       10 tprogs-y += hid_surface_dial
 11                                                    11 
 12 # Libbpf dependencies                              12 # Libbpf dependencies
 13 LIBBPF_SRC = $(TOOLS_PATH)/lib/bpf                 13 LIBBPF_SRC = $(TOOLS_PATH)/lib/bpf
 14 LIBBPF_OUTPUT = $(abspath $(HID_SAMPLES_PATH))     14 LIBBPF_OUTPUT = $(abspath $(HID_SAMPLES_PATH))/libbpf
 15 LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)                  15 LIBBPF_DESTDIR = $(LIBBPF_OUTPUT)
 16 LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include         16 LIBBPF_INCLUDE = $(LIBBPF_DESTDIR)/include
 17 LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a                 17 LIBBPF = $(LIBBPF_OUTPUT)/libbpf.a
 18                                                    18 
                                                   >>  19 EXTRA_HEADERS := hid_bpf_attach.h
 19 EXTRA_BPF_HEADERS := hid_bpf_helpers.h             20 EXTRA_BPF_HEADERS := hid_bpf_helpers.h
 20                                                    21 
 21 hid_mouse-objs := hid_mouse.o                      22 hid_mouse-objs := hid_mouse.o
 22 hid_surface_dial-objs := hid_surface_dial.o        23 hid_surface_dial-objs := hid_surface_dial.o
 23                                                    24 
 24 # Tell kbuild to always build the programs         25 # Tell kbuild to always build the programs
 25 always-y := $(tprogs-y)                            26 always-y := $(tprogs-y)
 26                                                    27 
 27 ifeq ($(ARCH), arm)                                28 ifeq ($(ARCH), arm)
 28 # Strip all except -D__LINUX_ARM_ARCH__ option     29 # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux
 29 # headers when arm instruction set identificat     30 # headers when arm instruction set identification is requested.
 30 ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_AR     31 ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS))
 31 BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR)           32 BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR)
 32 TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR)              33 TPROGS_CFLAGS += $(ARM_ARCH_SELECTOR)
 33 endif                                              34 endif
 34                                                    35 
 35 ifeq ($(ARCH), mips)                               36 ifeq ($(ARCH), mips)
 36 TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__        37 TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
 37 ifdef CONFIG_MACH_LOONGSON64                       38 ifdef CONFIG_MACH_LOONGSON64
 38 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/inc     39 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-loongson64
 39 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/inc     40 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
 40 endif                                              41 endif
 41 endif                                              42 endif
 42                                                    43 
 43 TPROGS_CFLAGS += -Wall -O2                         44 TPROGS_CFLAGS += -Wall -O2
 44 TPROGS_CFLAGS += -Wmissing-prototypes              45 TPROGS_CFLAGS += -Wmissing-prototypes
 45 TPROGS_CFLAGS += -Wstrict-prototypes               46 TPROGS_CFLAGS += -Wstrict-prototypes
 46                                                    47 
 47 TPROGS_CFLAGS += -I$(objtree)/usr/include          48 TPROGS_CFLAGS += -I$(objtree)/usr/include
 48 TPROGS_CFLAGS += -I$(LIBBPF_INCLUDE)               49 TPROGS_CFLAGS += -I$(LIBBPF_INCLUDE)
 49 TPROGS_CFLAGS += -I$(srctree)/tools/include        50 TPROGS_CFLAGS += -I$(srctree)/tools/include
 50                                                    51 
 51 ifdef SYSROOT                                      52 ifdef SYSROOT
 52 TPROGS_CFLAGS += --sysroot=$(SYSROOT)              53 TPROGS_CFLAGS += --sysroot=$(SYSROOT)
 53 TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib             54 TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib
 54 endif                                              55 endif
 55                                                    56 
 56 TPROGS_LDLIBS                   += $(LIBBPF) -     57 TPROGS_LDLIBS                   += $(LIBBPF) -lelf -lz
 57                                                    58 
 58 # Allows pointing LLC/CLANG to a LLVM backend      59 # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
 59 # make M=samples/bpf LLC=~/git/llvm-project/ll     60 # make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang
 60 LLC ?= llc                                         61 LLC ?= llc
 61 CLANG ?= clang                                     62 CLANG ?= clang
 62 OPT ?= opt                                         63 OPT ?= opt
 63 LLVM_DIS ?= llvm-dis                               64 LLVM_DIS ?= llvm-dis
 64 LLVM_OBJCOPY ?= llvm-objcopy                       65 LLVM_OBJCOPY ?= llvm-objcopy
 65 LLVM_READELF ?= llvm-readelf                       66 LLVM_READELF ?= llvm-readelf
 66 BTF_PAHOLE ?= pahole                               67 BTF_PAHOLE ?= pahole
 67                                                    68 
 68 # Detect that we're cross compiling and use th     69 # Detect that we're cross compiling and use the cross compiler
 69 ifdef CROSS_COMPILE                                70 ifdef CROSS_COMPILE
 70 CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_CO     71 CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%))
 71 endif                                              72 endif
 72                                                    73 
 73 # Don't evaluate probes and warnings if we nee     74 # Don't evaluate probes and warnings if we need to run make recursively
 74 ifneq ($(src),)                                    75 ifneq ($(src),)
 75 HDR_PROBE := $(shell printf "$(pound)include <     76 HDR_PROBE := $(shell printf "$(pound)include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \
 76         $(CC) $(TPROGS_CFLAGS) $(TPROGS_LDFLAG     77         $(CC) $(TPROGS_CFLAGS) $(TPROGS_LDFLAGS) -x c - \
 77         -o /dev/null 2>/dev/null && echo okay)     78         -o /dev/null 2>/dev/null && echo okay)
 78                                                    79 
 79 ifeq ($(HDR_PROBE),)                               80 ifeq ($(HDR_PROBE),)
 80 $(warning WARNING: Detected possible issues wi     81 $(warning WARNING: Detected possible issues with include path.)
 81 $(warning WARNING: Please install kernel heade     82 $(warning WARNING: Please install kernel headers locally (make headers_install).)
 82 endif                                              83 endif
 83                                                    84 
 84 BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -ma     85 BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris)
 85 BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --he     86 BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF)
 86 BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) -     87 BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm')
 87 BTF_LLVM_PROBE := $(shell echo "int main() { r     88 BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \
 88                           $(CLANG) --target=bp     89                           $(CLANG) --target=bpf -O2 -g -c -x c - -o ./llvm_btf_verify.o; \
 89                           $(LLVM_READELF) -S .     90                           $(LLVM_READELF) -S ./llvm_btf_verify.o | grep BTF; \
 90                           /bin/rm -f ./llvm_bt     91                           /bin/rm -f ./llvm_btf_verify.o)
 91                                                    92 
 92 BPF_EXTRA_CFLAGS += -fno-stack-protector           93 BPF_EXTRA_CFLAGS += -fno-stack-protector
 93 ifneq ($(BTF_LLVM_PROBE),)                         94 ifneq ($(BTF_LLVM_PROBE),)
 94         BPF_EXTRA_CFLAGS += -g                     95         BPF_EXTRA_CFLAGS += -g
 95 else                                               96 else
 96 ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PRO     97 ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),)
 97         BPF_EXTRA_CFLAGS += -g                     98         BPF_EXTRA_CFLAGS += -g
 98         LLC_FLAGS += -mattr=dwarfris               99         LLC_FLAGS += -mattr=dwarfris
 99         DWARF2BTF = y                             100         DWARF2BTF = y
100 endif                                             101 endif
101 endif                                             102 endif
102 endif                                             103 endif
103                                                   104 
104 # Trick to allow make to be run from this dire    105 # Trick to allow make to be run from this directory
105 all:                                              106 all:
106         $(MAKE) -C ../../ M=$(CURDIR) HID_SAMP    107         $(MAKE) -C ../../ M=$(CURDIR) HID_SAMPLES_PATH=$(CURDIR)
107                                                   108 
108 clean:                                            109 clean:
109         $(MAKE) -C ../../ M=$(CURDIR) clean       110         $(MAKE) -C ../../ M=$(CURDIR) clean
110         @find $(CURDIR) -type f -name '*~' -de    111         @find $(CURDIR) -type f -name '*~' -delete
111         @$(RM) -r $(CURDIR)/libbpf $(CURDIR)/b    112         @$(RM) -r $(CURDIR)/libbpf $(CURDIR)/bpftool
112                                                   113 
113 $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(L    114 $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUTPUT)
114 # Fix up variables inherited from Kbuild that     115 # Fix up variables inherited from Kbuild that tools/ build system won't like
115         $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' E    116         $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \
116                 LDFLAGS=$(TPROGS_LDFLAGS) srct    117                 LDFLAGS=$(TPROGS_LDFLAGS) srctree=$(HID_SAMPLES_PATH)/../../ \
117                 O= OUTPUT=$(LIBBPF_OUTPUT)/ DE    118                 O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= \
118                 $@ install_headers                119                 $@ install_headers
119                                                   120 
120 BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool           121 BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool
121 BPFTOOL_OUTPUT := $(abspath $(HID_SAMPLES_PATH    122 BPFTOOL_OUTPUT := $(abspath $(HID_SAMPLES_PATH))/bpftool
122 BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool    123 BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
123 $(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(    124 $(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) | $(BPFTOOL_OUTPUT)
124         $(MAKE) -C $(BPFTOOLDIR) srctree=$(HID    125         $(MAKE) -C $(BPFTOOLDIR) srctree=$(HID_SAMPLES_PATH)/../../             \
125                 OUTPUT=$(BPFTOOL_OUTPUT)/ boot    126                 OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap
126                                                   127 
127 $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT):               128 $(LIBBPF_OUTPUT) $(BPFTOOL_OUTPUT):
128         $(call msg,MKDIR,$@)                      129         $(call msg,MKDIR,$@)
129         $(Q)mkdir -p $@                           130         $(Q)mkdir -p $@
130                                                   131 
131 FORCE:                                            132 FORCE:
132                                                   133 
133                                                   134 
134 # Verify LLVM compiler tools are available and    135 # Verify LLVM compiler tools are available and bpf target is supported by llc
135 .PHONY: verify_cmds verify_target_bpf $(CLANG)    136 .PHONY: verify_cmds verify_target_bpf $(CLANG) $(LLC)
136                                                   137 
137 verify_cmds: $(CLANG) $(LLC)                      138 verify_cmds: $(CLANG) $(LLC)
138         @for TOOL in $^ ; do \                    139         @for TOOL in $^ ; do \
139                 if ! (which -- "$${TOOL}" > /d    140                 if ! (which -- "$${TOOL}" > /dev/null 2>&1); then \
140                         echo "*** ERROR: Canno    141                         echo "*** ERROR: Cannot find LLVM tool $${TOOL}" ;\
141                         exit 1; \                 142                         exit 1; \
142                 else true; fi; \                  143                 else true; fi; \
143         done                                      144         done
144                                                   145 
145 verify_target_bpf: verify_cmds                    146 verify_target_bpf: verify_cmds
146         @if ! (${LLC} -march=bpf -mattr=help >    147         @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \
147                 echo "*** ERROR: LLVM (${LLC})    148                 echo "*** ERROR: LLVM (${LLC}) does not support 'bpf' target" ;\
148                 echo "   NOTICE: LLVM version     149                 echo "   NOTICE: LLVM version >= 3.7.1 required" ;\
149                 exit 2; \                         150                 exit 2; \
150         else true; fi                             151         else true; fi
151                                                   152 
152 $(HID_SAMPLES_PATH)/*.c: verify_target_bpf $(L    153 $(HID_SAMPLES_PATH)/*.c: verify_target_bpf $(LIBBPF)
153 $(src)/*.c: verify_target_bpf $(LIBBPF)           154 $(src)/*.c: verify_target_bpf $(LIBBPF)
154                                                   155 
155 libbpf_hdrs: $(LIBBPF)                            156 libbpf_hdrs: $(LIBBPF)
156                                                   157 
157 .PHONY: libbpf_hdrs                               158 .PHONY: libbpf_hdrs
158                                                   159 
159 $(obj)/hid_mouse.o: $(obj)/hid_mouse.skel.h       160 $(obj)/hid_mouse.o: $(obj)/hid_mouse.skel.h
160 $(obj)/hid_surface_dial.o: $(obj)/hid_surface_    161 $(obj)/hid_surface_dial.o: $(obj)/hid_surface_dial.skel.h
161                                                   162 
162 -include $(HID_SAMPLES_PATH)/Makefile.target      163 -include $(HID_SAMPLES_PATH)/Makefile.target
163                                                   164 
164 VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/    165 VMLINUX_BTF_PATHS ?= $(abspath $(if $(O),$(O)/vmlinux))                         \
165                      $(abspath $(if $(KBUILD_O    166                      $(abspath $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)) \
166                      $(abspath ./vmlinux)         167                      $(abspath ./vmlinux)
167 VMLINUX_BTF ?= $(abspath $(firstword $(wildcar    168 VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
168                                                   169 
169 $(obj)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)       170 $(obj)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
170 ifeq ($(VMLINUX_H),)                              171 ifeq ($(VMLINUX_H),)
171 ifeq ($(VMLINUX_BTF),)                            172 ifeq ($(VMLINUX_BTF),)
172         $(error Cannot find a vmlinux for VMLI    173         $(error Cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)",\
173                 build the kernel or set VMLINU    174                 build the kernel or set VMLINUX_BTF or VMLINUX_H variable)
174 endif                                             175 endif
175         $(Q)$(BPFTOOL) btf dump file $(VMLINUX    176         $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
176 else                                              177 else
177         $(Q)cp "$(VMLINUX_H)" $@                  178         $(Q)cp "$(VMLINUX_H)" $@
178 endif                                             179 endif
179                                                   180 
180 clean-files += vmlinux.h                          181 clean-files += vmlinux.h
181                                                   182 
182 # Get Clang's default includes on this system,    183 # Get Clang's default includes on this system, as opposed to those seen by
183 # '--target=bpf'. This fixes "missing" files o    184 # '--target=bpf'. This fixes "missing" files on some architectures/distros,
184 # such as asm/byteorder.h, asm/socket.h, asm/s    185 # such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
185 #                                                 186 #
186 # Use '-idirafter': Don't interfere with inclu    187 # Use '-idirafter': Don't interfere with include mechanics except where the
187 # build would have failed anyways.                188 # build would have failed anyways.
188 define get_sys_includes                           189 define get_sys_includes
189 $(shell $(1) -v -E - </dev/null 2>&1 \            190 $(shell $(1) -v -E - </dev/null 2>&1 \
190         | sed -n '/<...> search starts here:/,    191         | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
191 $(shell $(1) -dM -E - </dev/null | grep '#defi    192 $(shell $(1) -dM -E - </dev/null | grep '#define __riscv_xlen ' | sed 's/#define /-D/' | sed 's/ /=/')
192 endef                                             193 endef
193                                                   194 
194 CLANG_SYS_INCLUDES = $(call get_sys_includes,$    195 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
195                                                   196 
196 EXTRA_BPF_HEADERS_SRC := $(addprefix $(src)/,$    197 EXTRA_BPF_HEADERS_SRC := $(addprefix $(src)/,$(EXTRA_BPF_HEADERS))
197                                                   198 
198 $(obj)/%.bpf.o: $(src)/%.bpf.c $(EXTRA_BPF_HEA    199 $(obj)/%.bpf.o: $(src)/%.bpf.c $(EXTRA_BPF_HEADERS_SRC) $(obj)/vmlinux.h
199         @echo "  CLANG-BPF " $@                   200         @echo "  CLANG-BPF " $@
200         $(Q)$(CLANG) -g -O2 --target=bpf -D__T    201         $(Q)$(CLANG) -g -O2 --target=bpf -D__TARGET_ARCH_$(SRCARCH) \
201                 -Wno-compare-distinct-pointer-    202                 -Wno-compare-distinct-pointer-types -I$(srctree)/include \
202                 -I$(srctree)/samples/bpf -I$(s    203                 -I$(srctree)/samples/bpf -I$(srctree)/tools/include \
203                 -I$(LIBBPF_INCLUDE) $(CLANG_SY    204                 -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES) \
204                 -c $(filter %.bpf.c,$^) -o $@     205                 -c $(filter %.bpf.c,$^) -o $@
205                                                   206 
206 LINKED_SKELS := hid_mouse.skel.h hid_surface_d    207 LINKED_SKELS := hid_mouse.skel.h hid_surface_dial.skel.h
207 clean-files += $(LINKED_SKELS)                    208 clean-files += $(LINKED_SKELS)
208                                                   209 
209 hid_mouse.skel.h-deps := hid_mouse.bpf.o       !! 210 hid_mouse.skel.h-deps := hid_mouse.bpf.o hid_bpf_attach.bpf.o
210 hid_surface_dial.skel.h-deps := hid_surface_di !! 211 hid_surface_dial.skel.h-deps := hid_surface_dial.bpf.o hid_bpf_attach.bpf.o
211                                                   212 
212 LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.bpf.c,    213 LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.bpf.c,$(foreach skel,$(LINKED_SKELS),$($(skel)-deps)))
213                                                   214 
214 BPF_SRCS_LINKED := $(notdir $(wildcard $(src)/    215 BPF_SRCS_LINKED := $(notdir $(wildcard $(src)/*.bpf.c))
215 BPF_OBJS_LINKED := $(patsubst %.bpf.c,$(obj)/%    216 BPF_OBJS_LINKED := $(patsubst %.bpf.c,$(obj)/%.bpf.o, $(BPF_SRCS_LINKED))
216 BPF_SKELS_LINKED := $(addprefix $(obj)/,$(LINK    217 BPF_SKELS_LINKED := $(addprefix $(obj)/,$(LINKED_SKELS))
217                                                   218 
218 $(BPF_SKELS_LINKED): $(BPF_OBJS_LINKED) $(BPFT    219 $(BPF_SKELS_LINKED): $(BPF_OBJS_LINKED) $(BPFTOOL)
219         @echo "  BPF GEN-OBJ " $(@:.skel.h=)      220         @echo "  BPF GEN-OBJ " $(@:.skel.h=)
220         $(Q)$(BPFTOOL) gen object $(@:.skel.h=    221         $(Q)$(BPFTOOL) gen object $(@:.skel.h=.lbpf.o) $(addprefix $(obj)/,$($(@F)-deps))
221         @echo "  BPF GEN-SKEL" $(@:.skel.h=)      222         @echo "  BPF GEN-SKEL" $(@:.skel.h=)
222         $(Q)$(BPFTOOL) gen skeleton $(@:.skel.    223         $(Q)$(BPFTOOL) gen skeleton $(@:.skel.h=.lbpf.o) name $(notdir $(@:.skel.h=)) > $@
223                                                   224 
224 # asm/sysreg.h - inline assembly used by it is    225 # asm/sysreg.h - inline assembly used by it is incompatible with llvm.
225 # But, there is no easy way to fix it, so just    226 # But, there is no easy way to fix it, so just exclude it since it is
226 # useless for BPF samples.                        227 # useless for BPF samples.
227 # below we use long chain of commands, clang |    228 # below we use long chain of commands, clang | opt | llvm-dis | llc,
228 # to generate final object file. 'clang' compi    229 # to generate final object file. 'clang' compiles the source into IR
229 # with native target, e.g., x64, arm64, etc. '    230 # with native target, e.g., x64, arm64, etc. 'opt' does bpf CORE IR builtin
230 # processing (llvm12) and IR optimizations. 'l    231 # processing (llvm12) and IR optimizations. 'llvm-dis' converts
231 # 'opt' output to IR, and finally 'llc' genera    232 # 'opt' output to IR, and finally 'llc' generates bpf byte code.
232 $(obj)/%.o: $(src)/%.c                            233 $(obj)/%.o: $(src)/%.c
233         @echo "  CLANG-bpf " $@                   234         @echo "  CLANG-bpf " $@
234         $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUX    235         $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(BPF_EXTRA_CFLAGS) \
235                 -I$(obj) -I$(srctree)/tools/te    236                 -I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \
236                 -I$(LIBBPF_INCLUDE) \             237                 -I$(LIBBPF_INCLUDE) \
237                 -D__KERNEL__ -D__BPF_TRACING__    238                 -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \
238                 -D__TARGET_ARCH_$(SRCARCH) -Wn    239                 -D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \
239                 -Wno-gnu-variable-sized-type-n    240                 -Wno-gnu-variable-sized-type-not-at-end \
240                 -Wno-address-of-packed-member     241                 -Wno-address-of-packed-member -Wno-tautological-compare \
241                 -Wno-unknown-warning-option $(    242                 -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
242                 -fno-asynchronous-unwind-table    243                 -fno-asynchronous-unwind-tables \
243                 -I$(srctree)/samples/hid/ \       244                 -I$(srctree)/samples/hid/ \
244                 -O2 -emit-llvm -Xclang -disabl    245                 -O2 -emit-llvm -Xclang -disable-llvm-passes -c $< -o - | \
245                 $(OPT) -O2 -mtriple=bpf-pc-lin    246                 $(OPT) -O2 -mtriple=bpf-pc-linux | $(LLVM_DIS) | \
246                 $(LLC) -march=bpf $(LLC_FLAGS)    247                 $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@
247 ifeq ($(DWARF2BTF),y)                             248 ifeq ($(DWARF2BTF),y)
248         $(BTF_PAHOLE) -J $@                       249         $(BTF_PAHOLE) -J $@
249 endif                                             250 endif
                                                      

~ [ 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