From 4eef72c77dd130eef2b5c5964831d77495c77d68 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 1 Oct 2001 14:03:36 +0000 Subject: [PATCH] bfd/ * bfd-in.h: Remove comments regarding generated files. * libbfd-in.h: Likewise. * libcoff-in.h: Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. * libcoff.h: Likewise. bfd/doc/ * header.sed: New file, adds header to generated files. * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and bfd.h, using above. Add missing elf.c dependecy for libbfd.h. * Makefile.in: Regenerate. --- bfd/ChangeLog | 9 ++++ bfd/bfd-in.h | 23 --------- bfd/bfd-in2.h | 29 +++-------- bfd/doc/ChangeLog | 7 +++ bfd/doc/Makefile.am | 72 +++++++++++++++----------- bfd/doc/Makefile.in | 123 +++++++++++++++++++++++++------------------- bfd/doc/header.sed | 12 +++++ bfd/libbfd-in.h | 4 -- bfd/libbfd.h | 9 ++-- bfd/libcoff-in.h | 3 -- bfd/libcoff.h | 7 +-- 11 files changed, 154 insertions(+), 144 deletions(-) create mode 100644 bfd/doc/header.sed diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 86ff0e21e3d..2a56f7368fe 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2001-10-01 Alan Modra + + * bfd-in.h: Remove comments regarding generated files. + * libbfd-in.h: Likewise. + * libcoff-in.h: Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Likewise. + * libcoff.h: Likewise. + 2001-09-30 kaz Kojima Hans-Peter Nilsson diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index bf81b5af7f5..c25e79e148e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -4,10 +4,6 @@ Free Software Foundation, Inc. Contributed by Cygnus Support. -** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; -** instead, change bfd-in.h or the other BFD source files processed to -** generate these files. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -24,25 +20,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* bfd.h -- The only header file required by users of the bfd library - -The bfd.h file is generated from bfd-in.h and various .c files; if you -change it, your changes will probably be lost. - -All the prototypes and definitions following the comment "THE FOLLOWING -IS EXTRACTED FROM THE SOURCE" are extracted from the source files for -BFD. If you change it, someone oneday will extract it from the source -again, and your changes will be lost. To save yourself from this bind, -change the definitions in the source in the bfd directory. Type "make -docs" and then "make headers" in that directory, and magically this file -will change to reflect your changes. - -If you don't have the tools to perform the extraction, then you are -safe from someone on your system trampling over your header files. -You should still maintain the equivalence between the source and this -file though; every change you make to the .c file should be reflected -here. */ - #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 793bb6218d4..b0710f86c4b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1,13 +1,15 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", + "section.c", "archures.c", "reloc.c", "syms.c", "bfd.c", "archive.c", + "corefile.c", "targets.c" and "format.c". + Run "make headers" in your build bfd/ to regenerate. */ + /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Contributed by Cygnus Support. -** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them; -** instead, change bfd-in.h or the other BFD source files processed to -** generate these files. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify @@ -24,25 +26,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* bfd.h -- The only header file required by users of the bfd library - -The bfd.h file is generated from bfd-in.h and various .c files; if you -change it, your changes will probably be lost. - -All the prototypes and definitions following the comment "THE FOLLOWING -IS EXTRACTED FROM THE SOURCE" are extracted from the source files for -BFD. If you change it, someone oneday will extract it from the source -again, and your changes will be lost. To save yourself from this bind, -change the definitions in the source in the bfd directory. Type "make -docs" and then "make headers" in that directory, and magically this file -will change to reflect your changes. - -If you don't have the tools to perform the extraction, then you are -safe from someone on your system trampling over your header files. -You should still maintain the equivalence between the source and this -file though; every change you make to the .c file should be reflected -here. */ - #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index ca27ecc30e2..f6f5160531f 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,3 +1,10 @@ +2001-10-01 Alan Modra + + * header.sed: New file, adds header to generated files. + * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and + bfd.h, using above. Add missing elf.c dependecy for libbfd.h. + * Makefile.in: Regenerate. + 2001-09-21 Alan Modra * Makefile.in: Regenerate. diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am index 0d5268e9608..5fe4c232371 100644 --- a/bfd/doc/Makefile.am +++ b/bfd/doc/Makefile.am @@ -183,30 +183,44 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str touch s-linker linker.texi: s-linker -libbfd.h: $(srcdir)/../libbfd-in.h \ +LIBBFD_H_DEP = $(srcdir)/../libbfd-in.h \ $(srcdir)/../init.c \ $(srcdir)/../libbfd.c \ $(srcdir)/../cache.c \ $(srcdir)/../reloc.c \ $(srcdir)/../archures.c \ + $(srcdir)/../elf.c \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ $(MKDOC) - cat $(srcdir)/../libbfd-in.h >libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h - -libcoff.h: $(srcdir)/../libcoff-in.h \ + +libbfd.h: $(LIBBFD_H_DEP) + echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBBFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + +LIBCOFF_H_DEP = $(srcdir)/../libcoff-in.h \ $(srcdir)/../coffcode.h \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ $(MKDOC) - cat $(srcdir)/../libcoff-in.h >libcoff.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h -bfd.h: $(srcdir)/../bfd-in.h \ +libcoff.h: $(LIBCOFF_H_DEP) + echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBCOFF_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + +BFD_H_DEP = $(srcdir)/../bfd-in.h \ $(srcdir)/../init.c \ $(srcdir)/../opncls.c \ $(srcdir)/../libbfd.c \ @@ -219,25 +233,23 @@ bfd.h: $(srcdir)/../bfd-in.h \ $(srcdir)/../corefile.c \ $(srcdir)/../targets.c \ $(srcdir)/../format.c \ + $(srcdir)/header.sed \ $(srcdir)/proto.str \ $(MKDOC) - cat $(srcdir)/../bfd-in.h >bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h - echo "#ifdef __cplusplus" >>bfd.h - echo "}" >>bfd.h - echo "#endif" >>bfd.h - echo "#endif" >>bfd.h + +bfd.h: $(BFD_H_DEP) + echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(BFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + echo "#ifdef __cplusplus" >> $@ + echo "}" >> $@ + echo "#endif" >> $@ + echo "#endif" >> $@ noinst_TEXINFOS = bfdint.texi diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index a88832f3702..f7cfe2ba6d0 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -173,6 +173,43 @@ info_TEXINFOS = bfd.texinfo MKDOC = chew$(EXEEXT_FOR_BUILD) +LIBBFD_H_DEP = $(srcdir)/../libbfd-in.h \ + $(srcdir)/../init.c \ + $(srcdir)/../libbfd.c \ + $(srcdir)/../cache.c \ + $(srcdir)/../reloc.c \ + $(srcdir)/../archures.c \ + $(srcdir)/../elf.c \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(MKDOC) + + +LIBCOFF_H_DEP = $(srcdir)/../libcoff-in.h \ + $(srcdir)/../coffcode.h \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(MKDOC) + + +BFD_H_DEP = $(srcdir)/../bfd-in.h \ + $(srcdir)/../init.c \ + $(srcdir)/../opncls.c \ + $(srcdir)/../libbfd.c \ + $(srcdir)/../section.c \ + $(srcdir)/../archures.c \ + $(srcdir)/../reloc.c \ + $(srcdir)/../syms.c \ + $(srcdir)/../bfd.c \ + $(srcdir)/../archive.c \ + $(srcdir)/../corefile.c \ + $(srcdir)/../targets.c \ + $(srcdir)/../format.c \ + $(srcdir)/header.sed \ + $(srcdir)/proto.str \ + $(MKDOC) + + noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o @@ -545,61 +582,39 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str touch s-linker linker.texi: s-linker -libbfd.h: $(srcdir)/../libbfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../cache.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../archures.c \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libbfd-in.h >libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h - -libcoff.h: $(srcdir)/../libcoff-in.h \ - $(srcdir)/../coffcode.h \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../libcoff-in.h >libcoff.h - ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h +libbfd.h: $(LIBBFD_H_DEP) + echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBBFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done -bfd.h: $(srcdir)/../bfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../opncls.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../section.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../syms.c \ - $(srcdir)/../bfd.c \ - $(srcdir)/../archive.c \ - $(srcdir)/../corefile.c \ - $(srcdir)/../targets.c \ - $(srcdir)/../format.c \ - $(srcdir)/proto.str \ - $(MKDOC) - cat $(srcdir)/../bfd-in.h >bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h - ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h - echo "#ifdef __cplusplus" >>bfd.h - echo "}" >>bfd.h - echo "#endif" >>bfd.h - echo "#endif" >>bfd.h +libcoff.h: $(LIBCOFF_H_DEP) + echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(LIBCOFF_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + +bfd.h: $(BFD_H_DEP) + echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ + for file in $(BFD_H_DEP); do \ + case $$file in \ + *-in.h) cat $$file >> $@ ;; \ + */header.sed) break ;; \ + *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + esac; \ + done + echo "#ifdef __cplusplus" >> $@ + echo "}" >> $@ + echo "#endif" >> $@ + echo "#endif" >> $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/bfd/doc/header.sed b/bfd/doc/header.sed new file mode 100644 index 00000000000..ed27040f743 --- /dev/null +++ b/bfd/doc/header.sed @@ -0,0 +1,12 @@ +s|\(.*\) [^ ]*header.sed.*|\1| +s|[^ ]*/||g +s|^ *|"| +s| |", "|g +s|$|"| +s|, \([^ ]*\)$| and \1| +s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from | +s|\(.\{60\}[^ ]* \)|\1\ + |g +s|$|.\ + Run "make headers" in your build bfd/ to regenerate. */\ +| diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index db24ec2bbc8..23b7ad9c8d3 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -5,10 +5,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, -** change libbfd-in.h or the other BFD source files processed to -** generate this file. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify diff --git a/bfd/libbfd.h b/bfd/libbfd.h index b13259608cb..8c9a29e4e2d 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1,3 +1,8 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "libbfd-in.h", "init.c", "libbfd.c", "cache.c", + "reloc.c", "archures.c" and "elf.c". + Run "make headers" in your build bfd/ to regenerate. */ + /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, @@ -5,10 +10,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, -** change libbfd-in.h or the other BFD source files processed to -** generate this file. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index 1a7599d27f7..17962495ad1 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -4,9 +4,6 @@ Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, -** change libcoff-in.h or coffcode.h. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify diff --git a/bfd/libcoff.h b/bfd/libcoff.h index eb90045c37d..e0c77d9a2d4 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -1,12 +1,13 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically + generated from "libcoff-in.h" and "coffcode.h". + Run "make headers" in your build bfd/ to regenerate. */ + /* BFD COFF object file private structure. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. -** NOTE: libcoff.h is a GENERATED file. Don't change it; instead, -** change libcoff-in.h or coffcode.h. - This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify -- 2.30.2