From: Ralf Wildenhues Date: Tue, 25 Aug 2009 03:13:44 +0000 (+0000) Subject: Build cleanups in opcodes: cross-compilation and generators. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff13a42d5c968badcfcb98c5c629917acb5d11a3;p=binutils-gdb.git Build cleanups in opcodes: cross-compilation and generators. opcodes/: * Makefile.am (SUBDIRS): Build '.' before 'po'. (COMPILE_FOR_BUILD, LINK_FOR_BUILD, BUILD_LIBIBERTY) (MOSTLYCLEANFILES, MAINTAINERCLEANFILES): New variables. (i386-gen$(EXEEXT_FOR_BUILD)): Renamed from i386-gen, rewrite using *BUILD variables, depend upon $(BUILD_LIBIBERTY). (i386-gen.o): New rule. ($(srcdir)/i386-init.h): Adjust. (i386-opc.lo): Depend on $(srcdir)/i386-tbl.h. (ia64-gen$(EXEEXT_FOR_BUILD)): Rename from ia64-gen, adjust likewise. (ia64-gen.o): New rule. (ia64_asmtab_deps): New variable. ($(srcdir)/ia64-asmtab.c): Use it; adjust likewise. (ia64-opc.lo): Depend on $(srcdir)/ia64-asmtab.c. (s390-mkopc$(EXEEXT_FOR_BUILD)): Rename from s390-mkopc, adjust likewise. (s390-opc.tab): Adjust. (z8kgen$(EXEEXT_FOR_BUILD), z8kgen.o, $(srcdir)/z8k-opc.h): New rules. (z8k-dis.lo): Depend on $(srcdir)/z8k-opc.h. * Makefile.in: Regenerate. * z8kgen.c (gas): Avoid '/*' in comment. * z8k-opc.h (func): Regenerate. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 22cd1dfa8f4..9b0e2a0253f 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,28 @@ +2009-08-25 Ralf Wildenhues + + * Makefile.am (SUBDIRS): Build '.' before 'po'. + (COMPILE_FOR_BUILD, LINK_FOR_BUILD, BUILD_LIBIBERTY) + (MOSTLYCLEANFILES, MAINTAINERCLEANFILES): New variables. + (i386-gen$(EXEEXT_FOR_BUILD)): Renamed from i386-gen, rewrite + using *BUILD variables, depend upon $(BUILD_LIBIBERTY). + (i386-gen.o): New rule. + ($(srcdir)/i386-init.h): Adjust. + (i386-opc.lo): Depend on $(srcdir)/i386-tbl.h. + (ia64-gen$(EXEEXT_FOR_BUILD)): Rename from ia64-gen, adjust likewise. + (ia64-gen.o): New rule. + (ia64_asmtab_deps): New variable. + ($(srcdir)/ia64-asmtab.c): Use it; adjust likewise. + (ia64-opc.lo): Depend on $(srcdir)/ia64-asmtab.c. + (s390-mkopc$(EXEEXT_FOR_BUILD)): Rename from s390-mkopc, adjust + likewise. + (s390-opc.tab): Adjust. + (z8kgen$(EXEEXT_FOR_BUILD), z8kgen.o, $(srcdir)/z8k-opc.h): New + rules. + (z8k-dis.lo): Depend on $(srcdir)/z8k-opc.h. + * Makefile.in: Regenerate. + * z8kgen.c (gas): Avoid '/*' in comment. + * z8k-opc.h (func): Regenerate. + 2009-08-24 Ralf Wildenhues * Makefile.am (TARGET_LIBOPCODES_CFILES): New variable, taken diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index f9b7060306f..465ea05b795 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -3,7 +3,8 @@ AUTOMAKE_OPTIONS = 1.11 foreign no-dist ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd -SUBDIRS = po +# Build '.' first so all generated files exist. +SUBDIRS = . po INCDIR = $(srcdir)/../include BFDDIR = $(srcdir)/../bfd @@ -12,6 +13,10 @@ WARN_CFLAGS = @WARN_CFLAGS@ NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) +COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(INCLUDES) $(AM_CPPFLAGS) \ + $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) +LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ + bfdlibdir = @bfdlibdir@ bfdincludedir = @bfdincludedir@ @@ -29,6 +34,8 @@ BFD_H = ../bfd/bfd.h # This is where libiberty lives. LIBIBERTY = ../libiberty/libiberty.a +# This is only true when not cross-compiling. +BUILD_LIBIBERTY = $(LIBIBERTY) # Header files. HFILES = \ @@ -438,31 +445,67 @@ stamp-xc16x: $(CGENDEPS) $(CPUDIR)/xc16x.cpu $(CPUDIR)/xc16x.opc $(MAKE) run-cgen arch=xc16x prefix=xc16x options= \ archfile=$(CPUDIR)/xc16x.cpu opcfile=$(CPUDIR)/xc16x.opc extrafiles= -i386-gen: i386-gen.o - $(LINK) i386-gen.o $(LIBIBERTY) +MOSTLYCLEANFILES = i386-gen$(EXEEXT_FOR_BUILD) ia64-gen$(EXEEXT_FOR_BUILD) \ + s390-mkopc$(EXEEXT_FOR_BUILD) z8kgen$(EXEEXT_FOR_BUILD) + +MAINTAINERCLEANFILES = $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h \ + $(srcdir)/ia64-asmtab.c s390-opc.tab $(srcdir)/z8k-opc.h + +i386-gen$(EXEEXT_FOR_BUILD): i386-gen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) i386-gen.o $(BUILD_LIBIBERTY) + +i386-gen.o: i386-gen.c i386-opc.h $(srcdir)/../include/opcode/i386.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/opcode/i386.h $(INCDIR)/safe-ctype.h \ + config.h i386-opc.h sysdep.h + $(COMPILE_FOR_BUILD) -c $(srcdir)/i386-gen.c $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h @echo $@ -$(srcdir)/i386-init.h: @MAINT@ i386-gen i386-opc.tbl i386-reg.tbl - ./i386-gen --srcdir $(srcdir) +$(srcdir)/i386-init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl + ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) + +i386-opc.lo: $(srcdir)/i386-tbl.h + +ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBIBERTY) -ia64-gen: ia64-gen.o - $(LINK) ia64-gen.o $(LIBIBERTY) +ia64-gen.o: ia64-gen.c $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ + $(INCDIR)/libiberty.h $(INCDIR)/opcode/ia64.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/symcat.h config.h ia64-opc-a.c ia64-opc-b.c \ + ia64-opc-d.c ia64-opc-f.c ia64-opc-i.c ia64-opc-m.c \ + ia64-opc-x.c ia64-opc.h sysdep.h + $(COMPILE_FOR_BUILD) -c $(srcdir)/ia64-gen.c -# Don't wrap the line below, as @MAINT@ can be expanded to '#'. -# Some make versions don't handle line continuations in comments. -$(srcdir)/ia64-asmtab.c: @MAINT@ ia64-gen ia64-ic.tbl ia64-raw.tbl ia64-waw.tbl ia64-war.tbl - ./ia64-gen --srcdir $(srcdir) > $@ +# Use a helper variable for the dependencies to avoid 'make' issues +# with continuations in comments, as @MAINT@ can be expanded to '#'. +ia64_asmtab_deps = ia64-gen$(EXEEXT_FOR_BUILD) ia64-ic.tbl \ + ia64-raw.tbl ia64-waw.tbl ia64-war.tbl +$(srcdir)/ia64-asmtab.c: @MAINT@ $(ia64_asmtab_deps) + ./ia64-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) > $@ -s390-mkopc: s390-mkopc.c - $(CC_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c +ia64-opc.lo: $(srcdir)/ia64-asmtab.c -s390-opc.tab: s390-mkopc s390-opc.txt - ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab +s390-mkopc$(EXEEXT_FOR_BUILD): s390-mkopc.c + $(COMPILE_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c + +s390-opc.tab: s390-mkopc$(EXEEXT_FOR_BUILD) s390-opc.txt + ./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab s390-opc.lo: s390-opc.tab +z8kgen$(EXEEXT_FOR_BUILD): z8kgen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) z8kgen.o $(BUILD_LIBIBERTY) + +z8kgen.o: z8kgen.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/z8kgen.c + +$(srcdir)/z8k-opc.h: @MAINT@ z8kgen$(EXEEXT_FOR_BUILD) + ./z8kgen$(EXEEXT_FOR_BUILD) -a > $@ + +z8k-dis.lo: $(srcdir)/z8k-opc.h + sh-dis.lo: sh-dis.c if am__fastdepCC $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ @archdefs@ $(srcdir)/sh-dis.c diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 7ac2b6c7ad7..b7892028bda 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -281,10 +281,16 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.11 foreign no-dist ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd -SUBDIRS = po + +# Build '.' first so all generated files exist. +SUBDIRS = . po INCDIR = $(srcdir)/../include BFDDIR = $(srcdir)/../bfd AM_CFLAGS = $(WARN_CFLAGS) +COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(INCLUDES) $(AM_CPPFLAGS) \ + $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) + +LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ libopcodes_la_LDFLAGS = $(am__append_1) -release `cat \ ../bfd/libtool-soversion` @SHARED_LDFLAGS@ @INSTALL_LIBBFD_TRUE@bfdlib_LTLIBRARIES = libopcodes.la @@ -296,6 +302,8 @@ BFD_H = ../bfd/bfd.h # This is where libiberty lives. LIBIBERTY = ../libiberty/libiberty.a +# This is only true when not cross-compiling. +BUILD_LIBIBERTY = $(LIBIBERTY) # Header files. HFILES = \ @@ -572,6 +580,18 @@ CGEN_CPUS = fr30 frv ip2k m32c m32r mep mt openrisc xc16x xstormy16 @CGEN_MAINT_TRUE@XC16X_DEPS = stamp-xc16x @CGEN_MAINT_FALSE@XSTORMY16_DEPS = @CGEN_MAINT_TRUE@XSTORMY16_DEPS = stamp-xstormy16 +MOSTLYCLEANFILES = i386-gen$(EXEEXT_FOR_BUILD) ia64-gen$(EXEEXT_FOR_BUILD) \ + s390-mkopc$(EXEEXT_FOR_BUILD) z8kgen$(EXEEXT_FOR_BUILD) + +MAINTAINERCLEANFILES = $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h \ + $(srcdir)/ia64-asmtab.c s390-opc.tab $(srcdir)/z8k-opc.h + + +# Use a helper variable for the dependencies to avoid 'make' issues +# with continuations in comments, as @MAINT@ can be expanded to '#'. +ia64_asmtab_deps = ia64-gen$(EXEEXT_FOR_BUILD) ia64-ic.tbl \ + ia64-raw.tbl ia64-waw.tbl ia64-war.tbl + all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1043,6 +1063,7 @@ install-strip: `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -1054,6 +1075,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-bfdlibLTLIBRARIES clean-generic clean-libtool \ @@ -1267,31 +1289,56 @@ stamp-xc16x: $(CGENDEPS) $(CPUDIR)/xc16x.cpu $(CPUDIR)/xc16x.opc $(MAKE) run-cgen arch=xc16x prefix=xc16x options= \ archfile=$(CPUDIR)/xc16x.cpu opcfile=$(CPUDIR)/xc16x.opc extrafiles= -i386-gen: i386-gen.o - $(LINK) i386-gen.o $(LIBIBERTY) +i386-gen$(EXEEXT_FOR_BUILD): i386-gen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) i386-gen.o $(BUILD_LIBIBERTY) + +i386-gen.o: i386-gen.c i386-opc.h $(srcdir)/../include/opcode/i386.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/opcode/i386.h $(INCDIR)/safe-ctype.h \ + config.h i386-opc.h sysdep.h + $(COMPILE_FOR_BUILD) -c $(srcdir)/i386-gen.c $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h @echo $@ -$(srcdir)/i386-init.h: @MAINT@ i386-gen i386-opc.tbl i386-reg.tbl - ./i386-gen --srcdir $(srcdir) +$(srcdir)/i386-init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl + ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) -ia64-gen: ia64-gen.o - $(LINK) ia64-gen.o $(LIBIBERTY) +i386-opc.lo: $(srcdir)/i386-tbl.h -# Don't wrap the line below, as @MAINT@ can be expanded to '#'. -# Some make versions don't handle line continuations in comments. -$(srcdir)/ia64-asmtab.c: @MAINT@ ia64-gen ia64-ic.tbl ia64-raw.tbl ia64-waw.tbl ia64-war.tbl - ./ia64-gen --srcdir $(srcdir) > $@ +ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBIBERTY) -s390-mkopc: s390-mkopc.c - $(CC_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c +ia64-gen.o: ia64-gen.c $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h \ + $(INCDIR)/libiberty.h $(INCDIR)/opcode/ia64.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/symcat.h config.h ia64-opc-a.c ia64-opc-b.c \ + ia64-opc-d.c ia64-opc-f.c ia64-opc-i.c ia64-opc-m.c \ + ia64-opc-x.c ia64-opc.h sysdep.h + $(COMPILE_FOR_BUILD) -c $(srcdir)/ia64-gen.c +$(srcdir)/ia64-asmtab.c: @MAINT@ $(ia64_asmtab_deps) + ./ia64-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) > $@ -s390-opc.tab: s390-mkopc s390-opc.txt - ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab +ia64-opc.lo: $(srcdir)/ia64-asmtab.c + +s390-mkopc$(EXEEXT_FOR_BUILD): s390-mkopc.c + $(COMPILE_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c + +s390-opc.tab: s390-mkopc$(EXEEXT_FOR_BUILD) s390-opc.txt + ./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab s390-opc.lo: s390-opc.tab +z8kgen$(EXEEXT_FOR_BUILD): z8kgen.o $(BUILD_LIBIBERTY) + $(LINK_FOR_BUILD) z8kgen.o $(BUILD_LIBIBERTY) + +z8kgen.o: z8kgen.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/z8kgen.c + +$(srcdir)/z8k-opc.h: @MAINT@ z8kgen$(EXEEXT_FOR_BUILD) + ./z8kgen$(EXEEXT_FOR_BUILD) -a > $@ + +z8k-dis.lo: $(srcdir)/z8k-opc.h + sh-dis.lo: sh-dis.c @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ @archdefs@ $(srcdir)/sh-dis.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h index ba05fbea304..837dd39c130 100644 --- a/opcodes/z8k-opc.h +++ b/opcodes/z8k-opc.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated by z8kgen. */ -/* Copyright 2007 Free Software Foundation, Inc. +/* Copyright 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -289,7 +289,7 @@ typedef struct { #endif const char *name; unsigned char opcode; - void (*func) PARAMS ((void)); + void (*func) (void); unsigned int arg_info[4]; unsigned int byte_info[10]; int noperands; diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index bb513ba4300..9fb7de23137 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -1,4 +1,4 @@ -/* Copyright 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. +/* Copyright 2001, 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -969,9 +969,9 @@ gas (void) printf ("/* DO NOT EDIT! -*- buffer-read-only: t -*-\n"); printf (" This file is automatically generated by z8kgen. */\n\n"); - printf ("/* Copyright 2007 Free Software Foundation, Inc.\n\ + printf ("/* Copyright 2007, 2009 Free Software Foundation, Inc.\n\ \n\ -/* This file is part of the GNU opcodes library.\n\ + This file is part of the GNU opcodes library.\n\ \n\ This library is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\