Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 2 | # List of programs to build |
Martin KaFai Lau | 5db58fa | 2016-11-11 10:55:11 -0800 | [diff] [blame] | 3 | hostprogs-y := test_lru_dist |
Alexei Starovoitov | 03f4723 | 2014-12-01 15:06:36 -0800 | [diff] [blame] | 4 | hostprogs-y += sock_example |
Daniel Borkmann | 42984d7 | 2015-10-29 14:58:10 +0100 | [diff] [blame] | 5 | hostprogs-y += fds_example |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 6 | hostprogs-y += sockex1 |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 7 | hostprogs-y += sockex2 |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 8 | hostprogs-y += sockex3 |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 9 | hostprogs-y += tracex1 |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 10 | hostprogs-y += tracex2 |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 11 | hostprogs-y += tracex3 |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 12 | hostprogs-y += tracex4 |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 13 | hostprogs-y += tracex5 |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 14 | hostprogs-y += tracex6 |
Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 15 | hostprogs-y += tracex7 |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 16 | hostprogs-y += test_probe_write_user |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 17 | hostprogs-y += trace_output |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 18 | hostprogs-y += lathist |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 19 | hostprogs-y += offwaketime |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 20 | hostprogs-y += spintest |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 21 | hostprogs-y += map_perf_test |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 22 | hostprogs-y += test_overhead |
Martin KaFai Lau | a3f7461 | 2016-06-30 10:28:45 -0700 | [diff] [blame] | 23 | hostprogs-y += test_cgrp2_array_pin |
Daniel Mack | d8c5b17 | 2016-11-23 16:52:30 +0100 | [diff] [blame] | 24 | hostprogs-y += test_cgrp2_attach |
Sargun Dhillon | 9b474ec | 2016-12-02 02:42:32 -0800 | [diff] [blame] | 25 | hostprogs-y += test_cgrp2_attach2 |
David Ahern | ad2805d | 2016-12-01 08:48:05 -0800 | [diff] [blame] | 26 | hostprogs-y += test_cgrp2_sock |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 27 | hostprogs-y += test_cgrp2_sock2 |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 28 | hostprogs-y += xdp1 |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 29 | hostprogs-y += xdp2 |
Christina Jacob | 3e29cd0 | 2017-11-05 08:52:30 +0530 | [diff] [blame] | 30 | hostprogs-y += xdp_router_ipv4 |
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 |
Martin KaFai Lau | fb30d4b | 2017-03-22 10:00:35 -0700 | [diff] [blame] | 37 | hostprogs-y += test_map_in_map |
Chenbo Feng | 51570a5 | 2017-03-22 17:27:36 -0700 | [diff] [blame] | 38 | hostprogs-y += per_socket_stats_example |
Lawrence Brakmo | ae16189 | 2017-06-30 20:02:41 -0700 | [diff] [blame] | 39 | hostprogs-y += load_sock_ops |
John Fastabend | 832622e | 2017-07-17 09:27:28 -0700 | [diff] [blame] | 40 | hostprogs-y += xdp_redirect |
John Fastabend | 9d6e005 | 2017-07-17 09:30:25 -0700 | [diff] [blame] | 41 | hostprogs-y += xdp_redirect_map |
Jesper Dangaard Brouer | fad3917 | 2017-10-16 12:19:49 +0200 | [diff] [blame] | 42 | hostprogs-y += xdp_redirect_cpu |
Jesper Dangaard Brouer | 3ffab54 | 2017-08-29 16:38:11 +0200 | [diff] [blame] | 43 | hostprogs-y += xdp_monitor |
Jesper Dangaard Brouer | 0fca931 | 2018-01-03 11:26:19 +0100 | [diff] [blame] | 44 | hostprogs-y += xdp_rxq_info |
Yonghong Song | 1da236b6b | 2017-08-04 16:00:10 -0700 | [diff] [blame] | 45 | hostprogs-y += syscall_tp |
Leo Yan | c535077 | 2018-02-26 09:19:12 +0800 | [diff] [blame] | 46 | hostprogs-y += cpustat |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 47 | |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 48 | # Libbpf dependencies |
Eric Leblond | bbf48c1 | 2018-01-30 21:55:02 +0100 | [diff] [blame] | 49 | LIBBPF := ../../tools/lib/bpf/bpf.o ../../tools/lib/bpf/nlattr.o |
Roman Gushchin | 9d1f159 | 2017-11-05 08:15:33 -0500 | [diff] [blame] | 50 | CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 51 | |
| 52 | test_lru_dist-objs := test_lru_dist.o $(LIBBPF) |
| 53 | sock_example-objs := sock_example.o $(LIBBPF) |
| 54 | fds_example-objs := bpf_load.o $(LIBBPF) fds_example.o |
| 55 | sockex1-objs := bpf_load.o $(LIBBPF) sockex1_user.o |
| 56 | sockex2-objs := bpf_load.o $(LIBBPF) sockex2_user.o |
| 57 | sockex3-objs := bpf_load.o $(LIBBPF) sockex3_user.o |
| 58 | tracex1-objs := bpf_load.o $(LIBBPF) tracex1_user.o |
| 59 | tracex2-objs := bpf_load.o $(LIBBPF) tracex2_user.o |
| 60 | tracex3-objs := bpf_load.o $(LIBBPF) tracex3_user.o |
| 61 | tracex4-objs := bpf_load.o $(LIBBPF) tracex4_user.o |
| 62 | tracex5-objs := bpf_load.o $(LIBBPF) tracex5_user.o |
| 63 | tracex6-objs := bpf_load.o $(LIBBPF) tracex6_user.o |
Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 64 | tracex7-objs := bpf_load.o $(LIBBPF) tracex7_user.o |
Lawrence Brakmo | ae16189 | 2017-06-30 20:02:41 -0700 | [diff] [blame] | 65 | load_sock_ops-objs := bpf_load.o $(LIBBPF) load_sock_ops.o |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 66 | test_probe_write_user-objs := bpf_load.o $(LIBBPF) test_probe_write_user_user.o |
| 67 | trace_output-objs := bpf_load.o $(LIBBPF) trace_output_user.o |
| 68 | lathist-objs := bpf_load.o $(LIBBPF) lathist_user.o |
| 69 | offwaketime-objs := bpf_load.o $(LIBBPF) offwaketime_user.o |
| 70 | spintest-objs := bpf_load.o $(LIBBPF) spintest_user.o |
| 71 | map_perf_test-objs := bpf_load.o $(LIBBPF) map_perf_test_user.o |
| 72 | test_overhead-objs := bpf_load.o $(LIBBPF) test_overhead_user.o |
| 73 | test_cgrp2_array_pin-objs := $(LIBBPF) test_cgrp2_array_pin.o |
| 74 | test_cgrp2_attach-objs := $(LIBBPF) test_cgrp2_attach.o |
Roman Gushchin | 9d1f159 | 2017-11-05 08:15:33 -0500 | [diff] [blame] | 75 | test_cgrp2_attach2-objs := $(LIBBPF) test_cgrp2_attach2.o $(CGROUP_HELPERS) |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 76 | test_cgrp2_sock-objs := $(LIBBPF) test_cgrp2_sock.o |
| 77 | test_cgrp2_sock2-objs := bpf_load.o $(LIBBPF) test_cgrp2_sock2.o |
| 78 | xdp1-objs := bpf_load.o $(LIBBPF) xdp1_user.o |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 79 | # reuse xdp1 source intentionally |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 80 | xdp2-objs := bpf_load.o $(LIBBPF) xdp1_user.o |
Christina Jacob | 3e29cd0 | 2017-11-05 08:52:30 +0530 | [diff] [blame] | 81 | xdp_router_ipv4-objs := bpf_load.o $(LIBBPF) xdp_router_ipv4_user.o |
Roman Gushchin | 9d1f159 | 2017-11-05 08:15:33 -0500 | [diff] [blame] | 82 | test_current_task_under_cgroup-objs := bpf_load.o $(LIBBPF) $(CGROUP_HELPERS) \ |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 83 | test_current_task_under_cgroup_user.o |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 84 | trace_event-objs := bpf_load.o $(LIBBPF) trace_event_user.o |
| 85 | sampleip-objs := bpf_load.o $(LIBBPF) sampleip_user.o |
| 86 | tc_l2_redirect-objs := bpf_load.o $(LIBBPF) tc_l2_redirect_user.o |
| 87 | lwt_len_hist-objs := bpf_load.o $(LIBBPF) lwt_len_hist_user.o |
| 88 | xdp_tx_iptunnel-objs := bpf_load.o $(LIBBPF) xdp_tx_iptunnel_user.o |
Martin KaFai Lau | fb30d4b | 2017-03-22 10:00:35 -0700 | [diff] [blame] | 89 | test_map_in_map-objs := bpf_load.o $(LIBBPF) test_map_in_map_user.o |
Chenbo Feng | 51570a5 | 2017-03-22 17:27:36 -0700 | [diff] [blame] | 90 | per_socket_stats_example-objs := $(LIBBPF) cookie_uid_helper_example.o |
John Fastabend | 832622e | 2017-07-17 09:27:28 -0700 | [diff] [blame] | 91 | xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o |
John Fastabend | 9d6e005 | 2017-07-17 09:30:25 -0700 | [diff] [blame] | 92 | xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o |
Jesper Dangaard Brouer | fad3917 | 2017-10-16 12:19:49 +0200 | [diff] [blame] | 93 | xdp_redirect_cpu-objs := bpf_load.o $(LIBBPF) xdp_redirect_cpu_user.o |
Jesper Dangaard Brouer | 3ffab54 | 2017-08-29 16:38:11 +0200 | [diff] [blame] | 94 | xdp_monitor-objs := bpf_load.o $(LIBBPF) xdp_monitor_user.o |
Jesper Dangaard Brouer | 0fca931 | 2018-01-03 11:26:19 +0100 | [diff] [blame] | 95 | xdp_rxq_info-objs := bpf_load.o $(LIBBPF) xdp_rxq_info_user.o |
Yonghong Song | 1da236b6b | 2017-08-04 16:00:10 -0700 | [diff] [blame] | 96 | syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o |
Leo Yan | c535077 | 2018-02-26 09:19:12 +0800 | [diff] [blame] | 97 | cpustat-objs := bpf_load.o $(LIBBPF) cpustat_user.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 98 | |
| 99 | # Tell kbuild to always build the programs |
| 100 | always := $(hostprogs-y) |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 101 | always += sockex1_kern.o |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 102 | always += sockex2_kern.o |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 103 | always += sockex3_kern.o |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 104 | always += tracex1_kern.o |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 105 | always += tracex2_kern.o |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 106 | always += tracex3_kern.o |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 107 | always += tracex4_kern.o |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 108 | always += tracex5_kern.o |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 109 | always += tracex6_kern.o |
Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 110 | always += tracex7_kern.o |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 111 | always += sock_flags_kern.o |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 112 | always += test_probe_write_user_kern.o |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 113 | always += trace_output_kern.o |
Alexei Starovoitov | 91bc4822 | 2015-04-01 17:12:13 -0700 | [diff] [blame] | 114 | always += tcbpf1_kern.o |
William Tu | 6afb1e2 | 2016-08-19 11:55:44 -0700 | [diff] [blame] | 115 | always += tcbpf2_kern.o |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 116 | always += tc_l2_redirect_kern.o |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 117 | always += lathist_kern.o |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 118 | always += offwaketime_kern.o |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 119 | always += spintest_kern.o |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 120 | always += map_perf_test_kern.o |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 121 | always += test_overhead_tp_kern.o |
Alexei Starovoitov | 4662a4e | 2018-03-28 12:05:39 -0700 | [diff] [blame] | 122 | always += test_overhead_raw_tp_kern.o |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 123 | always += test_overhead_kprobe_kern.o |
Alexei Starovoitov | 65d472f | 2016-05-05 19:49:14 -0700 | [diff] [blame] | 124 | always += parse_varlen.o parse_simple.o parse_ldabs.o |
Martin KaFai Lau | a3f7461 | 2016-06-30 10:28:45 -0700 | [diff] [blame] | 125 | always += test_cgrp2_tc_kern.o |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 126 | always += xdp1_kern.o |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 127 | always += xdp2_kern.o |
Christina Jacob | 3e29cd0 | 2017-11-05 08:52:30 +0530 | [diff] [blame] | 128 | always += xdp_router_ipv4_kern.o |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 129 | always += test_current_task_under_cgroup_kern.o |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 130 | always += trace_event_kern.o |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 131 | always += sampleip_kern.o |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 132 | always += lwt_len_hist_kern.o |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 133 | always += xdp_tx_iptunnel_kern.o |
Martin KaFai Lau | fb30d4b | 2017-03-22 10:00:35 -0700 | [diff] [blame] | 134 | always += test_map_in_map_kern.o |
Chenbo Feng | 51570a5 | 2017-03-22 17:27:36 -0700 | [diff] [blame] | 135 | always += cookie_uid_helper_example.o |
Lawrence Brakmo | 61bc4d8 | 2017-06-30 20:02:43 -0700 | [diff] [blame] | 136 | always += tcp_synrto_kern.o |
Lawrence Brakmo | c400296 | 2017-06-30 20:02:45 -0700 | [diff] [blame] | 137 | always += tcp_rwnd_kern.o |
Lawrence Brakmo | d9925368 | 2017-06-30 20:02:48 -0700 | [diff] [blame] | 138 | always += tcp_bufs_kern.o |
Lawrence Brakmo | bb56d44 | 2017-06-30 20:02:50 -0700 | [diff] [blame] | 139 | always += tcp_cong_kern.o |
Lawrence Brakmo | 7bc62e2 | 2017-06-30 20:02:52 -0700 | [diff] [blame] | 140 | always += tcp_iw_kern.o |
Lawrence Brakmo | 6c4a01b | 2017-06-30 20:02:54 -0700 | [diff] [blame] | 141 | always += tcp_clamp_kern.o |
Lawrence Brakmo | c890063 | 2017-10-20 11:05:42 -0700 | [diff] [blame] | 142 | always += tcp_basertt_kern.o |
John Fastabend | 832622e | 2017-07-17 09:27:28 -0700 | [diff] [blame] | 143 | always += xdp_redirect_kern.o |
John Fastabend | 9d6e005 | 2017-07-17 09:30:25 -0700 | [diff] [blame] | 144 | always += xdp_redirect_map_kern.o |
Jesper Dangaard Brouer | fad3917 | 2017-10-16 12:19:49 +0200 | [diff] [blame] | 145 | always += xdp_redirect_cpu_kern.o |
Jesper Dangaard Brouer | 3ffab54 | 2017-08-29 16:38:11 +0200 | [diff] [blame] | 146 | always += xdp_monitor_kern.o |
Jesper Dangaard Brouer | 0fca931 | 2018-01-03 11:26:19 +0100 | [diff] [blame] | 147 | always += xdp_rxq_info_kern.o |
Jesper Dangaard Brouer | 36e04a2 | 2018-01-10 18:21:44 +0100 | [diff] [blame] | 148 | always += xdp2skb_meta_kern.o |
Yonghong Song | 1da236b6b | 2017-08-04 16:00:10 -0700 | [diff] [blame] | 149 | always += syscall_tp_kern.o |
Leo Yan | c535077 | 2018-02-26 09:19:12 +0800 | [diff] [blame] | 150 | always += cpustat_kern.o |
Alexei Starovoitov | 3c731eb | 2014-09-26 00:17:07 -0700 | [diff] [blame] | 151 | |
| 152 | HOSTCFLAGS += -I$(objtree)/usr/include |
Joe Stringer | 43371c8 | 2016-12-14 14:43:39 -0800 | [diff] [blame] | 153 | HOSTCFLAGS += -I$(srctree)/tools/lib/ |
Alexei Starovoitov | 9bee294 | 2016-11-28 22:07:22 -0800 | [diff] [blame] | 154 | HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ |
Joe Stringer | 205c8ad | 2016-12-08 18:46:19 -0800 | [diff] [blame] | 155 | HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include |
| 156 | HOSTCFLAGS += -I$(srctree)/tools/perf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 157 | |
| 158 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable |
Daniel Borkmann | 42984d7 | 2015-10-29 14:58:10 +0100 | [diff] [blame] | 159 | HOSTLOADLIBES_fds_example += -lelf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 160 | HOSTLOADLIBES_sockex1 += -lelf |
Alexei Starovoitov | fbe3310 | 2014-12-01 15:06:39 -0800 | [diff] [blame] | 161 | HOSTLOADLIBES_sockex2 += -lelf |
Alexei Starovoitov | 530b2c8 | 2015-05-19 16:59:06 -0700 | [diff] [blame] | 162 | HOSTLOADLIBES_sockex3 += -lelf |
Alexei Starovoitov | b896c4f | 2015-03-25 12:49:23 -0700 | [diff] [blame] | 163 | HOSTLOADLIBES_tracex1 += -lelf |
Alexei Starovoitov | d822a19 | 2015-03-25 12:49:24 -0700 | [diff] [blame] | 164 | HOSTLOADLIBES_tracex2 += -lelf |
Alexei Starovoitov | 5c7fc2d | 2015-03-25 12:49:25 -0700 | [diff] [blame] | 165 | HOSTLOADLIBES_tracex3 += -lelf |
Alexei Starovoitov | 9811e35 | 2015-03-25 12:49:26 -0700 | [diff] [blame] | 166 | HOSTLOADLIBES_tracex4 += -lelf -lrt |
Alexei Starovoitov | 5bacd78 | 2015-05-19 16:59:05 -0700 | [diff] [blame] | 167 | HOSTLOADLIBES_tracex5 += -lelf |
Kaixu Xia | 47efb30 | 2015-08-06 07:02:36 +0000 | [diff] [blame] | 168 | HOSTLOADLIBES_tracex6 += -lelf |
Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 169 | HOSTLOADLIBES_tracex7 += -lelf |
David Ahern | 554ae6e | 2016-12-01 08:48:08 -0800 | [diff] [blame] | 170 | HOSTLOADLIBES_test_cgrp2_sock2 += -lelf |
Lawrence Brakmo | ae16189 | 2017-06-30 20:02:41 -0700 | [diff] [blame] | 171 | HOSTLOADLIBES_load_sock_ops += -lelf |
Sargun Dhillon | cf9b119 | 2016-07-25 05:55:02 -0700 | [diff] [blame] | 172 | HOSTLOADLIBES_test_probe_write_user += -lelf |
Alexei Starovoitov | 3911169 | 2015-10-20 20:02:35 -0700 | [diff] [blame] | 173 | HOSTLOADLIBES_trace_output += -lelf -lrt |
Daniel Wagner | 0fb1170 | 2015-06-19 16:00:44 +0200 | [diff] [blame] | 174 | HOSTLOADLIBES_lathist += -lelf |
Alexei Starovoitov | a6ffe7b | 2016-02-17 19:58:59 -0800 | [diff] [blame] | 175 | HOSTLOADLIBES_offwaketime += -lelf |
Alexei Starovoitov | 9d8b612 | 2016-03-08 15:07:52 -0800 | [diff] [blame] | 176 | HOSTLOADLIBES_spintest += -lelf |
Alexei Starovoitov | 26e9093 | 2016-03-08 15:07:54 -0800 | [diff] [blame] | 177 | HOSTLOADLIBES_map_perf_test += -lelf -lrt |
Alexei Starovoitov | e3edfde | 2016-04-06 18:43:31 -0700 | [diff] [blame] | 178 | HOSTLOADLIBES_test_overhead += -lelf -lrt |
Brenden Blanco | 86af8b4 | 2016-07-19 12:16:51 -0700 | [diff] [blame] | 179 | HOSTLOADLIBES_xdp1 += -lelf |
Brenden Blanco | 764cbcce | 2016-07-19 12:16:57 -0700 | [diff] [blame] | 180 | HOSTLOADLIBES_xdp2 += -lelf |
Christina Jacob | 3e29cd0 | 2017-11-05 08:52:30 +0530 | [diff] [blame] | 181 | HOSTLOADLIBES_xdp_router_ipv4 += -lelf |
Sargun Dhillon | 9e6e60e | 2016-08-12 08:57:04 -0700 | [diff] [blame] | 182 | HOSTLOADLIBES_test_current_task_under_cgroup += -lelf |
Alexei Starovoitov | 1c47910e | 2016-09-01 18:37:25 -0700 | [diff] [blame] | 183 | HOSTLOADLIBES_trace_event += -lelf |
Brendan Gregg | 7287441 | 2016-09-01 18:37:26 -0700 | [diff] [blame] | 184 | HOSTLOADLIBES_sampleip += -lelf |
Martin KaFai Lau | 90e0289 | 2016-11-09 15:36:34 -0800 | [diff] [blame] | 185 | HOSTLOADLIBES_tc_l2_redirect += -l elf |
Thomas Graf | f74599f | 2016-11-30 17:10:11 +0100 | [diff] [blame] | 186 | HOSTLOADLIBES_lwt_len_hist += -l elf |
Martin KaFai Lau | 12d8bb6 | 2016-12-07 15:53:14 -0800 | [diff] [blame] | 187 | HOSTLOADLIBES_xdp_tx_iptunnel += -lelf |
Martin KaFai Lau | fb30d4b | 2017-03-22 10:00:35 -0700 | [diff] [blame] | 188 | HOSTLOADLIBES_test_map_in_map += -lelf |
John Fastabend | 832622e | 2017-07-17 09:27:28 -0700 | [diff] [blame] | 189 | HOSTLOADLIBES_xdp_redirect += -lelf |
John Fastabend | 9d6e005 | 2017-07-17 09:30:25 -0700 | [diff] [blame] | 190 | HOSTLOADLIBES_xdp_redirect_map += -lelf |
Jesper Dangaard Brouer | fad3917 | 2017-10-16 12:19:49 +0200 | [diff] [blame] | 191 | HOSTLOADLIBES_xdp_redirect_cpu += -lelf |
Jesper Dangaard Brouer | 3ffab54 | 2017-08-29 16:38:11 +0200 | [diff] [blame] | 192 | HOSTLOADLIBES_xdp_monitor += -lelf |
Jesper Dangaard Brouer | 0fca931 | 2018-01-03 11:26:19 +0100 | [diff] [blame] | 193 | HOSTLOADLIBES_xdp_rxq_info += -lelf |
Yonghong Song | 1da236b6b | 2017-08-04 16:00:10 -0700 | [diff] [blame] | 194 | HOSTLOADLIBES_syscall_tp += -lelf |
Leo Yan | c535077 | 2018-02-26 09:19:12 +0800 | [diff] [blame] | 195 | HOSTLOADLIBES_cpustat += -lelf |
Alexei Starovoitov | a808578 | 2014-12-01 15:06:38 -0800 | [diff] [blame] | 196 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 197 | # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: |
| 198 | # 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] | 199 | LLC ?= llc |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 200 | CLANG ?= clang |
Jesper Dangaard Brouer | 6ccfba7 | 2016-04-28 14:20:53 +0200 | [diff] [blame] | 201 | |
Joel Fernandes | 876e88e | 2017-09-20 09:11:57 -0700 | [diff] [blame] | 202 | # Detect that we're cross compiling and use the cross compiler |
| 203 | ifdef CROSS_COMPILE |
| 204 | HOSTCC = $(CROSS_COMPILE)gcc |
Abhijit Ayarekar | 9db9583 | 2017-10-13 12:24:06 -0700 | [diff] [blame] | 205 | CLANG_ARCH_ARGS = -target $(ARCH) |
Joel Fernandes | 876e88e | 2017-09-20 09:11:57 -0700 | [diff] [blame] | 206 | endif |
| 207 | |
Jesper Dangaard Brouer | b62a796 | 2016-04-28 14:21:09 +0200 | [diff] [blame] | 208 | # Trick to allow make to be run from this directory |
Mickaël Salaün | c25ef6a | 2018-01-26 01:39:30 +0100 | [diff] [blame] | 209 | all: $(LIBBPF) |
Uwe Kleine-König | e19b7ce | 2016-11-22 09:30:26 +0100 | [diff] [blame] | 210 | $(MAKE) -C ../../ $(CURDIR)/ |
Jesper Dangaard Brouer | b62a796 | 2016-04-28 14:21:09 +0200 | [diff] [blame] | 211 | |
| 212 | clean: |
Uwe Kleine-König | e19b7ce | 2016-11-22 09:30:26 +0100 | [diff] [blame] | 213 | $(MAKE) -C ../../ M=$(CURDIR) clean |
Jesper Dangaard Brouer | b62a796 | 2016-04-28 14:21:09 +0200 | [diff] [blame] | 214 | @rm -f *~ |
| 215 | |
Mickaël Salaün | c25ef6a | 2018-01-26 01:39:30 +0100 | [diff] [blame] | 216 | $(LIBBPF): FORCE |
| 217 | $(MAKE) -C $(dir $@) $(notdir $@) |
| 218 | |
David Daney | 4b7190e | 2017-06-13 16:49:38 -0700 | [diff] [blame] | 219 | $(obj)/syscall_nrs.s: $(src)/syscall_nrs.c |
| 220 | $(call if_changed_dep,cc_s_c) |
| 221 | |
| 222 | $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE |
| 223 | $(call filechk,offsets,__SYSCALL_NRS_H__) |
| 224 | |
| 225 | clean-files += syscall_nrs.h |
| 226 | |
| 227 | FORCE: |
| 228 | |
| 229 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 230 | # Verify LLVM compiler tools are available and bpf target is supported by llc |
| 231 | .PHONY: verify_cmds verify_target_bpf $(CLANG) $(LLC) |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 232 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 233 | verify_cmds: $(CLANG) $(LLC) |
| 234 | @for TOOL in $^ ; do \ |
| 235 | if ! (which -- "$${TOOL}" > /dev/null 2>&1); then \ |
| 236 | echo "*** ERROR: Cannot find LLVM tool $${TOOL}" ;\ |
| 237 | exit 1; \ |
| 238 | else true; fi; \ |
| 239 | done |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 240 | |
Jesper Dangaard Brouer | bdefbbf | 2016-04-28 14:21:14 +0200 | [diff] [blame] | 241 | verify_target_bpf: verify_cmds |
Jesper Dangaard Brouer | 7b01dd5 | 2016-04-28 14:20:58 +0200 | [diff] [blame] | 242 | @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \ |
| 243 | echo "*** ERROR: LLVM (${LLC}) does not support 'bpf' target" ;\ |
| 244 | echo " NOTICE: LLVM version >= 3.7.1 required" ;\ |
| 245 | exit 2; \ |
| 246 | else true; fi |
| 247 | |
| 248 | $(src)/*.c: verify_target_bpf |
| 249 | |
David Daney | 4b7190e | 2017-06-13 16:49:38 -0700 | [diff] [blame] | 250 | $(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h |
| 251 | |
Naveen N. Rao | 128d151 | 2016-04-04 22:31:33 +0530 | [diff] [blame] | 252 | # asm/sysreg.h - inline assembly used by it is incompatible with llvm. |
| 253 | # 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] | 254 | # useless for BPF samples. |
Brenden Blanco | b88c06e | 2015-05-11 21:25:51 -0700 | [diff] [blame] | 255 | $(obj)/%.o: $(src)/%.c |
Yonghong Song | 00a3855 | 2017-06-21 13:48:27 -0700 | [diff] [blame] | 256 | $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \ |
Yonghong Song | 5333502 | 2017-07-10 14:04:28 -0700 | [diff] [blame] | 257 | -I$(srctree)/tools/testing/selftests/bpf/ \ |
Abhijit Ayarekar | 9db9583 | 2017-10-13 12:24:06 -0700 | [diff] [blame] | 258 | -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \ |
Joel Fernandes | b655fc1 | 2017-09-20 09:11:58 -0700 | [diff] [blame] | 259 | -D__TARGET_ARCH_$(ARCH) -Wno-compare-distinct-pointer-types \ |
Alexei Starovoitov | 69a9d09 | 2016-12-01 18:31:12 -0800 | [diff] [blame] | 260 | -Wno-gnu-variable-sized-type-not-at-end \ |
| 261 | -Wno-address-of-packed-member -Wno-tautological-compare \ |
Abhijit Ayarekar | 9db9583 | 2017-10-13 12:24:06 -0700 | [diff] [blame] | 262 | -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \ |
Jesper Dangaard Brouer | 6ccfba7 | 2016-04-28 14:20:53 +0200 | [diff] [blame] | 263 | -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ |