1 # Copyright (C) 2007-2024 Free Software Foundation, Inc.
3 # This file is part of GDB.
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.
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.
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/>.
19 # This file requires GNU make!
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
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.
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:
35 # make GDB=/path/to/gdb cfiles
37 # To regenerate all C files from scratch:
39 # make GDB=/path/to/gdb clean-cfiles cfiles
41 # To generate specific C files, you can override the XMLTOC and
42 # FEATURE_XMLFILES make variables:
44 # make GDB=/path/to/gdb XMLTOC="xml files" FEATURE_XMLFILES="xml files" cfiles
46 # List of .dat files to create in ../regformats/
47 WHICH
= mips-linux mips-dsp-linux \
48 mips64-linux mips64-dsp-linux \
51 rs6000
/powerpc-32l rs6000
/powerpc-altivec32l rs6000
/powerpc-e500l \
52 rs6000
/powerpc-64l rs6000
/powerpc-altivec64l rs6000
/powerpc-vsx32l \
53 rs6000
/powerpc-vsx64l \
54 rs6000
/powerpc-isa205-32l rs6000
/powerpc-isa205-64l \
55 rs6000
/powerpc-isa205-altivec32l rs6000
/powerpc-isa205-altivec64l \
56 rs6000
/powerpc-isa205-vsx32l rs6000
/powerpc-isa205-vsx64l \
57 rs6000
/powerpc-isa205-ppr-dscr-vsx32l \
58 rs6000
/powerpc-isa205-ppr-dscr-vsx64l \
59 rs6000
/powerpc-isa207-vsx32l rs6000
/powerpc-isa207-vsx64l \
60 rs6000
/powerpc-isa207-htm-vsx32l \
61 rs6000
/powerpc-isa207-htm-vsx64l \
62 s390-linux32 s390-linux64 s390x-linux64 \
63 s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
64 s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
65 s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \
66 s390-tevx-linux64 s390x-tevx-linux64 \
67 s390-gs-linux64 s390x-gs-linux64 \
68 tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
70 # Record which registers should be sent to GDB by default after stop.
71 mips-expedite
= r29
,pc
72 mips-dsp-expedite
= r29
,pc
73 mips64-expedite
= r29
,pc
74 mips64-dsp-expedite
= r29
,pc
75 or1k-expedite
= r1
,npc
76 powerpc-expedite
= r1
,pc
77 s390-linux32-expedite
= r14
,r15
,pswa
78 s390-linux32v1-expedite
= r14
,r15
,pswa
79 s390-linux32v2-expedite
= r14
,r15
,pswa
80 s390-linux64-expedite
= r14l
,r15l
,pswa
81 s390-linux64v1-expedite
= r14l
,r15l
,pswa
82 s390-linux64v2-expedite
= r14l
,r15l
,pswa
83 s390-te-linux64-expedite
= r14l
,r15l
,pswa
84 s390-vx-linux64-expedite
= r14l
,r15l
,pswa
85 s390-tevx-linux64-expedite
= r14l
,r15l
,pswa
86 s390-gs-linux64-expedite
= r14
,r15
,pswa
87 s390x-expedite
= r14
,r15
,pswa
88 tic6x-expedite
= A15
,PC
92 outdir
= ..
/regformats
93 OUTPUTS
= $(patsubst %,$(outdir
)/%.dat
,$(WHICH
))
95 # For targets without feature based target descriptions,
96 # the set of xml files we'll generate .c files for GDB from. By
97 # default we'll build all .c files, which requires an
98 # --enable-targets=all GDB. You can override this by passing XMLTOC
99 # to make on the command line.
101 microblaze-with-stack-protect.xml \
105 mips64-dsp-linux.xml \
110 rs6000
/powerpc-32.xml \
111 rs6000
/powerpc-32l.xml \
112 rs6000
/powerpc-403.xml \
113 rs6000
/powerpc-403gc.xml \
114 rs6000
/powerpc-405.xml \
115 rs6000
/powerpc-505.xml \
116 rs6000
/powerpc-601.xml \
117 rs6000
/powerpc-602.xml \
118 rs6000
/powerpc-603.xml \
119 rs6000
/powerpc-604.xml \
120 rs6000
/powerpc-64.xml \
121 rs6000
/powerpc-64l.xml \
122 rs6000
/powerpc-7400.xml \
123 rs6000
/powerpc-750.xml \
124 rs6000
/powerpc-860.xml \
125 rs6000
/powerpc-altivec32.xml \
126 rs6000
/powerpc-altivec32l.xml \
127 rs6000
/powerpc-altivec64.xml \
128 rs6000
/powerpc-altivec64l.xml \
129 rs6000
/powerpc-e500.xml \
130 rs6000
/powerpc-e500l.xml \
131 rs6000
/powerpc-isa205-32l.xml \
132 rs6000
/powerpc-isa205-64l.xml \
133 rs6000
/powerpc-isa205-altivec32l.xml \
134 rs6000
/powerpc-isa205-altivec64l.xml \
135 rs6000
/powerpc-isa205-vsx32l.xml \
136 rs6000
/powerpc-isa205-vsx64l.xml \
137 rs6000
/powerpc-isa205-ppr-dscr-vsx32l.xml \
138 rs6000
/powerpc-isa205-ppr-dscr-vsx64l.xml \
139 rs6000
/powerpc-isa207-vsx32l.xml \
140 rs6000
/powerpc-isa207-vsx64l.xml \
141 rs6000
/powerpc-isa207-htm-vsx32l.xml \
142 rs6000
/powerpc-isa207-htm-vsx64l.xml \
143 rs6000
/powerpc-vsx32.xml \
144 rs6000
/powerpc-vsx32l.xml \
145 rs6000
/powerpc-vsx64.xml \
146 rs6000
/powerpc-vsx64l.xml \
155 s390-te-linux64.xml \
157 s390x-linux64v1.xml \
158 s390x-linux64v2.xml \
159 s390x-te-linux64.xml \
160 s390-tevx-linux64.xml \
161 s390-vx-linux64.xml \
162 s390x-tevx-linux64.xml \
163 s390x-vx-linux64.xml \
164 s390-gs-linux64.xml \
165 s390x-gs-linux64.xml \
166 sparc
/sparc32-solaris.xml \
167 sparc
/sparc64-solaris.xml \
170 TDESC_CFILES
= $(patsubst %.xml
,%.c
,$(XMLTOC
))
173 #Targets which use feature based target descriptions.
177 loongarch-feature
= 1
183 $(outdir
)/%.dat
: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
184 echo
"# THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi :set ro:" > $(outdir
)/$*.tmp
185 echo
"# Generated from: $<" >> $(outdir
)/$*.tmp
186 echo
"name:`echo $(notdir $*) | sed 's/-/_/g'`" >> $(outdir
)/$*.tmp
187 $(if
$($(firstword $(subst /, ,$(subst -, ,$*)))-feature
), echo
"feature:1") >> $(outdir
)/$*.tmp
188 echo
"xmltarget:$(<F)" >> $(outdir
)/$*.tmp
189 echo
"expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
191 $(XSLTPROC
) --path
"$(PWD)" --xinclude print-osabi.xsl
$< \
193 $(XSLTPROC
) --path
"$(PWD)" --xinclude number-regs.xsl
$< | \
194 $(XSLTPROC
) sort-regs.xsl
- | \
195 $(XSLTPROC
) gdbserver-regs.xsl
- >> $(outdir
)/$*.tmp
196 sh ..
/..
/move-if-change
$(outdir
)/$*.tmp
$(outdir
)/$*.dat
198 # For targets with feature based target descriptions,
199 # the set of xml files we'll generate .c files for GDB from.
200 FEATURE_XMLFILES
= aarch64-core.xml \
210 arm
/arm-m-profile.xml \
211 arm
/arm-m-profile-mve.xml \
212 arm
/arm-m-system.xml \
213 arm
/arm-m-profile-with-fpa.xml \
218 arm
/xscale-iwmmxt.xml \
220 i386
/32bit-core.xml \
222 i386
/32bit-linux.xml \
224 i386
/32bit-avx512.xml \
225 i386
/32bit-segments.xml \
226 i386
/64bit-avx512.xml \
227 i386
/64bit-core.xml \
228 i386
/64bit-segments.xml \
230 i386
/64bit-linux.xml \
234 loongarch
/base32.xml \
235 loongarch
/base64.xml \
240 riscv
/rv32e-xregs.xml \
241 riscv
/32bit-cpu.xml \
242 riscv
/32bit-fpu.xml \
243 riscv
/64bit-cpu.xml \
244 riscv
/64bit-fpu.xml \
249 FEATURE_CFILES
= $(patsubst %.xml
,%.c
,$(FEATURE_XMLFILES
))
251 cfiles
: $(TDESC_CFILES
) $(FEATURE_CFILES
)
253 $(TDESC_CFILES
): %.c
: %.xml
254 $(GDB
) -nx
-q
-batch
-ex
'maint print c-tdesc $<' > $@.tmp
255 sh ..
/..
/move-if-change
$@.tmp
$@
257 $(FEATURE_CFILES
): %.c
: %.xml.tmp
258 $(GDB
) -nx
-q
-batch \
259 -ex
'maint print c-tdesc -single-feature $<' > $@.tmp
260 sh ..
/..
/move-if-change
$@.tmp
$@
263 # %.xml is the XML file for each target description feature, and
264 # %.xml.tmp is the XML file target description which only includes
265 # one target description feature.
268 echo
"<?xml version=\"1.0\"?>" > $@.tmp
269 echo
"<!DOCTYPE target SYSTEM \"gdb-target.dtd\">" >> $@.tmp
270 echo
"<target>" >> $@.tmp
271 echo
" <xi:include href=\"$(notdir $<)\"/>" >> $@.tmp
272 echo
"</target>" >> $@.tmp
273 sh ..
/..
/move-if-change
$@.tmp
$@
275 # 'all' doesn't build the C files, so don't delete them in 'clean'
278 rm -f
$(TDESC_CFILES
) $(FEATURE_CFILES
)