]>
Commit | Line | Data |
---|---|---|
b26e2ae7 | 1 | # Makefile template for configure for the eBPF simulator |
3666a048 | 2 | # Copyright (C) 2020-2021 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 | ||
46 | # cgen support, enable with --enable-cgen-maint | |
47 | CGEN_MAINT = ; @true | |
48 | # The following line is commented in or out depending upon --enable-cgen-maint. | |
49 | @CGEN_MAINT@CGEN_MAINT = | |
50 | ||
51 | # BPF headers | |
52 | ||
53 | BPF_INCLUDE_DEPS = \ | |
54 | $(CGEN_MAIN_CPU_DEPS) \ | |
55 | $(SIM_EXTRA_DEPS) \ | |
56 | cpu.h cpuall.h \ | |
57 | decode-le.h decode-be.h \ | |
58 | defs-le.h defs-be.h \ | |
59 | eng-le.h eng-be.h \ | |
60 | config.h | |
61 | ||
62 | # Dependencies for binaries from CGEN generated source | |
63 | ||
e7d8f1da TT |
64 | mloop-le.o: mloop-le.c |
65 | $(COMPILE) -DWANT_ISA_EBPFLE mloop-le.c | |
b26e2ae7 | 66 | $(POSTCOMPILE) |
e7d8f1da TT |
67 | mloop-be.o: mloop-be.c |
68 | $(COMPILE) -DWANT_ISA_EBPFBE mloop-be.c | |
b26e2ae7 JM |
69 | $(POSTCOMPILE) |
70 | ||
e7d8f1da TT |
71 | decode-le.o: decode-le.c |
72 | $(COMPILE) -DWANT_ISA_EBPFLE $(srcdir)/decode-le.c | |
73 | $(POSTCOMPILE) | |
b26e2ae7 | 74 | decode-be.o: decode-be.c $(BPF_INCLUDE_DEPS) |
e7d8f1da TT |
75 | $(COMPILE) -DWANT_ISA_EBPFBE $(srcdir)/decode-be.c |
76 | $(POSTCOMPILE) | |
b26e2ae7 | 77 | |
e7d8f1da TT |
78 | sem-le.o: sem-le.c |
79 | $(COMPILE) -DWANT_ISA_EBPFLE $(srcdir)/sem-le.c | |
80 | $(POSTCOMPILE) | |
81 | sem-be.o: sem-be.c | |
82 | $(COMPILE) -DWANT_ISA_EBPFBE $(srcdir)/sem-be.c | |
83 | $(POSTCOMPILE) | |
b26e2ae7 JM |
84 | |
85 | arch = bpf | |
86 | ||
87 | CGEN_COMMON_DEPS = \ | |
88 | $(CGEN_READ_SCM) \ | |
89 | $(srcdir)/../../cpu/bpf.cpu \ | |
90 | $(srcdir)/../../cpu/bpf.opc \ | |
91 | Makefile | |
92 | ||
93 | stamp-arch: $(CGEN_COMMON_DEPS) $(CGEN_ARCH_SCM) | |
94 | $(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) \ | |
95 | mach=bpf cpu=bpfbf \ | |
96 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
97 | FLAGS="with-scache" | |
98 | touch $@ | |
99 | $(srcdir)/arch.h $(srcdir)/arch.c $(srcdir)/cpuall.h: $(CGEN_MAINT) stamp-arch | |
100 | @true | |
101 | ||
102 | stamp-cpu: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
103 | $(MAKE) cgen-cpu $(CGEN_FLAGS_TO_PASS) \ | |
104 | isa=ebpfle,ebpfbe cpu=bpfbf mach=bpf \ | |
105 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
106 | FLAGS="with-multiple-isa with-scache" | |
107 | rm -f $(srcdir)/model.c | |
108 | touch $@ | |
109 | $(srcdir)/cpu.h $(srcdir)/cpu.c $(srcdir)/model.c: $(CGEN_MAINT) stamp-cpu | |
110 | @true | |
111 | ||
112 | # We need to generate a group of files per ISA. | |
113 | # For eBPF little-endian: | |
114 | # defs-le.h | |
115 | # sem-le.c, decode-le.c, decode-le.h | |
116 | # $(objdir)/mloop-le.c $(objdir)/eng-le.h | |
117 | # For eBPF big-endian: | |
118 | # defs-be.h | |
119 | # sem-be.c, decode-be.c, decode-be.h | |
120 | # $(objdir)/mloop-be.c $(objdir)/eng-le.h | |
121 | # | |
122 | # The rules below take care of that. | |
123 | ||
124 | stamp-defs-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
125 | $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \ | |
126 | isa=ebpfle cpu=bpfbf mach=bpf \ | |
127 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
128 | FLAGS="with-scache" \ | |
129 | SUFFIX="-le" | |
130 | touch $@ | |
131 | $(srcdir)/defs-le.h: $(CGEN_MAINT) stamp-defs-le | |
132 | @true | |
133 | ||
134 | ||
135 | stamp-defs-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) | |
136 | $(MAKE) cgen-defs $(CGEN_FLAGS_TO_PASS) \ | |
137 | isa=ebpfbe cpu=bpfbf mach=bpf \ | |
138 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
139 | FLAGS="with-scache" \ | |
140 | SUFFIX="-be" | |
141 | touch $@ | |
142 | $(srcdir)/defs-be.h: $(CGEN_MAINT) stamp-defs-be | |
143 | @true | |
144 | ||
145 | stamp-decode-le: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM) | |
146 | $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \ | |
147 | isa=ebpfle cpu=bpfbf mach=bpf \ | |
148 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
149 | FLAGS="with-scache" \ | |
150 | SUFFIX="-le" \ | |
151 | EXTRAFILES="$(CGEN_CPU_SEM)" | |
152 | touch $@ | |
153 | $(srcdir)/sem-le.c $(srcdir)/decode-le.c $(srcdir)/decode-le.h: \ | |
154 | $(CGEN_MAINT) stamp-decode-le | |
155 | @true | |
156 | ||
157 | ||
158 | stamp-decode-be: $(CGEN_COMMON_DEPS) $(CGEN_CPU_SCM) $(GEN_DECODE_SCM) | |
159 | $(MAKE) cgen-decode $(CGEN_FLAGS_TO_PASS) \ | |
160 | isa=ebpfbe cpu=bpfbf mach=bpf \ | |
161 | archfile=$(srcdir)/../../cpu/bpf.cpu \ | |
162 | FLAGS="with-scache" \ | |
163 | SUFFIX="-be" \ | |
164 | EXTRAFILES="$(CGEN_CPU_SEM)" | |
165 | touch $@ | |
166 | $(srcdir)/sem-be.c $(srcdir)/decode-be.c $(srcdir)/decode-be.h: \ | |
167 | $(CGEN_MAINT) stamp-decode-be | |
168 | @true | |
169 | ||
170 | # Note the following files are generated in objdir, not srcdir. | |
171 | ||
172 | stamp-mloop: stamp-mloop-le stamp-mloop-be | |
173 | ||
174 | stamp-mloop-le: $(srcdir)/../common/genmloop.sh mloop.in Makefile | |
175 | $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \ | |
176 | -mono -scache -prefix bpfbf_ebpfle -cpu bpfbf \ | |
177 | -infile $(srcdir)/mloop.in -outfile-suffix -le | |
178 | $(SHELL) $(srcroot)/move-if-change eng-le.hin eng-le.h | |
179 | $(SHELL) $(srcroot)/move-if-change mloop-le.cin mloop-le.c | |
180 | touch $@ | |
181 | mloop-le.c eng-le.h: stamp-mloop-le | |
182 | @true | |
183 | ||
184 | stamp-mloop-be: $(srcdir)/../common/genmloop.sh mloop.in Makefile | |
185 | $(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \ | |
186 | -mono -scache -prefix bpfbf_ebpfbe -cpu bpfbf \ | |
187 | -infile $(srcdir)/mloop.in -outfile-suffix -be | |
188 | $(SHELL) $(srcroot)/move-if-change eng-be.hin eng-be.h | |
189 | $(SHELL) $(srcroot)/move-if-change mloop-be.cin mloop-be.c | |
190 | touch $@ | |
191 | mloop-be.c eng-be.h: stamp-mloop-be | |
192 | @true | |
193 | ||
194 | .PHONY = bpf-clean | |
195 | ||
196 | bpf-clean: | |
197 | rm -f stamp-arch stamp-cpu stamp-decode stamp-defs stamp-mloop |