From: Mike Frysinger Date: Fri, 3 Dec 2021 05:23:20 +0000 (-0500) Subject: bfd: move header updates up a directory X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22;p=binutils-gdb.git bfd: move header updates up a directory The rules for rebuilding the bfd headers live in the doc/ subdir (most likely) because they rely on the chew & related tools. But we can collapse them into the main Makefile while keeping the tools in the doc subdir easily enough. This makes the code simpler and allows for rebuilding them in parallel. Also add automake silent rule support while we're here. --- diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 7a5a336f1d8..bfe8d93e73d 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -920,39 +920,81 @@ LIBBFD_H_FILES = libbfd-in.h libbfd.c bfdio.c bfdwin.c \ cache.c reloc.c archures.c linker.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 +MKDOC = doc/chew$(EXEEXT_FOR_BUILD) + +$(MKDOC): + cd $(bfddocdir) && $(MAKE) chew$(EXEEXT_FOR_BUILD) + +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. $(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)( \ + set -e; \ + echo "$(BFD_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(BFD_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) -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > 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)( \ + set -e; \ + echo "$(LIBBFD_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(LIBBFD_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) -i -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > 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)( \ + set -e; \ + echo "$(LIBCOFF_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(LIBCOFF_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) -i -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > 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 diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 4286b5e1062..ec9ed2d183e 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -1175,6 +1175,7 @@ LIBBFD_H_FILES = libbfd-in.h libbfd.c bfdio.c bfdwin.c \ cache.c reloc.c archures.c linker.c LIBCOFF_H_FILES = libcoff-in.h coffcode.h +MKDOC = doc/chew$(EXEEXT_FOR_BUILD) MOSTLYCLEANFILES = ofiles stamp-ofiles CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ stmp-bin2-h stmp-lbfd-h stmp-lcoff-h @@ -2044,39 +2045,79 @@ stmp-bfd-h: bfd-in3.h rm -f bfd-tmp.h touch stmp-bfd-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 +$(MKDOC): + cd $(bfddocdir) && $(MAKE) chew$(EXEEXT_FOR_BUILD) + +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. $(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)( \ + set -e; \ + echo "$(BFD_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(BFD_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) -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > 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)( \ + set -e; \ + echo "$(LIBBFD_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(LIBBFD_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) -i -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > 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)( \ + set -e; \ + echo "$(LIBCOFF_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \ + for file in $(LIBCOFF_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) -i -f $(srcdir)/doc/proto.str < $$file;; \ + esac; \ + done; \ + echo "#ifdef __cplusplus"; \ + echo "}"; \ + echo "#endif"; \ + echo "#endif"; \ + ) > libcoff.h-new + $(AM_V_at)$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h + $(AM_V_at)touch stmp-lcoff-h bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in $(AM_V_GEN)\ diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am index 67f1042b0a1..3b24d1af222 100644 --- a/bfd/doc/Makefile.am +++ b/bfd/doc/Makefile.am @@ -77,8 +77,6 @@ chew.stamp: $(srcdir)/chew.c chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC); \ touch $@ -protos: libbfd.h libcoff.h bfd.h - # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. @@ -243,98 +241,6 @@ linker.stamp: $(srcdir)/../linker.c $(srcdir)/doc.str $(MKDOC) $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi touch $@ -LIBBFD_H_DEP = \ - $(srcdir)/../libbfd-in.h \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../bfdio.c \ - $(srcdir)/../bfdwin.c \ - $(srcdir)/../cache.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../linker.c \ - $(srcdir)/header.sed \ - $(srcdir)/proto.str \ - $(MKDOC) - -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - -LIBCOFF_H_DEP = \ - $(srcdir)/../libcoff-in.h \ - $(srcdir)/../coffcode.h \ - $(srcdir)/header.sed \ - $(srcdir)/proto.str \ - $(MKDOC) - -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - -BFD_H_DEP = \ - $(srcdir)/../bfd-in.h \ - $(srcdir)/../init.c \ - $(srcdir)/../opncls.c \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../bfdio.c \ - $(srcdir)/../bfdwin.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)/../linker.c \ - $(srcdir)/../simple.c \ - $(srcdir)/../compress.c \ - $(srcdir)/header.sed \ - $(srcdir)/proto.str \ - $(srcdir)/../version.h \ - $(MKDOC) - -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - bfdver.texi: $(srcdir)/Makefile.in @echo "creating $@"; \ echo "@set VERSION $(VERSION)" > bfdver.texi; \ diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index 185786cecca..c461094c80c 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -442,50 +442,6 @@ MKDOC = chew$(EXEEXT_FOR_BUILD) AM_CPPFLAGS = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \ -I$(srcdir)/../../intl -I../../intl -LIBBFD_H_DEP = \ - $(srcdir)/../libbfd-in.h \ - $(srcdir)/../libbfd.c \ - $(srcdir)/../bfdio.c \ - $(srcdir)/../bfdwin.c \ - $(srcdir)/../cache.c \ - $(srcdir)/../reloc.c \ - $(srcdir)/../archures.c \ - $(srcdir)/../linker.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)/../bfdio.c \ - $(srcdir)/../bfdwin.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)/../linker.c \ - $(srcdir)/../simple.c \ - $(srcdir)/../compress.c \ - $(srcdir)/header.sed \ - $(srcdir)/proto.str \ - $(srcdir)/../version.h \ - $(MKDOC) - noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o *.stamp DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log @@ -929,8 +885,6 @@ chew.stamp: $(srcdir)/chew.c chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC); \ touch $@ -protos: libbfd.h libcoff.h bfd.h - # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. @@ -1095,54 +1049,6 @@ linker.stamp: $(srcdir)/../linker.c $(srcdir)/doc.str $(MKDOC) $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi touch $@ -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - -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 ;; \ - *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ - -e 's,$$,. */,' >> $@ ; \ - ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ - esac; \ - done - echo "#ifdef __cplusplus" >> $@ - echo "}" >> $@ - echo "#endif" >> $@ - echo "#endif" >> $@ - bfdver.texi: $(srcdir)/Makefile.in @echo "creating $@"; \ echo "@set VERSION $(VERSION)" > bfdver.texi; \