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