aboutsummaryrefslogtreecommitdiff
path: root/bfd/Makefile.am
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-12-03 00:23:20 -0500
committerMike Frysinger <vapier@gentoo.org>2021-12-03 20:03:05 -0500
commit0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22 (patch)
tree895b800c3fe27f9f2f6a55a744ec727bc1ca2d63 /bfd/Makefile.am
parentf52ee74fea5e3dbc5ccb3ac392591cd6363ff6d2 (diff)
downloadgdb-0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22.zip
gdb-0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22.tar.gz
gdb-0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22.tar.bz2
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.
Diffstat (limited to 'bfd/Makefile.am')
-rw-r--r--bfd/Makefile.am90
1 files changed, 66 insertions, 24 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 7a5a336..bfe8d93 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