d0cd4f851fc60aa3f4b2a00352086ea6c3c30e24
[external/binutils.git] / gdb / features / Makefile
1 # Copyright (C) 2007-2019 Free Software Foundation, Inc.
2
3 # This file is part of GDB.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 # This file requires GNU make!
20
21 # This Makefile updates files in ../regformats from their XML master
22 # copies.  Because this relies on xsltproc, it is not normally run
23 # during the build process; it should be run by hand when one of the
24 # affected XML files is changed, and the results should be kept in the
25 # GDB repository.
26
27 # It can also update the C files in the features directory from their
28 # XML master copies.  This relies on a GDB linked with expat and that
29 # is configured to include support for the architecture, so the files
30 # are kept in the GDB repository.
31 #
32 # By default we'll generate all C files, and you must point make at a
33 # GDB that has been configured with --enable-targets=all:
34 #
35 #   make GDB=/path/to/gdb cfiles
36 #
37 # To regenerate all C files from scratch:
38 #
39 #   make GDB=/path/to/gdb clean-cfiles cfiles
40 #
41 # To generate specific C files, you can override the XMLTOC make
42 # variable:
43 #
44 #   make GDB=/path/to/gdb XMLTOC="xml files" cfiles
45
46 WHICH = aarch64 \
47         arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
48         arm/arm-with-neon \
49         i386/i386 i386/i386-linux \
50         i386/i386-mmx-linux \
51         i386/amd64 i386/amd64-linux \
52         i386/i386-avx-linux \
53         i386/i386-mpx-linux \
54         i386/i386-avx-mpx-linux \
55         i386/i386-avx-avx512-linux \
56         i386/i386-avx-mpx-avx512-pku-linux \
57         i386/amd64-avx-linux \
58         i386/amd64-mpx-linux \
59         i386/amd64-avx-mpx-linux \
60         i386/amd64-avx-avx512-linux \
61         i386/amd64-avx-mpx-avx512-pku-linux \
62         i386/x32-linux \
63         i386/x32-avx-linux \
64         i386/x32-avx-avx512-linux \
65         mips-linux mips-dsp-linux \
66         microblaze-with-stack-protect \
67         mips64-linux mips64-dsp-linux \
68         nios2-linux \
69         rs6000/powerpc-32 \
70         rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \
71         rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \
72         rs6000/powerpc-vsx64l rs6000/powerpc-cell32l rs6000/powerpc-cell64l \
73         rs6000/powerpc-isa205-32l rs6000/powerpc-isa205-64l \
74         rs6000/powerpc-isa205-altivec32l rs6000/powerpc-isa205-altivec64l \
75         rs6000/powerpc-isa205-vsx32l rs6000/powerpc-isa205-vsx64l \
76         rs6000/powerpc-isa205-ppr-dscr-vsx32l \
77         rs6000/powerpc-isa205-ppr-dscr-vsx64l \
78         rs6000/powerpc-isa207-vsx32l rs6000/powerpc-isa207-vsx64l \
79         rs6000/powerpc-isa207-htm-vsx32l \
80         rs6000/powerpc-isa207-htm-vsx64l \
81         s390-linux32 s390-linux64 s390x-linux64 \
82         s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
83         s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
84         s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \
85         s390-tevx-linux64 s390x-tevx-linux64 \
86         s390-gs-linux64 s390x-gs-linux64 \
87         tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
88
89 # Record which registers should be sent to GDB by default after stop.
90 aarch64-expedite = x29,sp,pc
91 arm-expedite = r11,sp,pc
92 i386-expedite = ebp,esp,eip
93 amd64-expedite = rbp,rsp,rip
94 x32-expedite = rbp,rsp,rip
95 mips-expedite = r29,pc
96 mips-dsp-expedite = r29,pc
97 mips64-expedite = r29,pc
98 mips64-dsp-expedite = r29,pc
99 microblaze-expedite = r1,rpc
100 nios2-linux-expedite = sp,pc
101 or1k-expedite = r1,npc
102 powerpc-expedite = r1,pc
103 rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4
104 rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4
105 s390-linux32-expedite = r14,r15,pswa
106 s390-linux32v1-expedite = r14,r15,pswa
107 s390-linux32v2-expedite = r14,r15,pswa
108 s390-linux64-expedite = r14l,r15l,pswa
109 s390-linux64v1-expedite = r14l,r15l,pswa
110 s390-linux64v2-expedite = r14l,r15l,pswa
111 s390-te-linux64-expedite = r14l,r15l,pswa
112 s390-vx-linux64-expedite = r14l,r15l,pswa
113 s390-tevx-linux64-expedite = r14l,r15l,pswa
114 s390-gs-linux64-expedite = r14,r15,pswa
115 s390x-expedite = r14,r15,pswa
116 tic6x-expedite = A15,PC
117
118
119 XSLTPROC = xsltproc
120 outdir = ../regformats
121 OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
122
123 # The set of xml files we'll generate .c files for GDB from.  By
124 # default we'll build all .c files, which requires an
125 # --enable-targets=all GDB.  You can override this by passing XMLTOC
126 # to make on the command line.
127 XMLTOC = \
128         arc-v2.xml \
129         arc-arcompact.xml \
130         arm/arm-with-iwmmxt.xml \
131         arm/arm-with-m-fpa-layout.xml \
132         arm/arm-with-m-vfp-d16.xml \
133         arm/arm-with-m.xml \
134         arm/arm-with-neon.xml \
135         arm/arm-with-vfpv2.xml \
136         arm/arm-with-vfpv3.xml \
137         microblaze-with-stack-protect.xml \
138         microblaze.xml \
139         mips-dsp-linux.xml \
140         mips-linux.xml \
141         mips64-dsp-linux.xml \
142         mips64-linux.xml \
143         nds32.xml \
144         nios2.xml \
145         or1k.xml \
146         rs6000/powerpc-32.xml \
147         rs6000/powerpc-32l.xml \
148         rs6000/powerpc-403.xml \
149         rs6000/powerpc-403gc.xml \
150         rs6000/powerpc-405.xml \
151         rs6000/powerpc-505.xml \
152         rs6000/powerpc-601.xml \
153         rs6000/powerpc-602.xml \
154         rs6000/powerpc-603.xml \
155         rs6000/powerpc-604.xml \
156         rs6000/powerpc-64.xml \
157         rs6000/powerpc-64l.xml \
158         rs6000/powerpc-7400.xml \
159         rs6000/powerpc-750.xml \
160         rs6000/powerpc-860.xml \
161         rs6000/powerpc-altivec32.xml \
162         rs6000/powerpc-altivec32l.xml \
163         rs6000/powerpc-altivec64.xml \
164         rs6000/powerpc-altivec64l.xml \
165         rs6000/powerpc-cell32l.xml \
166         rs6000/powerpc-cell64l.xml \
167         rs6000/powerpc-e500.xml \
168         rs6000/powerpc-e500l.xml \
169         rs6000/powerpc-isa205-32l.xml \
170         rs6000/powerpc-isa205-64l.xml \
171         rs6000/powerpc-isa205-altivec32l.xml \
172         rs6000/powerpc-isa205-altivec64l.xml \
173         rs6000/powerpc-isa205-vsx32l.xml \
174         rs6000/powerpc-isa205-vsx64l.xml \
175         rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml \
176         rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml \
177         rs6000/powerpc-isa207-vsx32l.xml \
178         rs6000/powerpc-isa207-vsx64l.xml \
179         rs6000/powerpc-isa207-htm-vsx32l.xml \
180         rs6000/powerpc-isa207-htm-vsx64l.xml \
181         rs6000/powerpc-vsx32.xml \
182         rs6000/powerpc-vsx32l.xml \
183         rs6000/powerpc-vsx64.xml \
184         rs6000/powerpc-vsx64l.xml \
185         rs6000/rs6000.xml \
186         s390-linux32.xml \
187         s390-linux32v1.xml \
188         s390-linux32v2.xml \
189         s390-linux64.xml \
190         s390-linux64v1.xml \
191         s390-linux64v2.xml \
192         s390-te-linux64.xml \
193         s390x-linux64.xml \
194         s390x-linux64v1.xml \
195         s390x-linux64v2.xml \
196         s390x-te-linux64.xml \
197         s390-tevx-linux64.xml \
198         s390-vx-linux64.xml \
199         s390x-tevx-linux64.xml \
200         s390x-vx-linux64.xml \
201         s390-gs-linux64.xml \
202         s390x-gs-linux64.xml
203
204 TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
205 GDB = false
206
207 #Targets which use feature based target descriptions.
208 aarch64-feature = 1
209 i386-feature = 1
210 riscv-feature = 1
211 tic6x-feature = 1
212
213 all: $(OUTPUTS)
214
215 $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
216         echo "# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:" > $(outdir)/$*.tmp
217         echo "# Generated from: $<" >> $(outdir)/$*.tmp
218         echo "name:`echo $(notdir $*) | sed 's/-/_/g'`" >> $(outdir)/$*.tmp
219         $(if $($(firstword $(subst /, ,$(subst -, ,$*)))-feature), echo "feature:1") >> $(outdir)/$*.tmp
220         echo "xmltarget:$(<F)" >> $(outdir)/$*.tmp
221         echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
222           >> $(outdir)/$*.tmp
223         $(XSLTPROC) --path "$(PWD)" --xinclude number-regs.xsl $< | \
224           $(XSLTPROC) sort-regs.xsl - | \
225           $(XSLTPROC) gdbserver-regs.xsl - >> $(outdir)/$*.tmp
226         sh ../../move-if-change $(outdir)/$*.tmp $(outdir)/$*.dat
227
228 FEATURE_XMLFILES = aarch64-core.xml \
229         aarch64-fpu.xml \
230         aarch64-pauth.xml \
231         i386/32bit-core.xml \
232         i386/32bit-sse.xml \
233         i386/32bit-linux.xml \
234         i386/32bit-avx.xml \
235         i386/32bit-mpx.xml \
236         i386/32bit-avx512.xml \
237         i386/32bit-pkeys.xml \
238         i386/64bit-avx512.xml \
239         i386/64bit-core.xml \
240         i386/64bit-mpx.xml \
241         i386/64bit-segments.xml \
242         i386/64bit-avx.xml \
243         i386/64bit-linux.xml \
244         i386/64bit-pkeys.xml \
245         i386/64bit-sse.xml \
246         i386/x32-core.xml \
247         riscv/32bit-cpu.xml \
248         riscv/32bit-csr.xml \
249         riscv/32bit-fpu.xml \
250         riscv/64bit-cpu.xml \
251         riscv/64bit-csr.xml \
252         riscv/64bit-fpu.xml \
253         tic6x-c6xp.xml \
254         tic6x-core.xml \
255         tic6x-gp.xml
256
257 FEATURE_CFILES = $(patsubst %.xml,%.c,$(FEATURE_XMLFILES))
258
259 cfiles: $(TDESC_CFILES) $(FEATURE_CFILES)
260
261 $(TDESC_CFILES): %.c: %.xml
262         $(GDB) -nx -q -batch -ex 'maint print c-tdesc $<' > $@.tmp
263         sh ../../move-if-change $@.tmp $@
264
265 $(FEATURE_CFILES): %.c: %.xml.tmp
266         $(GDB) -nx -q -batch \
267           -ex 'maint print c-tdesc $<' > $@.tmp
268         sh ../../move-if-change $@.tmp $@
269         rm $<
270
271 # %.xml is the XML file for each target description feature, and
272 # %.xml.tmp is the XML file target description which only includes
273 # one target description feature.
274
275 %.xml.tmp: %.xml
276         echo "<?xml version=\"1.0\"?>" > $@.tmp
277         echo "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">" >> $@.tmp
278         echo "<target>" >> $@.tmp
279         echo "  <xi:include href=\"$(notdir $<)\"/>" >> $@.tmp
280         echo "</target>" >> $@.tmp
281         sh ../../move-if-change $@.tmp $@
282
283 # Other dependencies.
284 $(outdir)/arm/arm-with-iwmmxt.dat: arm/arm-core.xml arm/xscale-iwmmxt.xml
285 $(outdir)/i386/i386.dat: i386/32bit-core.xml i386/32bit-sse.xml
286 $(outdir)/i386/i386-linux.dat: i386/32bit-core.xml i386/32bit-sse.xml \
287                                i386/32bit-linux.xml
288 $(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml \
289                                i386/64bit-segments.xml
290 $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \
291                                i386/64bit-linux.xml i386/64bit-segments.xml
292 $(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml
293 $(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \
294                                i386/32bit-linux.xml
295 $(outdir)/i386/i386-mpx.dat: i386/32bit-core.xml i386/32bit-avx.xml \
296                                i386/32bit-mpx.xml
297 $(outdir)/i386/i386-mpx-linux.dat: i386/32bit-core.xml  i386/32bit-avx.xml \
298                                i386/32bit-linux.xml i386/32bit-mpx.xml
299 $(outdir)/i386/i386-mpx-linux.dat: i386/32bit-core.xml \
300                                i386/32bit-linux.xml i386/32bit-mpx.xml
301 $(outdir)/i386/i386-avx-mpx-linux.dat: i386/32bit-core.xml \
302                                i386/32bit-linux.xml i386/32bit-mpx.xml
303 $(outdir)/i386/i386-avx-avx512.dat: i386/32bit-core.xml i386/32bit-avx.xml \
304                                i386/32bit-avx512.xml
305 $(outdir)/i386/i386-avx-avx512-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \
306                                i386/32bit-linux.xml i386/32bit-avx512.xml
307 $(outdir)/i386/i386-avx-mpx-avx512-pku.dat: i386/32bit-core.xml \
308                                i386/32bit-avx.xml i386/32bit-mpx.xml i386/32bit-avx512.xml \
309                                i386/32bit-pkeys.xml
310 $(outdir)/i386/i386-avx-mpx-avx512-pku-linux.dat: i386/32bit-core.xml \
311                                i386/32bit-avx.xml i386/32bit-mpx.xml i386/32bit-avx512.xml \
312                                i386/32bit-pkeys.xml i386/32bit-linux.xml
313 $(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml 
314 $(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml
315 $(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml \
316                                i386/64bit-segments.xml
317 $(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \
318                                i386/64bit-linux.xml i386/64bit-segments.xml
319 $(outdir)/i386/amd64-mpx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \
320                                i386/64bit-linux.xml i386/64bit-segments.xml i386/64bit-mpx.xml
321 $(outdir)/i386/amd64-avx-mpx-linux.dat: i386/64bit-core.xml \
322                                i386/64bit-linux.xml i386/64bit-segments.xml i386/64bit-mpx.xml
323 $(outdir)/i386/amd64-mpx.dat: i386/64bit-core.xml i386/64bit-avx.xml \
324                                i386/64bit-segments.xml i386/64bit-mpx.xml
325 $(outdir)/i386/amd64-avx-mpx.dat: i386/64bit-core.xml \
326                                i386/64bit-segments.xml i386/64bit-mpx.xml
327 $(outdir)/i386/amd64-avx-avx512.dat: i386/64bit-core.xml i386/64bit-avx.xml \
328                                i386/64bit-avx512.xml i386/64bit-segments.xml
329 $(outdir)/i386/amd64-avx-avx512-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \
330                                i386/64bit-avx512.xml i386/64bit-linux.xml
331 $(outdir)/i386/amd64-avx-mpx-avx512-pku.dat: i386/64bit-core.xml \
332                                i386/64bit-avx.xml i386/64bit-mpx.xml i386/64bit-avx512.xml \
333                                i386/64bit-pkeys.xml i386/64bit-segments.xml
334 $(outdir)/i386/amd64-avx-mpx-avx512-pku-linux.dat: i386/64bit-core.xml \
335                                i386/64bit-avx.xml i386/64bit-mpx.xml i386/64bit-avx512.xml \
336                                i386/64bit-linux.xml i386/64bit-segments.xml \
337                                i386/64bit-pkeys.xml
338 $(outdir)/i386/x32.dat: i386/x32-core.xml i386/64bit-sse.xml
339 $(outdir)/i386/x32-linux.dat: i386/x32-core.xml i386/64bit-sse.xml \
340                                i386/64bit-linux.xml i386/64bit-segments.xml
341 $(outdir)/i386/x32-avx.dat: i386/x32-core.xml i386/64bit-avx.xml
342 $(outdir)/i386/x32-avx-linux.dat: i386/x32-core.xml i386/64bit-avx.xml \
343                                i386/64bit-linux.xml i386/64bit-segments.xml
344 $(outdir)/i386/x32-avx-avx512.dat: i386/x32-core.xml i386/64bit-avx.xml \
345                                i386/64bit-avx512.xml
346 $(outdir)/i386/x32-avx-avx512-linux.dat: i386/x32-core.xml i386/64bit-avx.xml \
347                                i386/64bit-avx512.xml i386/64bit-linux.xml \
348                                i386/64bit-segments.xml
349
350 # Regenerate RISC-V CSR feature lists.
351 riscv/32bit-csr.xml riscv/64bit-csr.xml: ../../include/opcode/riscv-opc.h
352         ./riscv/rebuild-csr-xml.sh ../../include/opcode/riscv-opc.h ./riscv
353
354 # 'all' doesn't build the C files, so don't delete them in 'clean'
355 # either.
356 clean-cfiles:
357         rm -f $(TDESC_CFILES) $(FEATURE_CFILES)
358
359 clean:
360         rm -f $(OUTPUTS)