[binutils-gdb] x86: add generated tables dependency check to gas

Jan Beulich jbeulich@sourceware.org
Mon Dec 12 07:49:56 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=313095ba2d898d46b768ddc804707b17212567ee

commit 313095ba2d898d46b768ddc804707b17212567ee
Author: Jan Beulich <jbeulich@suse.com>
Date:   Mon Dec 12 08:48:25 2022 +0100

    x86: add generated tables dependency check to gas
    
    As requested by H.J., just for the sake of people potentially building
    in gas/ alone, add a check that the generated files in opcodes/ are
    actually up-to-date. Personally I think this should at best be a
    warning, but I can see how this may not be easily noticable among other
    make output (depending in particular on the verbosity level).

Diff:
---
 gas/Makefile.am | 11 +++++++++++
 gas/Makefile.in | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/gas/Makefile.am b/gas/Makefile.am
index dc5931252e4..1c4b3c1bf99 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -448,6 +448,17 @@ development.exp: $(BFDDIR)/development.sh
 	$(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh  \
 	  | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
 
+config/tc-i386.o: $(srcdir)/../opcodes/i386-init.h $(srcdir)/../opcodes/i386-tbl.h
+
+i386_tbl_deps = $(srcdir)/../opcodes/i386-opc.tbl \
+	$(srcdir)/../opcodes/i386-reg.tbl \
+	$(srcdir)/../opcodes/i386-gen.c $(srcdir)/../opcodes/i386-opc.h
+
+$(srcdir)/../opcodes/i386%init.h $(srcdir)/../opcodes/i386%tbl.h: @MAINT@ $(i386_tbl_deps)
+	@echo '"$@" is outdated wrt "$?"' >&2
+	@echo 'Please rebuild from the top level or in $(CURDIR)/../opcodes/' >&2
+	@false
+
 EXTRA_as_new_SOURCES += config/m68k-parse.y
 config/m68k-parse.c: $(srcdir)/config/m68k-parse.y
 	$(SHELL) $(YLWRAP) $(srcdir)/config/m68k-parse.y y.tab.c $@ -- $(YACCCOMPILE)
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 8324cbe999d..4faf2507ba5 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -905,6 +905,10 @@ EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
 EXPECT = expect
 RUNTEST = runtest
 RUNTESTFLAGS = 
+i386_tbl_deps = $(srcdir)/../opcodes/i386-opc.tbl \
+	$(srcdir)/../opcodes/i386-reg.tbl \
+	$(srcdir)/../opcodes/i386-gen.c $(srcdir)/../opcodes/i386-opc.h
+
 itbl_test_SOURCES = itbl-parse.y itbl-lex.l
 itbl_test_LDADD = itbl-tops.@OBJEXT@ itbl-test.@OBJEXT@ $(GASLIBS) @LEXLIB@
 
@@ -2064,6 +2068,13 @@ check-DEJAGNU: site.exp
 development.exp: $(BFDDIR)/development.sh
 	$(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh  \
 	  | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
+config/tc-i386.o: $(srcdir)/../opcodes/i386-init.h $(srcdir)/../opcodes/i386-tbl.h
+
+$(srcdir)/../opcodes/i386%init.h $(srcdir)/../opcodes/i386%tbl.h: @MAINT@ $(i386_tbl_deps)
+	@echo '"$@" is outdated wrt "$?"' >&2
+	@echo 'Please rebuild from the top level or in $(CURDIR)/../opcodes/' >&2
+	@false
 config/m68k-parse.c: $(srcdir)/config/m68k-parse.y
 	$(SHELL) $(YLWRAP) $(srcdir)/config/m68k-parse.y y.tab.c $@ -- $(YACCCOMPILE)
 config/m68k-parse.h: config/m68k-parse.c


More information about the Binutils-cvs mailing list