]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - samples/bpf/Makefile
samples: bpf: add bpf_perf_event_output example
[mirror_ubuntu-artful-kernel.git] / samples / bpf / Makefile
CommitLineData
3c731eba
AS
1# kbuild trick to avoid linker error. Can be omitted if a module is built.
2obj- := dummy.o
3
4# List of programs to build
ffb65f27 5hostprogs-y := test_verifier test_maps
03f4723e 6hostprogs-y += sock_example
a8085782 7hostprogs-y += sockex1
fbe33108 8hostprogs-y += sockex2
530b2c86 9hostprogs-y += sockex3
b896c4f9 10hostprogs-y += tracex1
d822a192 11hostprogs-y += tracex2
5c7fc2d2 12hostprogs-y += tracex3
9811e353 13hostprogs-y += tracex4
5bacd780 14hostprogs-y += tracex5
47efb302 15hostprogs-y += tracex6
39111695 16hostprogs-y += trace_output
0fb1170e 17hostprogs-y += lathist
3c731eba
AS
18
19test_verifier-objs := test_verifier.o libbpf.o
ffb65f27 20test_maps-objs := test_maps.o libbpf.o
03f4723e 21sock_example-objs := sock_example.o libbpf.o
a8085782 22sockex1-objs := bpf_load.o libbpf.o sockex1_user.o
fbe33108 23sockex2-objs := bpf_load.o libbpf.o sockex2_user.o
530b2c86 24sockex3-objs := bpf_load.o libbpf.o sockex3_user.o
b896c4f9 25tracex1-objs := bpf_load.o libbpf.o tracex1_user.o
d822a192 26tracex2-objs := bpf_load.o libbpf.o tracex2_user.o
5c7fc2d2 27tracex3-objs := bpf_load.o libbpf.o tracex3_user.o
9811e353 28tracex4-objs := bpf_load.o libbpf.o tracex4_user.o
5bacd780 29tracex5-objs := bpf_load.o libbpf.o tracex5_user.o
47efb302 30tracex6-objs := bpf_load.o libbpf.o tracex6_user.o
39111695 31trace_output-objs := bpf_load.o libbpf.o trace_output_user.o
0fb1170e 32lathist-objs := bpf_load.o libbpf.o lathist_user.o
3c731eba
AS
33
34# Tell kbuild to always build the programs
35always := $(hostprogs-y)
a8085782 36always += sockex1_kern.o
fbe33108 37always += sockex2_kern.o
530b2c86 38always += sockex3_kern.o
b896c4f9 39always += tracex1_kern.o
d822a192 40always += tracex2_kern.o
5c7fc2d2 41always += tracex3_kern.o
9811e353 42always += tracex4_kern.o
5bacd780 43always += tracex5_kern.o
47efb302 44always += tracex6_kern.o
39111695 45always += trace_output_kern.o
91bc4822 46always += tcbpf1_kern.o
0fb1170e 47always += lathist_kern.o
3c731eba
AS
48
49HOSTCFLAGS += -I$(objtree)/usr/include
a8085782
AS
50
51HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
52HOSTLOADLIBES_sockex1 += -lelf
fbe33108 53HOSTLOADLIBES_sockex2 += -lelf
530b2c86 54HOSTLOADLIBES_sockex3 += -lelf
b896c4f9 55HOSTLOADLIBES_tracex1 += -lelf
d822a192 56HOSTLOADLIBES_tracex2 += -lelf
5c7fc2d2 57HOSTLOADLIBES_tracex3 += -lelf
9811e353 58HOSTLOADLIBES_tracex4 += -lelf -lrt
5bacd780 59HOSTLOADLIBES_tracex5 += -lelf
47efb302 60HOSTLOADLIBES_tracex6 += -lelf
39111695 61HOSTLOADLIBES_trace_output += -lelf -lrt
0fb1170e 62HOSTLOADLIBES_lathist += -lelf
a8085782
AS
63
64# point this to your LLVM backend with bpf support
65LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc
66
b88c06e3 67$(obj)/%.o: $(src)/%.c
a8085782
AS
68 clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
69 -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
70 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
39111695
AS
71 clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
72 -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
73 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=asm -o $@.s