1 # Makefile template for configure for the eBPF simulator
2 # Copyright (C) 2020-2021 Free Software Foundation, Inc.
4 # This file is part of GDB, the GNU debugger.
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.
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.
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/>.
19 ## COMMON_PRE_CONFIG_FRAG
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 \
26 BPF_HAND_OBJS
= bpf.o sim-if.o traps.o bpf-helpers.o
29 $(SIM_NEW_COMMON_OBJS
) \
35 $(CGEN_INCLUDE_DEPS
) \
39 $(srcdir)/..
/..
/opcodes
/bpf-desc.h \
40 $(srcdir)/..
/..
/opcodes
/bpf-opc.h
42 SIM_EXTRA_CLEAN
= bpf-clean
44 ## COMMON_POST_CONFIG_FRAG
46 # cgen support, enable with --enable-cgen-maint
48 # The following line is commented in or out depending upon --enable-cgen-maint.
49 @CGEN_MAINT@CGEN_MAINT
=
54 $(CGEN_MAIN_CPU_DEPS
) \
57 decode-le.h decode-be.h \
61 # Dependencies for binaries from CGEN generated source
63 mloop-le.o
: mloop-le.c
64 $(COMPILE
) -DWANT_ISA_EBPFLE mloop-le.c
66 mloop-be.o
: mloop-be.c
67 $(COMPILE
) -DWANT_ISA_EBPFBE mloop-be.c
70 decode-le.o
: decode-le.c
71 $(COMPILE
) -DWANT_ISA_EBPFLE
$(srcdir)/decode-le.c
73 decode-be.o
: decode-be.c
$(BPF_INCLUDE_DEPS
)
74 $(COMPILE
) -DWANT_ISA_EBPFBE
$(srcdir)/decode-be.c
78 $(COMPILE
) -DWANT_ISA_EBPFLE
$(srcdir)/sem-le.c
81 $(COMPILE
) -DWANT_ISA_EBPFBE
$(srcdir)/sem-be.c
88 $(srcdir)/..
/..
/cpu
/bpf.cpu \
89 $(srcdir)/..
/..
/cpu
/bpf.opc \
92 stamp-arch
: $(CGEN_COMMON_DEPS
) $(CGEN_ARCH_SCM
)
93 $(MAKE
) cgen-arch
$(CGEN_FLAGS_TO_PASS
) \
95 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
98 $(srcdir)/arch.h
$(srcdir)/arch.c
$(srcdir)/cpuall.h
: $(CGEN_MAINT
) stamp-arch
101 stamp-cpu
: $(CGEN_COMMON_DEPS
) $(CGEN_CPU_SCM
)
102 $(MAKE
) cgen-cpu
$(CGEN_FLAGS_TO_PASS
) \
103 isa
=ebpfle
,ebpfbe cpu
=bpfbf mach
=bpf \
104 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
105 FLAGS
="with-multiple-isa with-scache"
106 rm -f
$(srcdir)/model.c
108 $(srcdir)/cpu.h
$(srcdir)/cpu.c
$(srcdir)/model.c
: $(CGEN_MAINT
) stamp-cpu
111 # We need to generate a group of files per ISA.
112 # For eBPF little-endian:
114 # sem-le.c, decode-le.c, decode-le.h
115 # $(objdir)/mloop-le.c $(objdir)/eng-le.h
116 # For eBPF big-endian:
118 # sem-be.c, decode-be.c, decode-be.h
119 # $(objdir)/mloop-be.c $(objdir)/eng-le.h
121 # The rules below take care of that.
123 stamp-defs-le
: $(CGEN_COMMON_DEPS
) $(CGEN_CPU_SCM
)
124 $(MAKE
) cgen-defs
$(CGEN_FLAGS_TO_PASS
) \
125 isa
=ebpfle cpu
=bpfbf mach
=bpf \
126 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
127 FLAGS
="with-scache" \
130 $(srcdir)/defs-le.h
: $(CGEN_MAINT
) stamp-defs-le
134 stamp-defs-be
: $(CGEN_COMMON_DEPS
) $(CGEN_CPU_SCM
)
135 $(MAKE
) cgen-defs
$(CGEN_FLAGS_TO_PASS
) \
136 isa
=ebpfbe cpu
=bpfbf mach
=bpf \
137 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
138 FLAGS
="with-scache" \
141 $(srcdir)/defs-be.h
: $(CGEN_MAINT
) stamp-defs-be
144 stamp-decode-le
: $(CGEN_COMMON_DEPS
) $(CGEN_CPU_SCM
) $(GEN_DECODE_SCM
)
145 $(MAKE
) cgen-decode
$(CGEN_FLAGS_TO_PASS
) \
146 isa
=ebpfle cpu
=bpfbf mach
=bpf \
147 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
148 FLAGS
="with-scache" \
150 EXTRAFILES
="$(CGEN_CPU_SEM)"
152 $(srcdir)/sem-le.c
$(srcdir)/decode-le.c
$(srcdir)/decode-le.h
: \
153 $(CGEN_MAINT
) stamp-decode-le
157 stamp-decode-be
: $(CGEN_COMMON_DEPS
) $(CGEN_CPU_SCM
) $(GEN_DECODE_SCM
)
158 $(MAKE
) cgen-decode
$(CGEN_FLAGS_TO_PASS
) \
159 isa
=ebpfbe cpu
=bpfbf mach
=bpf \
160 archfile
=$(srcdir)/..
/..
/cpu
/bpf.cpu \
161 FLAGS
="with-scache" \
163 EXTRAFILES
="$(CGEN_CPU_SEM)"
165 $(srcdir)/sem-be.c
$(srcdir)/decode-be.c
$(srcdir)/decode-be.h
: \
166 $(CGEN_MAINT
) stamp-decode-be
169 # Note the following files are generated in objdir, not srcdir.
171 stamp-mloop
: stamp-mloop-le stamp-mloop-be
173 stamp-mloop-le
: $(srcdir)/..
/common
/genmloop.sh mloop.in Makefile
174 $(SHELL
) $(srccom
)/genmloop.sh
-shell $(SHELL
) \
175 -mono
-scache
-prefix bpfbf_ebpfle
-cpu bpfbf \
176 -infile
$(srcdir)/mloop.in
-outfile-suffix
-le
177 $(SHELL
) $(srcroot
)/move-if-change eng-le.hin eng-le.h
178 $(SHELL
) $(srcroot
)/move-if-change mloop-le.cin mloop-le.c
180 mloop-le.c eng-le.h
: stamp-mloop-le
183 stamp-mloop-be
: $(srcdir)/..
/common
/genmloop.sh mloop.in Makefile
184 $(SHELL
) $(srccom
)/genmloop.sh
-shell $(SHELL
) \
185 -mono
-scache
-prefix bpfbf_ebpfbe
-cpu bpfbf \
186 -infile
$(srcdir)/mloop.in
-outfile-suffix
-be
187 $(SHELL
) $(srcroot
)/move-if-change eng-be.hin eng-be.h
188 $(SHELL
) $(srcroot
)/move-if-change mloop-be.cin mloop-be.c
190 mloop-be.c eng-be.h
: stamp-mloop-be
196 rm -f stamp-arch stamp-cpu stamp-decode stamp-defs stamp-mloop