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 |
Martin KaFai Lau | 5db58fa | 2016-11-11 10:55:11 -0800 | [diff] [blame] | 5 | hostprogs-y := test_lru_dist |
Alexei Starovoitov | 03f4723 | 2014-12-01 15:06:36 -0800 | [diff] [blame] | 6 | hostprogs-y += sock_example |
Daniel Borkmann | 42984d7 | 2015-10-29 14:58:10 +0100 | [diff] [blame] | 7 | hostprogs-y += fds_example |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 8 | hostprogs-y += sockex1 |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 9 | hostprogs-y += sockex2 |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 10 | hostprogs-y += sockex3 |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 11 | hostprogs-y += tracex1 |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 12 | hostprogs-y += tracex2 |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 13 | hostprogs-y += tracex3 |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 14 | hostprogs-y += tracex4 |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 15 | hostprogs-y += tracex5 |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 16 | hostprogs-y += tracex6 |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 17 | hostprogs-y += test_probe_write_user |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 18 | hostprogs-y += trace_output |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 19 | hostprogs-y += lathist |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 20 | hostprogs-y += offwaketime |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 21 | hostprogs-y += spintest |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 22 | hostprogs-y += map_perf_test |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 23 | hostprogs-y += test_overhead |
Martin KaFai Lau | a3f7461 | 2016-06-30 10:28:45 -0700 | [diff] [blame] | 24 | hostprogs-y += test_cgrp2_array_pin |
Daniel Mack | d8c5b17 | 2016-11-23 16:52:30 +0100 | [diff] [blame] | 25 | hostprogs-y += test_cgrp2_attach |
Sargun Dhillon | 9b474ec | 2016-12-02 02:42:32 -0800 | [diff] [blame] | 26 | hostprogs-y += test_cgrp2_attach2 |
David Ahern | ad2805d | 2016-12-01 08:48:05 -0800 | [diff] [blame] | 27 | hostprogs-y += test_cgrp2_sock |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 28 | hostprogs-y += test_cgrp2_sock2 |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 29 | hostprogs-y += xdp1 |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 30 | hostprogs-y += xdp2 |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 31 | hostprogs-y += test_current_task_under_cgroup |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 32 | hostprogs-y += trace_event |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 33 | hostprogs-y += sampleip |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 34 | hostprogs-y += tc_l2_redirect |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 35 | hostprogs-y += lwt_len_hist |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 36 | hostprogs-y += xdp_tx_iptunnel |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 37 | |
Martin KaFai Lau | 5db58fa | 2016-11-11 10:55:11 -0800 | [diff] [blame] | 38 | test_lru_dist-objs := test_lru_dist.o libbpf.o |
Alexei Starovoitov | 03f4723 | 2014-12-01 15:06:36 -0800 | [diff] [blame] | 39 | sock_example-objs := sock_example.o libbpf.o |
Daniel Borkmann | 42984d7 | 2015-10-29 14:58:10 +0100 | [diff] [blame] | 40 | fds_example-objs := bpf_load.o libbpf.o fds_example.o |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 41 | sockex1-objs := bpf_load.o libbpf.o sockex1_user.o |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 42 | sockex2-objs := bpf_load.o libbpf.o sockex2_user.o |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 43 | sockex3-objs := bpf_load.o libbpf.o sockex3_user.o |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 44 | tracex1-objs := bpf_load.o libbpf.o tracex1_user.o |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 45 | tracex2-objs := bpf_load.o libbpf.o tracex2_user.o |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 46 | tracex3-objs := bpf_load.o libbpf.o tracex3_user.o |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 47 | tracex4-objs := bpf_load.o libbpf.o tracex4_user.o |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 48 | tracex5-objs := bpf_load.o libbpf.o tracex5_user.o |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 49 | tracex6-objs := bpf_load.o libbpf.o tracex6_user.o |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 50 | test_probe_write_user-objs := bpf_load.o libbpf.o test_probe_write_user_user.o |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 51 | trace_output-objs := bpf_load.o libbpf.o trace_output_user.o |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 52 | lathist-objs := bpf_load.o libbpf.o lathist_user.o |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 53 | offwaketime-objs := bpf_load.o libbpf.o offwaketime_user.o |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 54 | spintest-objs := bpf_load.o libbpf.o spintest_user.o |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 55 | map_perf_test-objs := bpf_load.o libbpf.o map_perf_test_user.o |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 56 | test_overhead-objs := bpf_load.o libbpf.o test_overhead_user.o |
Martin KaFai Lau | a3f7461 | 2016-06-30 10:28:45 -0700 | [diff] [blame] | 57 | test_cgrp2_array_pin-objs := libbpf.o test_cgrp2_array_pin.o |
Daniel Mack | d8c5b17 | 2016-11-23 16:52:30 +0100 | [diff] [blame] | 58 | test_cgrp2_attach-objs := libbpf.o test_cgrp2_attach.o |
Sargun Dhillon | 9b474ec | 2016-12-02 02:42:32 -0800 | [diff] [blame] | 59 | test_cgrp2_attach2-objs := libbpf.o test_cgrp2_attach2.o cgroup_helpers.o |
David Ahern | ad2805d | 2016-12-01 08:48:05 -0800 | [diff] [blame] | 60 | test_cgrp2_sock-objs := libbpf.o test_cgrp2_sock.o |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 61 | test_cgrp2_sock2-objs := bpf_load.o libbpf.o test_cgrp2_sock2.o |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 62 | xdp1-objs := bpf_load.o libbpf.o xdp1_user.o |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 63 | # reuse xdp1 source intentionally |
| 64 | xdp2-objs := bpf_load.o libbpf.o xdp1_user.o |
Sargun Dhillon | 1a922fe | 2016-12-02 02:42:18 -0800 | [diff] [blame] | 65 | test_current_task_under_cgroup-objs := bpf_load.o libbpf.o cgroup_helpers.o \ |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 66 | test_current_task_under_cgroup_user.o |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 67 | trace_event-objs := bpf_load.o libbpf.o trace_event_user.o |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 68 | sampleip-objs := bpf_load.o libbpf.o sampleip_user.o |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 69 | tc_l2_redirect-objs := bpf_load.o libbpf.o tc_l2_redirect_user.o |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 70 | lwt_len_hist-objs := bpf_load.o libbpf.o lwt_len_hist_user.o |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 71 | xdp_tx_iptunnel-objs := bpf_load.o libbpf.o xdp_tx_iptunnel_user.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 72 | |
| 73 | # Tell kbuild to always build the programs |
| 74 | always := $(hostprogs-y) |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 75 | always += sockex1_kern.o |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 76 | always += sockex2_kern.o |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 77 | always += sockex3_kern.o |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 78 | always += tracex1_kern.o |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 79 | always += tracex2_kern.o |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 80 | always += tracex3_kern.o |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 81 | always += tracex4_kern.o |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 82 | always += tracex5_kern.o |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 83 | always += tracex6_kern.o |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 84 | always += sock_flags_kern.o |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 85 | always += test_probe_write_user_kern.o |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 86 | always += trace_output_kern.o |
Alexei Starovoitov | 91bc4822 | 2015-04-01 17:12:13 -0700 | [diff] [blame] | 87 | always += tcbpf1_kern.o |
William Tu | 6afb1e2 | 2016-08-19 11:55:44 -0700 | [diff] [blame] | 88 | always += tcbpf2_kern.o |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 89 | always += tc_l2_redirect_kern.o |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 90 | always += lathist_kern.o |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 91 | always += offwaketime_kern.o |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 92 | always += spintest_kern.o |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 93 | always += map_perf_test_kern.o |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 94 | always += test_overhead_tp_kern.o |
| 95 | always += test_overhead_kprobe_kern.o |
Alexei Starovoitov | 65d472f | 2016-05-05 19:49:14 -0700 | [diff] [blame] | 96 | always += parse_varlen.o parse_simple.o parse_ldabs.o |
Martin KaFai Lau | a3f7461 | 2016-06-30 10:28:45 -0700 | [diff] [blame] | 97 | always += test_cgrp2_tc_kern.o |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 98 | always += xdp1_kern.o |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 99 | always += xdp2_kern.o |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 100 | always += test_current_task_under_cgroup_kern.o |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 101 | always += trace_event_kern.o |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 102 | always += sampleip_kern.o |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 103 | always += lwt_len_hist_kern.o |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 104 | always += xdp_tx_iptunnel_kern.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 105 | |
| 106 | HOSTCFLAGS += -I$(objtree)/usr/include |
Alexei Starovoitov | 9bee294 | 2016-11-28 22:07:22 -0800 | [diff] [blame] | 107 | HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 108 | |
| 109 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable |
Daniel Borkmann | 42984d7 | 2015-10-29 14:58:10 +0100 | [diff] [blame] | 110 | HOSTLOADLIBES_fds_example += -lelf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 111 | HOSTLOADLIBES_sockex1 += -lelf |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 112 | HOSTLOADLIBES_sockex2 += -lelf |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 113 | HOSTLOADLIBES_sockex3 += -lelf |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 114 | HOSTLOADLIBES_tracex1 += -lelf |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 115 | HOSTLOADLIBES_tracex2 += -lelf |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 116 | HOSTLOADLIBES_tracex3 += -lelf |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 117 | HOSTLOADLIBES_tracex4 += -lelf -lrt |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 118 | HOSTLOADLIBES_tracex5 += -lelf |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 119 | HOSTLOADLIBES_tracex6 += -lelf |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 120 | HOSTLOADLIBES_test_cgrp2_sock2 += -lelf |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 121 | HOSTLOADLIBES_test_probe_write_user += -lelf |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 122 | HOSTLOADLIBES_trace_output += -lelf -lrt |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 123 | HOSTLOADLIBES_lathist += -lelf |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 124 | HOSTLOADLIBES_offwaketime += -lelf |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 125 | HOSTLOADLIBES_spintest += -lelf |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 126 | HOSTLOADLIBES_map_perf_test += -lelf -lrt |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 127 | HOSTLOADLIBES_test_overhead += -lelf -lrt |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 128 | HOSTLOADLIBES_xdp1 += -lelf |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 129 | HOSTLOADLIBES_xdp2 += -lelf |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 130 | HOSTLOADLIBES_test_current_task_under_cgroup += -lelf |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 131 | HOSTLOADLIBES_trace_event += -lelf |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 132 | HOSTLOADLIBES_sampleip += -lelf |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 133 | HOSTLOADLIBES_tc_l2_redirect += -l elf |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 134 | HOSTLOADLIBES_lwt_len_hist += -l elf |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 135 | HOSTLOADLIBES_xdp_tx_iptunnel += -lelf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 136 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 137 | # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: |
| 138 | # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang |
Jesper Dangaard Brouer | 6ccfba7 | 2016-04-28 14:20:53 +0200 | [diff] [blame] | 139 | LLC ?= llc |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 140 | CLANG ?= clang |
Jesper Dangaard Brouer | 6ccfba7 | 2016-04-28 14:20:53 +0200 | [diff] [blame] | 141 | |
Jesper Dangaard Brouer | b62a796 | 2016-04-28 14:21:09 +0200 | [diff] [blame] | 142 | # Trick to allow make to be run from this directory |
| 143 | all: |
| 144 | $(MAKE) -C ../../ $$PWD/ |
| 145 | |
| 146 | clean: |
| 147 | $(MAKE) -C ../../ M=$$PWD clean |
| 148 | @rm -f *~ |
| 149 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 150 | # Verify LLVM compiler tools are available and bpf target is supported by llc |
| 151 | .PHONY: verify_cmds verify_target_bpf $(CLANG) $(LLC) |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 152 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 153 | verify_cmds: $(CLANG) $(LLC) |
| 154 | @for TOOL in $^ ; do \ |
| 155 | if ! (which -- "$${TOOL}" > /dev/null 2>&1); then \ |
| 156 | echo "*** ERROR: Cannot find LLVM tool $${TOOL}" ;\ |
| 157 | exit 1; \ |
| 158 | else true; fi; \ |
| 159 | done |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 160 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 161 | verify_target_bpf: verify_cmds |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 162 | @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \ |
| 163 | echo "*** ERROR: LLVM (${LLC}) does not support 'bpf' target" ;\ |
| 164 | echo " NOTICE: LLVM version >= 3.7.1 required" ;\ |
| 165 | exit 2; \ |
| 166 | else true; fi |
| 167 | |
| 168 | $(src)/*.c: verify_target_bpf |
| 169 | |
Naveen N. Rao | 128d151 | 2016-04-04 22:31:33 +0530 | [diff] [blame] | 170 | # asm/sysreg.h - inline assembly used by it is incompatible with llvm. |
| 171 | # But, there is no easy way to fix it, so just exclude it since it is |
Yang Shi | 30b50aa | 2015-11-12 14:07:46 -0800 | [diff] [blame] | 172 | # useless for BPF samples. |
Brenden Blanco | b88c06e | 2015-05-11 21:25:51 -0700 | [diff] [blame] | 173 | $(obj)/%.o: $(src)/%.c |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 174 | $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \ |
Yang Shi | 30b50aa | 2015-11-12 14:07:46 -0800 | [diff] [blame] | 175 | -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ |
Alexei Starovoitov | 65d472f | 2016-05-05 19:49:14 -0700 | [diff] [blame] | 176 | -Wno-compare-distinct-pointer-types \ |
Alexei Starovoitov | 69a9d09 | 2016-12-01 18:31:12 -0800 | [diff] [blame] | 177 | -Wno-gnu-variable-sized-type-not-at-end \ |
| 178 | -Wno-address-of-packed-member -Wno-tautological-compare \ |
Jesper Dangaard Brouer | 6ccfba7 | 2016-04-28 14:20:53 +0200 | [diff] [blame] | 179 | -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ |