summaryrefslogtreecommitdiff
path: root/bfd/Makefile.am
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-12-03 00:31:02 -0500
committerMike Frysinger <vapier@gentoo.org>2021-12-03 20:06:58 -0500
commit17ebe2080050d8855070d05bba1a580e54251d0d (patch)
tree49e11fc2b4486bb5508bc4403575b2e9ca7cebd1 /bfd/Makefile.am
parent0f34c35dd9ff4921cae1a9cbef1cf956a1a56e22 (diff)
downloadbinutils-gdb-17ebe2080050d8855070d05bba1a580e54251d0d.tar.gz
bfd: unify header generation rules
The logic between these rules are extremely similar, so unify them into a single variable.
Diffstat (limited to 'bfd/Makefile.am')
-rw-r--r--bfd/Makefile.am59
1 files changed, 15 insertions, 44 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index bfe8d93e73d..4960cb500b1 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -930,69 +930,40 @@ 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) $(MKDOC)
- $(AM_V_GEN)( \
+REGEN_HEADER = \
+ ( \
set -e; \
- echo "$(BFD_H_FILES)" | sed -f $(srcdir)/doc/header.sed; \
- for file in $(BFD_H_FILES); do \
+ 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) -f $(srcdir)/doc/proto.str < $$file;; \
+ $(MKDOC) $$CHEW_FLAGS -f $(srcdir)/doc/proto.str < $$file;; \
esac; \
done; \
- echo "#ifdef __cplusplus"; \
+ echo "\#ifdef __cplusplus"; \
echo "}"; \
- echo "#endif"; \
- echo "#endif"; \
- ) > bfd-in2.h-new
+ echo "\#endif"; \
+ echo "\#endif"; \
+ )
+
+$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
+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) $(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_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) $(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_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