[gdb/tui] Assume HAVE_WBORDER
[binutils-gdb.git] / bfd / Makefile.am
index d07c9605b6fe78efe708feaea240104252cb166b..5c5fdefd3b8cf76dc30273d7adb53bb79b6583c0 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 #
-#   Copyright (C) 2012-2020 Free Software Foundation, Inc.
+#   Copyright (C) 2012-2023 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # <http://www.gnu.org/licenses/>.
 #
 
-AUTOMAKE_OPTIONS = no-dist foreign
+AUTOMAKE_OPTIONS = no-dist foreign info-in-builddir no-texinfo.tex
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
+MOSTLYCLEANFILES =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+
 INCDIR = $(srcdir)/../include
 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
 
-SUBDIRS = doc po
+SUBDIRS = po
 
 bfddocdir = doc
 
@@ -33,7 +38,7 @@ bfdlibdir = @bfdlibdir@
 bfdincludedir = @bfdincludedir@
 bfdlib_LTLIBRARIES = libbfd.la
 bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
-                    bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
+                    $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
 else !INSTALL_LIBBFD
 # Empty these so that the respective installation directories will not be created.
 bfdlibdir =
@@ -52,7 +57,7 @@ ZLIBINC = @zlibinc@
 
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
+AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(ZSTD_CFLAGS)
 AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"' @LARGEFILE_CPPFLAGS@
 if PLUGINS
 bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
@@ -72,7 +77,7 @@ BFD_H = bfd.h
 BFD32_LIBS = \
        archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
        coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
-       hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
+       hash.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
        section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
        binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
 
@@ -81,7 +86,7 @@ BFD64_LIBS = archive64.lo
 BFD32_LIBS_CFILES = \
        archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
        compress.c corefile.c elf-properties.c format.c hash.c \
-       init.c libbfd.c linker.c merge.c opncls.c reloc.c \
+       libbfd.c linker.c merge.c opncls.c reloc.c \
        section.c simple.c stab-syms.c stabs.c syms.c targets.c \
        binary.c ihex.c srec.c tekhex.c verilog.c
 
@@ -92,6 +97,7 @@ BFD64_LIBS_CFILES = archive64.c
 ALL_MACHINES = \
        cpu-aarch64.lo \
        cpu-alpha.lo \
+       cpu-amdgcn.lo \
        cpu-arc.lo \
        cpu-arm.lo \
        cpu-avr.lo \
@@ -112,12 +118,11 @@ ALL_MACHINES = \
        cpu-hppa.lo \
        cpu-i386.lo \
        cpu-iamcu.lo \
-       cpu-l1om.lo \
-       cpu-k1om.lo \
        cpu-ia64.lo \
        cpu-ip2k.lo \
        cpu-iq2000.lo \
        cpu-lm32.lo \
+       cpu-loongarch.lo \
        cpu-m10200.lo \
        cpu-m10300.lo \
        cpu-m32c.lo \
@@ -166,7 +171,6 @@ ALL_MACHINES = \
        cpu-vax.lo \
        cpu-visium.lo \
        cpu-wasm32.lo \
-       cpu-xc16x.lo \
        cpu-xgate.lo \
        cpu-xstormy16.lo \
        cpu-xtensa.lo \
@@ -176,6 +180,7 @@ ALL_MACHINES = \
 ALL_MACHINES_CFILES = \
        cpu-aarch64.c \
        cpu-alpha.c \
+       cpu-amdgcn.c \
        cpu-arc.c \
        cpu-arm.c \
        cpu-avr.c \
@@ -196,12 +201,11 @@ ALL_MACHINES_CFILES = \
        cpu-hppa.c \
        cpu-i386.c \
        cpu-iamcu.c \
-       cpu-l1om.c \
-       cpu-k1om.c \
        cpu-ia64.c \
        cpu-ip2k.c \
        cpu-iq2000.c \
        cpu-lm32.c \
+       cpu-loongarch.c \
        cpu-m10200.c \
        cpu-m10300.c \
        cpu-m32c.c \
@@ -250,7 +254,6 @@ ALL_MACHINES_CFILES = \
        cpu-vax.c \
        cpu-visium.c \
        cpu-wasm32.c \
-       cpu-xc16x.c \
        cpu-xgate.c \
        cpu-xstormy16.c \
        cpu-xtensa.c \
@@ -283,6 +286,7 @@ BFD32_BACKENDS = \
        ecofflink.lo \
        elf-attrs.lo \
        elf-eh-frame.lo \
+       elf-sframe.lo \
        elf-ifunc.lo \
        elf-m10200.lo \
        elf-m10300.lo \
@@ -347,7 +351,6 @@ BFD32_BACKENDS = \
        elf32-vax.lo \
        elf32-visium.lo \
        elf32-wasm32.lo \
-       elf32-xc16x.lo \
        elf32-xgate.lo \
        elf32-xstormy16.lo \
        elf32-xtensa.lo \
@@ -365,6 +368,7 @@ BFD32_BACKENDS = \
        mach-o-arm.lo \
        ns32knetbsd.lo \
        pc532-mach.lo \
+       pdb.lo \
        pdp11.lo \
        pe-arm-wince.lo \
        pe-arm.lo \
@@ -389,6 +393,7 @@ BFD32_BACKENDS = \
        wasm-module.lo \
        xcofflink.lo \
        xsym.lo \
+       xtensa-dynconfig.lo \
        xtensa-isa.lo \
        xtensa-modules.lo
 
@@ -416,6 +421,7 @@ BFD32_BACKENDS_CFILES = \
        ecofflink.c \
        elf-attrs.c \
        elf-eh-frame.c \
+       elf-sframe.c \
        elf-ifunc.c \
        elf-m10200.c \
        elf-m10300.c \
@@ -480,7 +486,6 @@ BFD32_BACKENDS_CFILES = \
        elf32-vax.c \
        elf32-visium.c \
        elf32-wasm32.c \
-       elf32-xc16x.c \
        elf32-xgate.c \
        elf32-xstormy16.c \
        elf32-xtensa.c \
@@ -498,6 +503,7 @@ BFD32_BACKENDS_CFILES = \
        mach-o-arm.c \
        ns32knetbsd.c \
        pc532-mach.c \
+       pdb.c \
        pdp11.c \
        pe-arm-wince.c \
        pe-arm.c \
@@ -521,6 +527,7 @@ BFD32_BACKENDS_CFILES = \
        wasm-module.c \
        xcofflink.c \
        xsym.c \
+       xtensa-dynconfig.c \
        xtensa-isa.c \
        xtensa-modules.c
 
@@ -543,11 +550,15 @@ BFD64_BACKENDS = \
        elf32-score.lo \
        elf32-score7.lo \
        elf64-alpha.lo \
+       elf64-amdgcn.lo \
        elf64-gen.lo \
        elf64-hppa.lo \
        elf64-ia64.lo \
        elf64-ia64-vms.lo \
        elfxx-ia64.lo \
+       elf32-loongarch.lo \
+       elf64-loongarch.lo \
+       elfxx-loongarch.lo \
        elfn32-mips.lo \
        elf64-mips.lo \
        elfxx-mips.lo \
@@ -567,8 +578,13 @@ BFD64_BACKENDS = \
        mach-o-aarch64.lo \
        mach-o-x86-64.lo \
        mmo.lo \
+       pe-aarch64igen.lo \
+       pe-loongarch64igen.lo \
        pe-x86_64.lo \
+       pei-aarch64.lo \
+       pe-aarch64.lo \
        pei-ia64.lo \
+       pei-loongarch64.lo \
        pei-x86_64.lo \
        pepigen.lo \
        pex64igen.lo \
@@ -584,6 +600,7 @@ BFD64_BACKENDS_CFILES = \
        elf32-score.c \
        elf32-score7.c \
        elf64-alpha.c \
+       elf64-amdgcn.c \
        elf64-gen.c \
        elf64-hppa.c \
        elf64-ia64-vms.c \
@@ -601,18 +618,21 @@ BFD64_BACKENDS_CFILES = \
        elfn32-mips.c \
        elfxx-aarch64.c \
        elfxx-ia64.c \
+       elfxx-loongarch.c \
        elfxx-mips.c \
        elfxx-riscv.c \
        mach-o-aarch64.c \
        mach-o-x86-64.c \
        mmo.c \
+       pe-aarch64.c \
        pe-x86_64.c \
+       pei-aarch64.c \
        pei-ia64.c \
+       pei-loongarch64.c \
        pei-x86_64.c \
        vms-alpha.c
 
 OPTIONAL_BACKENDS = \
-       aix386-core.lo \
        cisco-core.lo \
        hpux-core.lo \
        irix-core.lo \
@@ -620,11 +640,9 @@ OPTIONAL_BACKENDS = \
        netbsd-core.lo \
        osf-core.lo \
        rs6000-core.lo \
-       sco5-core.lo \
        trad-core.lo
 
 OPTIONAL_BACKENDS_CFILES = \
-       aix386-core.c \
        cisco-core.c \
        hpux-core.c \
        irix-core.c \
@@ -632,7 +650,6 @@ OPTIONAL_BACKENDS_CFILES = \
        netbsd-core.c \
        osf-core.c \
        rs6000-core.c \
-       sco5-core.c \
        trad-core.c
 
 # Reconfigure if config.bfd or configure.host changes.
@@ -665,8 +682,9 @@ SOURCE_CFILES = \
 BUILD_CFILES = \
        elf32-aarch64.c elf64-aarch64.c \
        elf32-ia64.c elf64-ia64.c \
+       elf32-loongarch.c elf64-loongarch.c \
        elf32-riscv.c elf64-riscv.c \
-       peigen.c pepigen.c pex64igen.c
+       peigen.c pepigen.c pex64igen.c pe-aarch64igen.c pe-loongarch64igen.c
 
 CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
 
@@ -675,7 +693,7 @@ CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
 SOURCE_HFILES = \
        aout-target.h aoutx.h arc-got.h arc-plt.h \
        coff-arm.h coff-bfd.h coffcode.h coffswap.h \
-       cpu-aarch64.h cpu-arm.h cpu-h8300.h cpu-m68k.h \
+       cpu-aarch64.h cpu-arm.h cpu-h8300.h cpu-m68k.h cpu-riscv.h \
        ecoff-bfd.h ecoffswap.h \
        elf32-arm.h elf32-avr.h elf32-bfin.h elf32-cr16.h elf32-csky.h \
        elf32-dlx.h elf32-hppa.h elf32-m68hc1x.h elf32-m68k.h \
@@ -686,7 +704,7 @@ SOURCE_HFILES = \
        elf-bfd.h elfcode.h elfcore.h elf-hppa.h elf-linker-x86.h \
        elf-linux-core.h elf-nacl.h elf-s390.h elf-vxworks.h \
        elfxx-aarch64.h elfxx-ia64.h elfxx-mips.h elfxx-riscv.h \
-       elfxx-sparc.h elfxx-tilegx.h elfxx-x86.h \
+       elfxx-sparc.h elfxx-tilegx.h elfxx-x86.h elfxx-loongarch.h \
        genlink.h go32stub.h \
        libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
        libpei.h libxcoff.h \
@@ -700,22 +718,31 @@ SOURCE_HFILES = \
 
 ## ... and .h files which are in the build tree, minus config.h and bfd.h
 BUILD_HFILES = \
-       bfdver.h elf32-target.h elf64-target.h targmatch.h bfd_stdint.h
+       bfdver.h elf32-target.h elf64-target.h targmatch.h
 
 # Ensure they are built early:
-BUILT_SOURCES = $(BUILD_HFILES)
+BUILT_SOURCES = $(BUILD_HFILES) @MAINT@ $(BUILD_CFILES)
 
 HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
 
+BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
+LOCAL_H_DEPS = libbfd.h sysdep.h config.h
+$(BFD32_LIBS) \
+ $(BFD64_LIBS) \
+ $(ALL_MACHINES) \
+ $(BFD32_BACKENDS) \
+ $(BFD64_BACKENDS) \
+ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
+
 SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
 BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
 
-po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
+po/SRC-POTFILES.in: @MAINT@ Makefile
        for file in $(SRC_POTFILES); do echo $$file; done \
          | LC_ALL=C sort > tmp.src \
          && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
 
-po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
+po/BLD-POTFILES.in: @MAINT@ Makefile
        for file in $(BLD_POTFILES); do echo $$file; done \
          | LC_ALL=C sort > tmp.bld \
          && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
@@ -750,126 +777,114 @@ ofiles: stamp-ofiles ; @true
 # dependency tracking fragments are picked up in the Makefile.
 libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
 EXTRA_libbfd_la_SOURCES = $(CFILES)
-libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB)
+libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la
+libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la
 libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
 
-# libtool will build .libs/libbfd.a.  We create libbfd.a in the build
-# directory so that we don't have to convert all the programs that use
-# libbfd.a simultaneously.  This is a hack which should be removed if
-# everything else starts using libtool.  FIXME.
-
-noinst_LIBRARIES = libbfd.a
-libbfd_a_SOURCES =
-
-stamp-lib: libbfd.la
-       libtooldir=`$(LIBTOOL) --config | $(SED) -n -e 's/^objdir=//p'`; \
-       if [ -f $$libtooldir/libbfd.a ]; then \
-         cp $$libtooldir/libbfd.a libbfd.tmp; \
-         $(RANLIB) libbfd.tmp; \
-         $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
-       else true; fi
-       touch stamp-lib
-
-libbfd.a: stamp-lib ; @true
-
 # This file holds an array associating configuration triplets and
 # vector names.  It is built from config.bfd.  It is not compiled by
 # itself, but is included by targets.c.
 targmatch.h: config.bfd targmatch.sed
-       rm -f targmatch.h
-       $(SED) -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
-       mv -f targmatch.new targmatch.h
+       $(AM_V_at)rm -f targmatch.new
+       $(AM_V_GEN)$(SED) -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
+       $(AM_V_at)mv -f targmatch.new targmatch.h
 
 # When compiling archures.c and targets.c, supply the default target
 # info from configure.
 
 targets.lo: targets.c Makefile
 if am__fastdepCC
-       $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
-       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+       $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
+       $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 else
 if AMDEP
        source='targets.c' object='$@' libtool=yes @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif
-       $(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
+       $(AM_V_CC)$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
 endif
 
 archures.lo: archures.c Makefile
 if am__fastdepCC
-       $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
-       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+       $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
+       $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 else
 if AMDEP
        source='archures.c' object='$@' libtool=yes @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif
-       $(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
+       $(AM_V_CC)$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
 endif
 
 dwarf2.lo: dwarf2.c Makefile
 if am__fastdepCC
-       $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
-       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+       $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
+       $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 else
 if AMDEP
        source='dwarf2.c' object='$@' libtool=yes @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif
-       $(LTCOMPILE) -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
+       $(AM_V_CC)$(LTCOMPILE) -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
 endif
 
 elf32-target.h : elfxx-target.h
-       $(SED) -e s/NN/32/g < $< > $@
+       $(AM_V_GEN)$(SED) -e s/NN/32/g < $< > $@
 
 elf64-target.h : elfxx-target.h
-       $(SED) -e s/NN/64/g < $< > $@
+       $(AM_V_GEN)$(SED) -e s/NN/64/g < $< > $@
 
 elf32-aarch64.c : elfnn-aarch64.c
-       echo "#line 1 \"elfnn-aarch64.c\"" > $@
-       $(SED) -e s/NN/32/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-aarch64.c : elfnn-aarch64.c
-       echo "#line 1 \"elfnn-aarch64.c\"" > $@
-       $(SED) -e s/NN/64/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-ia64.c : elfnn-ia64.c
-       echo "#line 1 \"elfnn-ia64.c\"" > $@
-       $(SED) -e s/NN/32/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-ia64.c : elfnn-ia64.c
-       echo "#line 1 \"elfnn-ia64.c\"" > $@
-       $(SED) -e s/NN/64/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
+
+elf32-loongarch.c : elfnn-loongarch.c
+       $(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
+
+elf64-loongarch.c : elfnn-loongarch.c
+       $(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-riscv.c : elfnn-riscv.c
-       echo "#line 1 \"elfnn-riscv.c\"" > $@
-       $(SED) -e s/NN/32/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-riscv.c : elfnn-riscv.c
-       echo "#line 1 \"elfnn-riscv.c\"" > $@
-       $(SED) -e s/NN/64/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 peigen.c : peXXigen.c
-       echo "#line 1 \"peXXigen.c\"" > $@
-       $(SED) -e s/XX/pe/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/XX/pe/g < $< >> $@
 
 pepigen.c : peXXigen.c
-       echo "#line 1 \"peXXigen.c\"" > $@
-       $(SED) -e s/XX/pep/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/XX/pep/g < $< >> $@
 
 pex64igen.c: peXXigen.c
-       echo "#line 1 \"peXXigen.c\"" > $@
-       $(SED) -e s/XX/pex64/g < $< >> $@
+       $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/XX/pex64/g < $< >> $@
 
-BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
-LOCAL_H_DEPS= libbfd.h sysdep.h config.h bfd_stdint.h
-$(BFD32_LIBS) \
- $(BFD64_LIBS) \
- $(ALL_MACHINES) \
- $(BFD32_BACKENDS) \
- $(BFD64_BACKENDS) \
- $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
+pe-aarch64igen.c: peXXigen.c
+       $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@
+
+pe-loongarch64igen.c: peXXigen.c
+       $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+       $(AM_V_GEN)$(SED) -e s/XX/peLoongArch64/g < $< >> $@
 
 host-aout.lo: Makefile
 
@@ -889,59 +904,68 @@ stmp-bfd-h: bfd-in3.h
        rm -f bfd-tmp.h
        touch stmp-bfd-h
 
-BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c \
-       bfdio.c bfdwin.c section.c archures.c reloc.c \
-       syms.c bfd.c archive.c corefile.c targets.c format.c \
-       linker.c simple.c compress.c
+BFD_H_FILES = bfd-in.h libbfd.c hash.c section.c syms.c \
+       archive.c archures.c bfd.c bfdio.c bfdwin.c \
+       cache.c compress.c corefile.c format.c linker.c opncls.c \
+       reloc.c simple.c stab-syms.c stabs.c targets.c
 BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h libbfd.c bfdio.c bfdwin.c \
-       cache.c reloc.c archures.c linker.c
+LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c \
+       archive.c archures.c bfdwin.c cache.c hash.c linker.c opncls.c \
+       reloc.c section.c stabs.c targets.c
 LIBCOFF_H_FILES = libcoff-in.h coffcode.h
 
-# Could really use a "copy-if-change"...
-headers:
-       (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS))
-       cp $(bfddocdir)/bfd.h bfd-in2.h-new
-       $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
-       cp $(bfddocdir)/libbfd.h libbfd.h-new
-       $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
-       cp $(bfddocdir)/libcoff.h libcoff.h-new
-       $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
+headers: stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
 
 # We only rebuild the header files automatically if we have been
 # configured with --enable-maintainer-mode.
 
+REGEN_HEADER = \
+       ( \
+       set -e; \
+       echo "$$H_FILES" | sed -f $(srcdir)/doc/header.sed; \
+       for file in $$H_FILES; do \
+         file="$(srcdir)/$$file"; \
+         case $$file in \
+           *-in.h) cat $$file;; \
+           *)  echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
+                               -e 's,$$,.  */,'; \
+               $(MKDOC) $$CHEW_FLAGS -f $(srcdir)/doc/proto.str < $$file;; \
+         esac; \
+       done; \
+       echo "\#ifdef __cplusplus"; \
+       echo "}"; \
+       echo "\#endif"; \
+       echo "\#endif"; \
+       )
+
 $(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
-stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
-       (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
-       cp $(bfddocdir)/bfd.h bfd-in2.h-new
-       $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
-       touch stmp-bin2-h
+stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) $(MKDOC)
+       $(AM_V_GEN)H_FILES="$(BFD_H_FILES)" CHEW_FLAGS= ; $(REGEN_HEADER) > bfd-in2.h-new
+       $(AM_V_at)$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
+       $(AM_V_at)touch stmp-bin2-h
 
 $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true
-stmp-lbfd-h: $(LIBBFD_H_FILES)
-       (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
-       cp $(bfddocdir)/libbfd.h libbfd.h-new
-       $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
-       touch stmp-lbfd-h
+stmp-lbfd-h: $(LIBBFD_H_FILES) $(MKDOC)
+       $(AM_V_GEN)H_FILES="$(LIBBFD_H_FILES)" CHEW_FLAGS=-i ; $(REGEN_HEADER) > libbfd.h-new
+       $(AM_V_at)$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
+       $(AM_V_at)touch stmp-lbfd-h
 
 $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true
-stmp-lcoff-h: $(LIBCOFF_H_FILES)
-       (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
-       cp $(bfddocdir)/libcoff.h libcoff.h-new
-       $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
-       touch stmp-lcoff-h
+stmp-lcoff-h: $(LIBCOFF_H_FILES) $(MKDOC)
+       $(AM_V_GEN)H_FILES="$(LIBCOFF_H_FILES)" CHEW_FLAGS=-i ; $(REGEN_HEADER) > libcoff.h-new
+       $(AM_V_at)$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
+       $(AM_V_at)touch stmp-lcoff-h
 
-MOSTLYCLEANFILES = ofiles stamp-ofiles
+MOSTLYCLEANFILES += ofiles stamp-ofiles
 
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
+CLEANFILES += bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 \
        stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
 
-DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
+DISTCLEANFILES += $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
 
 bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
-       @echo "creating $@"
-       @bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
+       $(AM_V_GEN)\
+       bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
        bfd_version_string="\"$(VERSION)\"" ;\
        bfd_soversion="$(VERSION)" ;\
        bfd_version_package="\"$(PKGVERSION)\"" ;\
@@ -962,15 +986,17 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
 # Disable -Werror, if it has been enabled, since coffswap.h won't
 # compile with gcc 4.5 and above.
 coff-tic4x.lo: coff-tic4x.c
-@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
+@am__fastdepCC_FALSE@  $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
 
 coff-tic54x.lo: coff-tic54x.c
-@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
-@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
+@am__fastdepCC_FALSE@  $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
+
+include doc/local.mk