Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 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 |
Alexei Starovoitov | ffb65f2 | 2014-11-13 17:36:48 -0800 | [diff] [blame] | 5 | hostprogs-y := test_verifier test_maps |
Alexei Starovoitov | 03f4723 | 2014-12-01 15:06:36 -0800 | [diff] [blame] | 6 | hostprogs-y += sock_example |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 7 | hostprogs-y += sockex1 |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 8 | hostprogs-y += sockex2 |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 9 | hostprogs-y += sockex3 |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 10 | hostprogs-y += tracex1 |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 11 | hostprogs-y += tracex2 |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 12 | hostprogs-y += tracex3 |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 13 | hostprogs-y += tracex4 |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 14 | hostprogs-y += tracex5 |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame^] | 15 | hostprogs-y += tracex6 |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 16 | hostprogs-y += lathist |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 17 | |
| 18 | test_verifier-objs := test_verifier.o libbpf.o |
Alexei Starovoitov | ffb65f2 | 2014-11-13 17:36:48 -0800 | [diff] [blame] | 19 | test_maps-objs := test_maps.o libbpf.o |
Alexei Starovoitov | 03f4723 | 2014-12-01 15:06:36 -0800 | [diff] [blame] | 20 | sock_example-objs := sock_example.o libbpf.o |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 21 | sockex1-objs := bpf_load.o libbpf.o sockex1_user.o |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 22 | sockex2-objs := bpf_load.o libbpf.o sockex2_user.o |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 23 | sockex3-objs := bpf_load.o libbpf.o sockex3_user.o |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 24 | tracex1-objs := bpf_load.o libbpf.o tracex1_user.o |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 25 | tracex2-objs := bpf_load.o libbpf.o tracex2_user.o |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 26 | tracex3-objs := bpf_load.o libbpf.o tracex3_user.o |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 27 | tracex4-objs := bpf_load.o libbpf.o tracex4_user.o |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 28 | tracex5-objs := bpf_load.o libbpf.o tracex5_user.o |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame^] | 29 | tracex6-objs := bpf_load.o libbpf.o tracex6_user.o |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 30 | lathist-objs := bpf_load.o libbpf.o lathist_user.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 31 | |
| 32 | # Tell kbuild to always build the programs |
| 33 | always := $(hostprogs-y) |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 34 | always += sockex1_kern.o |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 35 | always += sockex2_kern.o |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 36 | always += sockex3_kern.o |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 37 | always += tracex1_kern.o |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 38 | always += tracex2_kern.o |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 39 | always += tracex3_kern.o |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 40 | always += tracex4_kern.o |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 41 | always += tracex5_kern.o |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame^] | 42 | always += tracex6_kern.o |
Alexei Starovoitov | 91bc4822 | 2015-04-01 17:12:13 -0700 | [diff] [blame] | 43 | always += tcbpf1_kern.o |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 44 | always += lathist_kern.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 45 | |
| 46 | HOSTCFLAGS += -I$(objtree)/usr/include |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 47 | |
| 48 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable |
| 49 | HOSTLOADLIBES_sockex1 += -lelf |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 50 | HOSTLOADLIBES_sockex2 += -lelf |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 51 | HOSTLOADLIBES_sockex3 += -lelf |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 52 | HOSTLOADLIBES_tracex1 += -lelf |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 53 | HOSTLOADLIBES_tracex2 += -lelf |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 54 | HOSTLOADLIBES_tracex3 += -lelf |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 55 | HOSTLOADLIBES_tracex4 += -lelf -lrt |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 56 | HOSTLOADLIBES_tracex5 += -lelf |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame^] | 57 | HOSTLOADLIBES_tracex6 += -lelf |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 58 | HOSTLOADLIBES_lathist += -lelf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 59 | |
| 60 | # point this to your LLVM backend with bpf support |
| 61 | LLC=$(srctree)/tools/bpf/llvm/bld/Debug+Asserts/bin/llc |
| 62 | |
Brenden Blanco | b88c06e | 2015-05-11 21:25:51 -0700 | [diff] [blame] | 63 | $(obj)/%.o: $(src)/%.c |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 64 | clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ |
| 65 | -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \ |
| 66 | -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ |