]>
Commit | Line | Data |
---|---|---|
3c731eba AS |
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. |
2 | obj- := dummy.o | |
3 | ||
4 | # List of programs to build | |
ffb65f27 | 5 | hostprogs-y := test_verifier test_maps |
03f4723e | 6 | hostprogs-y += sock_example |
a8085782 | 7 | hostprogs-y += sockex1 |
fbe33108 | 8 | hostprogs-y += sockex2 |
530b2c86 | 9 | hostprogs-y += sockex3 |
b896c4f9 | 10 | hostprogs-y += tracex1 |
d822a192 | 11 | hostprogs-y += tracex2 |
5c7fc2d2 | 12 | hostprogs-y += tracex3 |
9811e353 | 13 | hostprogs-y += tracex4 |
5bacd780 | 14 | hostprogs-y += tracex5 |
47efb302 | 15 | hostprogs-y += tracex6 |
39111695 | 16 | hostprogs-y += trace_output |
0fb1170e | 17 | hostprogs-y += lathist |
3c731eba AS |
18 | |
19 | test_verifier-objs := test_verifier.o libbpf.o | |
ffb65f27 | 20 | test_maps-objs := test_maps.o libbpf.o |
03f4723e | 21 | sock_example-objs := sock_example.o libbpf.o |
a8085782 | 22 | sockex1-objs := bpf_load.o libbpf.o sockex1_user.o |
fbe33108 | 23 | sockex2-objs := bpf_load.o libbpf.o sockex2_user.o |
530b2c86 | 24 | sockex3-objs := bpf_load.o libbpf.o sockex3_user.o |
b896c4f9 | 25 | tracex1-objs := bpf_load.o libbpf.o tracex1_user.o |
d822a192 | 26 | tracex2-objs := bpf_load.o libbpf.o tracex2_user.o |
5c7fc2d2 | 27 | tracex3-objs := bpf_load.o libbpf.o tracex3_user.o |
9811e353 | 28 | tracex4-objs := bpf_load.o libbpf.o tracex4_user.o |
5bacd780 | 29 | tracex5-objs := bpf_load.o libbpf.o tracex5_user.o |
47efb302 | 30 | tracex6-objs := bpf_load.o libbpf.o tracex6_user.o |
39111695 | 31 | trace_output-objs := bpf_load.o libbpf.o trace_output_user.o |
0fb1170e | 32 | lathist-objs := bpf_load.o libbpf.o lathist_user.o |
3c731eba AS |
33 | |
34 | # Tell kbuild to always build the programs | |
35 | always := $(hostprogs-y) | |
a8085782 | 36 | always += sockex1_kern.o |
fbe33108 | 37 | always += sockex2_kern.o |
530b2c86 | 38 | always += sockex3_kern.o |
b896c4f9 | 39 | always += tracex1_kern.o |
d822a192 | 40 | always += tracex2_kern.o |
5c7fc2d2 | 41 | always += tracex3_kern.o |
9811e353 | 42 | always += tracex4_kern.o |
5bacd780 | 43 | always += tracex5_kern.o |
47efb302 | 44 | always += tracex6_kern.o |
39111695 | 45 | always += trace_output_kern.o |
91bc4822 | 46 | always += tcbpf1_kern.o |
0fb1170e | 47 | always += lathist_kern.o |
3c731eba AS |
48 | |
49 | HOSTCFLAGS += -I$(objtree)/usr/include | |
a8085782 AS |
50 | |
51 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable | |
52 | HOSTLOADLIBES_sockex1 += -lelf | |
fbe33108 | 53 | HOSTLOADLIBES_sockex2 += -lelf |
530b2c86 | 54 | HOSTLOADLIBES_sockex3 += -lelf |
b896c4f9 | 55 | HOSTLOADLIBES_tracex1 += -lelf |
d822a192 | 56 | HOSTLOADLIBES_tracex2 += -lelf |
5c7fc2d2 | 57 | HOSTLOADLIBES_tracex3 += -lelf |
9811e353 | 58 | HOSTLOADLIBES_tracex4 += -lelf -lrt |
5bacd780 | 59 | HOSTLOADLIBES_tracex5 += -lelf |
47efb302 | 60 | HOSTLOADLIBES_tracex6 += -lelf |
39111695 | 61 | HOSTLOADLIBES_trace_output += -lelf -lrt |
0fb1170e | 62 | HOSTLOADLIBES_lathist += -lelf |
a8085782 AS |
63 | |
64 | # point this to your LLVM backend with bpf support | |
65 | LLC=$(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 |