Commit | Line | Data |
---|---|---|
b26e2ae7 | 1 | # Makefile template for configure for the eBPF simulator |
88b9d363 | 2 | # Copyright (C) 2020-2022 Free Software Foundation, Inc. |
b26e2ae7 JM |
3 | # |
4 | # This file is part of GDB, the GNU debugger. | |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 3 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | ## COMMON_PRE_CONFIG_FRAG | |
20 | ||
21 | CGEN_STD_OBJS = cgen-run.o cgen-scache.o cgen-trace.o cgen-utils.o | |
22 | BPF_GEN_OBJS = arch.o cpu.o \ | |
23 | decode-le.o decode-be.o \ | |
24 | sem-le.o sem-be.o \ | |
25 | mloop-le.o mloop-be.o | |
26 | BPF_HAND_OBJS = bpf.o sim-if.o traps.o bpf-helpers.o | |
27 | ||
28 | SIM_OBJS = \ | |
29 | $(SIM_NEW_COMMON_OBJS) \ | |
30 | $(CGEN_STD_OBJS) \ | |
31 | $(BPF_GEN_OBJS) \ | |
32 | $(BPF_HAND_OBJS) | |
33 | ||
34 | SIM_EXTRA_DEPS = \ | |
35 | $(CGEN_INCLUDE_DEPS) \ | |
36 | arch.h \ | |
37 | bpf-sim.h \ | |
e7d8f1da | 38 | eng-le.h eng-be.h \ |
b26e2ae7 JM |
39 | $(srcdir)/../../opcodes/bpf-desc.h \ |
40 | $(srcdir)/../../opcodes/bpf-opc.h | |
41 | ||
42 | SIM_EXTRA_CLEAN = bpf-clean | |
43 | ||
44 | ## COMMON_POST_CONFIG_FRAG | |
45 | ||
b26e2ae7 JM |
46 | # BPF headers |
47 | ||
48 | BPF_INCLUDE_DEPS = \ | |
49 | $(CGEN_MAIN_CPU_DEPS) \ | |
50 | $(SIM_EXTRA_DEPS) \ | |
51 | cpu.h cpuall.h \ | |
52 | decode-le.h decode-be.h \ | |
53 | defs-le.h defs-be.h \ | |
52d37d2c | 54 | eng-le.h eng-be.h |
b26e2ae7 JM |
55 | |
56 | # Dependencies for binaries from CGEN generated source | |
57 | ||
e7d8f1da TT |
58 | mloop-le.o: mloop-le.c |
59 | $(COMPILE) -DWANT_ISA_EBPFLE mloop-le.c | |
b26e2ae7 | 60 | $(POSTCOMPILE) |
e7d8f1da TT |
61 | mloop-be.o: mloop-be.c |
62 | $(COMPILE) -DWANT_ISA_EBPFBE mloop-be.c | |
b26e2ae7 JM |
63 | $(POSTCOMPILE) |
64 | ||
e7d8f1da TT |
65 | decode-le.o: decode-le.c |
66 | $(COMPILE) -DWANT_ISA_EBPFLE $(srcdir)/decode-le.c | |
67 | $(POSTCOMPILE) | |
b26e2ae7 | 68 | decode-be.o: decode-be.c $(BPF_INCLUDE_DEPS) |
e7d8f1da TT |
69 | $(COMPILE) -DWANT_ISA_EBPFBE $(srcdir)/decode-be.c |
70 | $(POSTCOMPILE) | |
b26e2ae7 | 71 | |
e7d8f1da TT |
72 | sem-le.o: sem-le.c |
73 | $(COMPILE) -DWANT_ISA_EBPFLE $(srcdir)/sem-le.c | |
74 | $(POSTCOMPILE) | |
75 | sem-be.o: sem-be.c | |
76 | $(COMPILE) -DWANT_ISA_EBPFBE $(srcdir)/sem-be.c | |
77 | $(POSTCOMPILE) | |
b26e2ae7 JM |
78 | |
79 | arch = bpf | |
80 | ||
81 | CGEN_COMMON_DEPS = \ | |
82 | $(CGEN_READ_SCM) \ | |
83 | $(srcdir)/../../cpu/bpf.cpu \ | |
84 | $(srcdir)/../../cpu/bpf.opc \ | |
85 | Makefile | |
86 | ||
87 | stamp-arch: $(CGEN_COMMON_DEPS) $(CGEN_ARCH_SCM) | |
88 | $(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) \ | |
89 | mach=bpf cpu=bpfbf \ | |
90 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
91 | FLAGS="with-scache" | |
92 | touch $@ | |
93 | $(srcdir)/arch.h $(srcdir)/arch.c $(srcdir)/cpuall.h: $(CGEN_MAINT) stamp-arch | |
94 | @true | |
95 | ||
96 | stamp-cpu: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
97 | $(MAKE) cgen-cpu $(CGEN_FLAGS_TO_PASS) \ | |
98 | isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf \ | |
99 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
100 | FLAGS="with-multiple-isa with-scache" | |
101 | rm -f $(srcdir)/model.c | |
102 | touch $@ | |
103 | $(srcdir)/cpu.h $(srcdir)/cpu.c $(srcdir)/model.c: $(CGEN_MAINT) stamp-cpu | |
104 | @true | |
105 | ||
106 | # We need to generate a group of files per ISA. | |
107 | # For eBPF little-endian: | |
108 | # defs-le.h | |
109 | # sem-le.c, decode-le.c, decode-le.h | |
110 | # $(objdir)/mloop-le.c $(objdir)/eng-le.h | |
111 | # For eBPF big-endian: | |
112 | # defs-be.h | |
113 | # sem-be.c, decode-be.c, decode-be.h | |
114 | # $(objdir)/mloop-be.c $(objdir)/eng-le.h | |
115 | # | |
116 | # The rules below take care of that. | |
117 | ||
118 | stamp-defs-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
119 | $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \ | |
120 | isa=ebpfle cpu=bpfbf mach=bpf \ | |
121 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
122 | FLAGS="with-scache" \ | |
123 | SUFFIX="-le" | |
124 | touch $@ | |
125 | $(srcdir)/defs-le.h: $(CGEN_MAINT) stamp-defs-le | |
126 | @true | |
127 | ||
128 | ||
129 | stamp-defs-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
130 | $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \ | |
131 | isa=ebpfbe cpu=bpfbf mach=bpf \ | |
132 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
133 | FLAGS="with-scache" \ | |
134 | SUFFIX="-be" | |
135 | touch $@ | |
136 | $(srcdir)/defs-be.h: $(CGEN_MAINT) stamp-defs-be | |
137 | @true | |
138 | ||
139 | stamp-decode-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM) | |
140 | $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \ | |
141 | isa=ebpfle cpu=bpfbf mach=bpf \ | |
142 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
143 | FLAGS="with-scache" \ | |
144 | SUFFIX="-le" \ | |
145 | EXTRAFILES="$(CGEN_CPU_SEM)" | |
146 | touch $@ | |
147 | $(srcdir)/sem-le.c $(srcdir)/decode-le.c $(srcdir)/decode-le.h: \ | |
148 | $(CGEN_MAINT) stamp-decode-le | |
149 | @true | |
150 | ||
151 | ||
152 | stamp-decode-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM) | |
153 | $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \ | |
154 | isa=ebpfbe cpu=bpfbf mach=bpf \ | |
155 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
156 | FLAGS="with-scache" \ | |
157 | SUFFIX="-be" \ | |
158 | EXTRAFILES="$(CGEN_CPU_SEM)" | |
159 | touch $@ | |
160 | $(srcdir)/sem-be.c $(srcdir)/decode-be.c $(srcdir)/decode-be.h: \ | |
161 | $(CGEN_MAINT) stamp-decode-be | |
162 | @true | |
163 | ||
164 | # Note the following files are generated in objdir, not srcdir. | |
165 | ||
166 | stamp-mloop: stamp-mloop-le stamp-mloop-be | |
167 | ||
168 | stamp-mloop-le: $(srcdir)/../common/genmloop.sh mloop.in Makefile | |
169 | $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \ | |
170 | -mono -scache -prefix bpfbf_ebpfle -cpu bpfbf \ | |
171 | -infile $(srcdir)/mloop.in -outfile-suffix -le | |
172 | $(SHELL) $(srcroot)/move-if-change eng-le.hin eng-le.h | |
173 | $(SHELL) $(srcroot)/move-if-change mloop-le.cin mloop-le.c | |
174 | touch $@ | |
175 | mloop-le.c eng-le.h: stamp-mloop-le | |
176 | @true | |
177 | ||
178 | stamp-mloop-be: $(srcdir)/../common/genmloop.sh mloop.in Makefile | |
179 | $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \ | |
180 | -mono -scache -prefix bpfbf_ebpfbe -cpu bpfbf \ | |
181 | -infile $(srcdir)/mloop.in -outfile-suffix -be | |
182 | $(SHELL) $(srcroot)/move-if-change eng-be.hin eng-be.h | |
183 | $(SHELL) $(srcroot)/move-if-change mloop-be.cin mloop-be.c | |
184 | touch $@ | |
185 | mloop-be.c eng-be.h: stamp-mloop-be | |
186 | @true | |
187 | ||
188 | .PHONY = bpf-clean | |
189 | ||
190 | bpf-clean: | |
191 | rm -f stamp-arch stamp-cpu stamp-decode stamp-defs stamp-mloop |