Home | History | Annotate | Line # | Download | only in features
      1  1.11  christos # Copyright (C) 2007-2024 Free Software Foundation, Inc.
      2   1.1  christos 
      3   1.1  christos # This file is part of GDB.
      4   1.1  christos 
      5   1.1  christos # This program is free software; you can redistribute it and/or modify
      6   1.1  christos # it under the terms of the GNU General Public License as published by
      7   1.1  christos # the Free Software Foundation; either version 3 of the License, or
      8   1.1  christos # (at your option) any later version.
      9   1.1  christos #
     10   1.1  christos # This program is distributed in the hope that it will be useful,
     11   1.1  christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12   1.1  christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13   1.1  christos # GNU General Public License for more details.
     14   1.1  christos #
     15   1.1  christos # You should have received a copy of the GNU General Public License
     16   1.1  christos # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17   1.1  christos 
     18   1.1  christos 
     19   1.1  christos # This file requires GNU make!
     20   1.1  christos 
     21   1.1  christos # This Makefile updates files in ../regformats from their XML master
     22   1.1  christos # copies.  Because this relies on xsltproc, it is not normally run
     23   1.1  christos # during the build process; it should be run by hand when one of the
     24   1.1  christos # affected XML files is changed, and the results should be kept in the
     25   1.1  christos # GDB repository.
     26   1.1  christos 
     27   1.1  christos # It can also update the C files in the features directory from their
     28   1.3  christos # XML master copies.  This relies on a GDB linked with expat and that
     29   1.3  christos # is configured to include support for the architecture, so the files
     30   1.3  christos # are kept in the GDB repository.
     31   1.3  christos #
     32   1.3  christos # By default we'll generate all C files, and you must point make at a
     33   1.3  christos # GDB that has been configured with --enable-targets=all:
     34   1.3  christos #
     35   1.3  christos #   make GDB=/path/to/gdb cfiles
     36   1.3  christos #
     37   1.3  christos # To regenerate all C files from scratch:
     38   1.3  christos #
     39   1.3  christos #   make GDB=/path/to/gdb clean-cfiles cfiles
     40   1.3  christos #
     41   1.9  christos # To generate specific C files, you can override the XMLTOC and
     42   1.9  christos # FEATURE_XMLFILES make variables:
     43   1.3  christos #
     44   1.9  christos #   make GDB=/path/to/gdb XMLTOC="xml files" FEATURE_XMLFILES="xml files" cfiles
     45   1.1  christos 
     46   1.9  christos # List of .dat files to create in ../regformats/
     47   1.9  christos WHICH = mips-linux mips-dsp-linux \
     48   1.1  christos 	mips64-linux mips64-dsp-linux \
     49   1.1  christos 	nios2-linux \
     50  1.10  christos 	or1k-linux \
     51   1.1  christos 	rs6000/powerpc-32 \
     52   1.1  christos 	rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \
     53   1.1  christos 	rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \
     54   1.9  christos 	rs6000/powerpc-vsx64l \
     55   1.7  christos 	rs6000/powerpc-isa205-32l rs6000/powerpc-isa205-64l \
     56   1.7  christos 	rs6000/powerpc-isa205-altivec32l rs6000/powerpc-isa205-altivec64l \
     57   1.7  christos 	rs6000/powerpc-isa205-vsx32l rs6000/powerpc-isa205-vsx64l \
     58   1.8  christos 	rs6000/powerpc-isa205-ppr-dscr-vsx32l \
     59   1.8  christos 	rs6000/powerpc-isa205-ppr-dscr-vsx64l \
     60   1.8  christos 	rs6000/powerpc-isa207-vsx32l rs6000/powerpc-isa207-vsx64l \
     61   1.8  christos 	rs6000/powerpc-isa207-htm-vsx32l \
     62   1.8  christos 	rs6000/powerpc-isa207-htm-vsx64l \
     63   1.1  christos 	s390-linux32 s390-linux64 s390x-linux64 \
     64   1.1  christos 	s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
     65   1.1  christos 	s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
     66   1.5  christos 	s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \
     67   1.5  christos 	s390-tevx-linux64 s390x-tevx-linux64 \
     68   1.8  christos 	s390-gs-linux64 s390x-gs-linux64 \
     69   1.1  christos 	tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
     70   1.1  christos 
     71   1.1  christos # Record which registers should be sent to GDB by default after stop.
     72   1.1  christos mips-expedite = r29,pc
     73   1.1  christos mips-dsp-expedite = r29,pc
     74   1.1  christos mips64-expedite = r29,pc
     75   1.1  christos mips64-dsp-expedite = r29,pc
     76   1.1  christos nios2-linux-expedite = sp,pc
     77   1.8  christos or1k-expedite = r1,npc
     78   1.1  christos powerpc-expedite = r1,pc
     79   1.1  christos s390-linux32-expedite = r14,r15,pswa
     80   1.1  christos s390-linux32v1-expedite = r14,r15,pswa
     81   1.1  christos s390-linux32v2-expedite = r14,r15,pswa
     82   1.1  christos s390-linux64-expedite = r14l,r15l,pswa
     83   1.1  christos s390-linux64v1-expedite = r14l,r15l,pswa
     84   1.1  christos s390-linux64v2-expedite = r14l,r15l,pswa
     85   1.3  christos s390-te-linux64-expedite = r14l,r15l,pswa
     86   1.5  christos s390-vx-linux64-expedite = r14l,r15l,pswa
     87   1.5  christos s390-tevx-linux64-expedite = r14l,r15l,pswa
     88   1.8  christos s390-gs-linux64-expedite = r14,r15,pswa
     89   1.8  christos s390x-expedite = r14,r15,pswa
     90   1.8  christos tic6x-expedite = A15,PC
     91   1.1  christos 
     92   1.1  christos 
     93   1.1  christos XSLTPROC = xsltproc
     94   1.1  christos outdir = ../regformats
     95   1.1  christos OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
     96   1.1  christos 
     97   1.9  christos # For targets without feature based target descriptions,
     98   1.9  christos # the set of xml files we'll generate .c files for GDB from.  By
     99   1.3  christos # default we'll build all .c files, which requires an
    100   1.3  christos # --enable-targets=all GDB.  You can override this by passing XMLTOC
    101   1.3  christos # to make on the command line.
    102   1.3  christos XMLTOC = \
    103   1.3  christos 	microblaze-with-stack-protect.xml \
    104   1.3  christos 	microblaze.xml \
    105   1.3  christos 	mips-dsp-linux.xml \
    106   1.3  christos 	mips-linux.xml \
    107   1.3  christos 	mips64-dsp-linux.xml \
    108   1.3  christos 	mips64-linux.xml \
    109   1.6  christos 	nds32.xml \
    110   1.3  christos 	nios2.xml \
    111   1.8  christos 	or1k.xml \
    112  1.10  christos 	or1k-linux.xml \
    113   1.3  christos 	rs6000/powerpc-32.xml \
    114   1.3  christos 	rs6000/powerpc-32l.xml \
    115   1.3  christos 	rs6000/powerpc-403.xml \
    116   1.3  christos 	rs6000/powerpc-403gc.xml \
    117   1.3  christos 	rs6000/powerpc-405.xml \
    118   1.3  christos 	rs6000/powerpc-505.xml \
    119   1.3  christos 	rs6000/powerpc-601.xml \
    120   1.3  christos 	rs6000/powerpc-602.xml \
    121   1.3  christos 	rs6000/powerpc-603.xml \
    122   1.3  christos 	rs6000/powerpc-604.xml \
    123   1.3  christos 	rs6000/powerpc-64.xml \
    124   1.3  christos 	rs6000/powerpc-64l.xml \
    125   1.3  christos 	rs6000/powerpc-7400.xml \
    126   1.3  christos 	rs6000/powerpc-750.xml \
    127   1.3  christos 	rs6000/powerpc-860.xml \
    128   1.3  christos 	rs6000/powerpc-altivec32.xml \
    129   1.3  christos 	rs6000/powerpc-altivec32l.xml \
    130   1.3  christos 	rs6000/powerpc-altivec64.xml \
    131   1.3  christos 	rs6000/powerpc-altivec64l.xml \
    132   1.3  christos 	rs6000/powerpc-e500.xml \
    133   1.3  christos 	rs6000/powerpc-e500l.xml \
    134   1.3  christos 	rs6000/powerpc-isa205-32l.xml \
    135   1.3  christos 	rs6000/powerpc-isa205-64l.xml \
    136   1.3  christos 	rs6000/powerpc-isa205-altivec32l.xml \
    137   1.3  christos 	rs6000/powerpc-isa205-altivec64l.xml \
    138   1.3  christos 	rs6000/powerpc-isa205-vsx32l.xml \
    139   1.3  christos 	rs6000/powerpc-isa205-vsx64l.xml \
    140   1.8  christos 	rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml \
    141   1.8  christos 	rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml \
    142   1.8  christos 	rs6000/powerpc-isa207-vsx32l.xml \
    143   1.8  christos 	rs6000/powerpc-isa207-vsx64l.xml \
    144   1.8  christos 	rs6000/powerpc-isa207-htm-vsx32l.xml \
    145   1.8  christos 	rs6000/powerpc-isa207-htm-vsx64l.xml \
    146   1.3  christos 	rs6000/powerpc-vsx32.xml \
    147   1.3  christos 	rs6000/powerpc-vsx32l.xml \
    148   1.3  christos 	rs6000/powerpc-vsx64.xml \
    149   1.3  christos 	rs6000/powerpc-vsx64l.xml \
    150   1.3  christos 	rs6000/rs6000.xml \
    151  1.10  christos 	rx.xml \
    152   1.3  christos 	s390-linux32.xml \
    153   1.3  christos 	s390-linux32v1.xml \
    154   1.3  christos 	s390-linux32v2.xml \
    155   1.3  christos 	s390-linux64.xml \
    156   1.3  christos 	s390-linux64v1.xml \
    157   1.3  christos 	s390-linux64v2.xml \
    158   1.3  christos 	s390-te-linux64.xml \
    159   1.3  christos 	s390x-linux64.xml \
    160   1.3  christos 	s390x-linux64v1.xml \
    161   1.3  christos 	s390x-linux64v2.xml \
    162   1.3  christos 	s390x-te-linux64.xml \
    163   1.7  christos 	s390-tevx-linux64.xml \
    164   1.7  christos 	s390-vx-linux64.xml \
    165   1.7  christos 	s390x-tevx-linux64.xml \
    166   1.7  christos 	s390x-vx-linux64.xml \
    167   1.8  christos 	s390-gs-linux64.xml \
    168  1.10  christos 	s390x-gs-linux64.xml \
    169  1.10  christos 	sparc/sparc32-solaris.xml \
    170  1.10  christos 	sparc/sparc64-solaris.xml \
    171  1.10  christos 	z80.xml
    172   1.3  christos 
    173   1.8  christos TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
    174   1.1  christos GDB = false
    175   1.1  christos 
    176   1.8  christos #Targets which use feature based target descriptions.
    177   1.8  christos aarch64-feature = 1
    178   1.9  christos arm-feature = 1
    179   1.8  christos i386-feature = 1
    180  1.10  christos loongarch-feature = 1
    181   1.8  christos riscv-feature = 1
    182   1.8  christos tic6x-feature = 1
    183   1.8  christos 
    184   1.1  christos all: $(OUTPUTS)
    185   1.1  christos 
    186   1.1  christos $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
    187   1.3  christos 	echo "# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:" > $(outdir)/$*.tmp
    188   1.3  christos 	echo "# Generated from: $<" >> $(outdir)/$*.tmp
    189   1.1  christos 	echo "name:`echo $(notdir $*) | sed 's/-/_/g'`" >> $(outdir)/$*.tmp
    190   1.8  christos 	$(if $($(firstword $(subst /, ,$(subst -, ,$*)))-feature), echo "feature:1") >> $(outdir)/$*.tmp
    191   1.1  christos 	echo "xmltarget:$(<F)" >> $(outdir)/$*.tmp
    192   1.1  christos 	echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
    193   1.1  christos 	  >> $(outdir)/$*.tmp
    194   1.1  christos 	$(XSLTPROC) --path "$(PWD)" --xinclude number-regs.xsl $< | \
    195   1.1  christos 	  $(XSLTPROC) sort-regs.xsl - | \
    196   1.1  christos 	  $(XSLTPROC) gdbserver-regs.xsl - >> $(outdir)/$*.tmp
    197   1.1  christos 	sh ../../move-if-change $(outdir)/$*.tmp $(outdir)/$*.dat
    198   1.1  christos 
    199   1.9  christos # For targets with feature based target descriptions,
    200   1.9  christos # the set of xml files we'll generate .c files for GDB from.
    201   1.8  christos FEATURE_XMLFILES = aarch64-core.xml \
    202   1.8  christos 	aarch64-fpu.xml \
    203   1.9  christos 	aarch64-pauth.xml \
    204  1.10  christos 	aarch64-mte.xml \
    205   1.9  christos 	arc/v1-core.xml \
    206   1.9  christos 	arc/v1-aux.xml \
    207   1.9  christos 	arc/v2-core.xml \
    208   1.9  christos 	arc/v2-aux.xml \
    209   1.9  christos 	arm/arm-core.xml \
    210   1.9  christos 	arm/arm-fpa.xml \
    211   1.9  christos 	arm/arm-m-profile.xml \
    212  1.10  christos 	arm/arm-m-profile-mve.xml \
    213  1.10  christos 	arm/arm-m-system.xml \
    214   1.9  christos 	arm/arm-m-profile-with-fpa.xml \
    215  1.10  christos 	arm/arm-secext.xml \
    216  1.10  christos 	arm/arm-tls.xml \
    217   1.9  christos 	arm/arm-vfpv2.xml \
    218   1.9  christos 	arm/arm-vfpv3.xml \
    219   1.9  christos 	arm/xscale-iwmmxt.xml \
    220  1.10  christos 	cskyv2-linux.xml \
    221   1.8  christos 	i386/32bit-core.xml \
    222   1.8  christos 	i386/32bit-sse.xml \
    223   1.8  christos 	i386/32bit-linux.xml \
    224   1.8  christos 	i386/32bit-avx.xml \
    225   1.8  christos 	i386/32bit-mpx.xml \
    226   1.8  christos 	i386/32bit-avx512.xml \
    227  1.10  christos 	i386/32bit-segments.xml \
    228   1.8  christos 	i386/64bit-avx512.xml \
    229   1.8  christos 	i386/64bit-core.xml \
    230   1.8  christos 	i386/64bit-mpx.xml \
    231   1.8  christos 	i386/64bit-segments.xml \
    232   1.8  christos 	i386/64bit-avx.xml \
    233   1.8  christos 	i386/64bit-linux.xml \
    234   1.8  christos 	i386/64bit-sse.xml \
    235  1.10  christos 	i386/pkeys.xml \
    236   1.8  christos 	i386/x32-core.xml \
    237  1.10  christos 	loongarch/base32.xml \
    238  1.10  christos 	loongarch/base64.xml \
    239  1.10  christos 	loongarch/fpu.xml \
    240  1.11  christos 	loongarch/lsx.xml \
    241  1.11  christos 	loongarch/lasx.xml \
    242  1.11  christos 	loongarch/lbt.xml \
    243  1.10  christos 	riscv/rv32e-xregs.xml \
    244   1.8  christos 	riscv/32bit-cpu.xml \
    245   1.8  christos 	riscv/32bit-fpu.xml \
    246   1.8  christos 	riscv/64bit-cpu.xml \
    247   1.8  christos 	riscv/64bit-fpu.xml \
    248   1.8  christos 	tic6x-c6xp.xml \
    249   1.8  christos 	tic6x-core.xml \
    250   1.8  christos 	tic6x-gp.xml
    251   1.8  christos 
    252   1.8  christos FEATURE_CFILES = $(patsubst %.xml,%.c,$(FEATURE_XMLFILES))
    253   1.8  christos 
    254   1.8  christos cfiles: $(TDESC_CFILES) $(FEATURE_CFILES)
    255   1.8  christos 
    256   1.8  christos $(TDESC_CFILES): %.c: %.xml
    257   1.8  christos 	$(GDB) -nx -q -batch -ex 'maint print c-tdesc $<' > $@.tmp
    258   1.8  christos 	sh ../../move-if-change $@.tmp $@
    259   1.8  christos 
    260   1.8  christos $(FEATURE_CFILES): %.c: %.xml.tmp
    261   1.1  christos 	$(GDB) -nx -q -batch \
    262  1.10  christos 	  -ex 'maint print c-tdesc -single-feature $<' > $@.tmp
    263   1.8  christos 	sh ../../move-if-change $@.tmp $@
    264   1.8  christos 	rm $<
    265   1.8  christos 
    266   1.8  christos # %.xml is the XML file for each target description feature, and
    267   1.8  christos # %.xml.tmp is the XML file target description which only includes
    268   1.8  christos # one target description feature.
    269   1.8  christos 
    270   1.8  christos %.xml.tmp: %.xml
    271   1.8  christos 	echo "<?xml version=\"1.0\"?>" > $@.tmp
    272   1.8  christos 	echo "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">" >> $@.tmp
    273   1.8  christos 	echo "<target>" >> $@.tmp
    274   1.8  christos 	echo "  <xi:include href=\"$(notdir $<)\"/>" >> $@.tmp
    275   1.8  christos 	echo "</target>" >> $@.tmp
    276   1.1  christos 	sh ../../move-if-change $@.tmp $@
    277   1.1  christos 
    278   1.3  christos # 'all' doesn't build the C files, so don't delete them in 'clean'
    279   1.3  christos # either.
    280   1.3  christos clean-cfiles:
    281   1.8  christos 	rm -f $(TDESC_CFILES) $(FEATURE_CFILES)
    282   1.3  christos 
    283   1.3  christos clean:
    284   1.3  christos 	rm -f $(OUTPUTS)
    285