public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* opcodes: more build fixes
@ 2009-08-23  9:59 Ralf Wildenhues
  2009-08-24 12:55 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Wildenhues @ 2009-08-23  9:59 UTC (permalink / raw)
  To: binutils

Noticed that a couple of objects didn't get their dependency tracked
properly (they were recorded below .deps/, but the depfiles were not
included by the Makefile):
  opcodes/.deps/i386-gen.Po
  opcodes/.deps/ia64-gen.Po
  opcodes/.deps/msp430-dis.Plo

The first two are due to automake thinking they are created with
libtool, thus only their *.Plo files were included, not the *.Po ones.

msp430-dis is listed in CFILES but not in ALL_MACHINES (which is what
killed the dep tracking for that file).  Having to list things twice
without a consistency check is not a good idea, so I compared the two
lists and factorized them so we have to list each file once only:

CFILES contains all .c files corresponding to the .lo files listed in
ALL_MACHINES, plus these:
  dis-buf.c
  dis-init.c
  disassemble.c
  ia64-opc-a.c
  ia64-opc-b.c
  ia64-opc-f.c
  ia64-opc-i.c
  ia64-opc-m.c
  ia64-opc-d.c
  ia64-asmtab.c
  s390-mkopc.c
  z8kgen.c

The first three of those (dis*.c) are already listed in
libopcodes_la_SOURCES, so that difference is only relevant for POTFILES.

The ia64-*.c files are all generator files, as is s390-mkopc.c, so it's
right for them to not end up in libopcodes.

z8kgen.c documents to generate z8k-opc.h, but there is no
accompanying rule for this.  Intentional omission?

The patch below does the factorizes based on these observations.
Somebody should write a rule for z8kgen and z8k-opc.h (protecting
prerequisites with @MAINT@ I suppose).

OK to commit?

Note the po/POTFILES.in regen adds msp430-dis.c.

Also, do I assume correctly that i386-gen and ia64-gen only work
correctly in non-cross-compile situations, and are thus only enabled
in maintainer-mode?  Because otherwise you wouldn't necessarily be able
to execute code not compiled with CC_FOR_BUILD.  If that were to be
changed (similar to how s390-opc.c is created), then the dependency
tracking wouldn't necessarily work any more for files compiled with
this.

Thanks!
Ralf

opcodes/ChangeLog:
2009-08-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (TARGET_LIBOPCODES_CFILES): New variable, taken
	from $(CFILES), sorted, with dis-buf.c, dis-init.c, disassemble.c,
	i386-gen.c, ia64-opc-a.c, ia64-opc-b.c, ia64-opc-f.c, ia64-opc-i.c,
	ia64-opc-m.c, ia64-opc-d.c, ia64-gen.c, ia64-asmtab.c removed, and
	msp430-dis.c added.
	(LIBOPCODES_CFILES): New variable, adding to
	TARGET_LIBOPCODES_CFILES also non-target library sources.
	(CFILES): Factorize based on $(LIBOPCODES_CFILES), adding generator
	files.
	(ALL_MACHINES): Factorize based on $(TARGET_LIBOPCODES_CFILES).
	(EXTRA_libopcodes_la_SOURCES): Use $(LIBOPCODES_CFILES).
	(i386-gen, ia64-gen): Remove.
	(noinst_PROGRAMS, i386_gen_LDADD, ia64_gen_LDADD): New variables.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.

Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.143
diff -u -r1.143 Makefile.am
--- opcodes/Makefile.am	22 Aug 2009 19:02:57 -0000	1.143
+++ opcodes/Makefile.am	23 Aug 2009 09:34:15 -0000
@@ -61,13 +61,14 @@
 	xstormy16-desc.h xstormy16-opc.h \
 	z8k-opc.h
 
-# C source files that correspond to .o's.
-CFILES = \
+# C source files that correspond to .o's ending up in libopcodes
+# for all machines.
+TARGET_LIBOPCODES_CFILES = \
 	alpha-dis.c \
 	alpha-opc.c \
 	arc-dis.c \
-	arc-opc.c \
 	arc-ext.c \
+	arc-opc.c \
 	arm-dis.c \
 	avr-dis.c \
 	bfin-dis.c \
@@ -86,9 +87,6 @@
 	d30v-dis.c \
 	d30v-opc.c \
 	dlx-dis.c \
-	dis-buf.c \
-	dis-init.c \
-	disassemble.c \
 	fr30-asm.c \
 	fr30-desc.c \
 	fr30-dis.c \
@@ -99,8 +97,6 @@
 	frv-dis.c \
 	frv-ibld.c \
 	frv-opc.c \
-	moxie-dis.c \
-	moxie-opc.c \
 	h8300-dis.c \
 	h8500-dis.c \
 	hppa-dis.c \
@@ -108,19 +104,10 @@
 	i370-opc.c \
 	i386-dis.c \
 	i386-opc.c \
-	i386-gen.c \
 	i860-dis.c \
 	i960-dis.c \
 	ia64-dis.c \
-	ia64-opc-a.c \
-	ia64-opc-b.c \
-	ia64-opc-f.c \
-	ia64-opc-i.c \
-	ia64-opc-m.c \
-	ia64-opc-d.c \
 	ia64-opc.c \
-	ia64-gen.c \
-	ia64-asmtab.c \
 	ip2k-asm.c \
 	ip2k-desc.c \
 	ip2k-dis.c \
@@ -137,6 +124,10 @@
 	lm32-ibld.c \
 	lm32-opc.c \
 	lm32-opinst.c \
+	m10200-dis.c \
+	m10200-opc.c \
+	m10300-dis.c \
+	m10300-opc.c \
 	m32c-asm.c \
 	m32c-desc.c \
 	m32c-dis.c \
@@ -160,16 +151,15 @@
 	mep-dis.c \
 	mep-ibld.c \
 	mep-opc.c \
-	mips-dis.c \
 	microblaze-dis.c \
+	mips-dis.c \
 	mips-opc.c \
 	mips16-opc.c \
-	m10200-dis.c \
-	m10200-opc.c \
-	m10300-dis.c \
-	m10300-opc.c \
 	mmix-dis.c \
 	mmix-opc.c \
+	moxie-dis.c \
+	moxie-opc.c \
+	msp430-dis.c \
 	mt-asm.c \
 	mt-desc.c \
 	mt-dis.c \
@@ -189,9 +179,8 @@
 	pj-opc.c \
 	ppc-dis.c \
 	ppc-opc.c \
-	s390-mkopc.c \
-	s390-opc.c \
 	s390-dis.c \
+	s390-opc.c \
 	score-dis.c \
 	score7-dis.c \
 	sh-dis.c \
@@ -223,159 +212,31 @@
 	xstormy16-opc.c \
 	xtensa-dis.c \
 	z80-dis.c \
-	z8k-dis.c \
+	z8k-dis.c
+
+# C source files that correspond to .o's ending up in libopcodes.
+LIBOPCODES_CFILES = \
+	$(TARGET_LIBOPCODES_CFILES) \
+	dis-buf.c \
+	dis-init.c \
+	disassemble.c
+
+# C source files that correspond to .o's.
+CFILES = \
+	$(LIBOPCODES_CFILES) \
+	i386-gen.c \
+	ia64-asmtab.c \
+	ia64-gen.c \
+	ia64-opc-a.c \
+	ia64-opc-b.c \
+	ia64-opc-f.c \
+	ia64-opc-i.c \
+	ia64-opc-m.c \
+	ia64-opc-d.c \
+	s390-mkopc.c \
 	z8kgen.c
 
-ALL_MACHINES = \
-	alpha-dis.lo \
-	alpha-opc.lo \
-	arc-dis.lo \
-	arc-opc.lo \
-	arc-ext.lo \
-	arm-dis.lo \
-	avr-dis.lo \
-	bfin-dis.lo \
-	cgen-asm.lo \
-	cgen-bitset.lo \
-	cgen-dis.lo \
-	cgen-opc.lo \
-	cr16-dis.lo \
-	cr16-opc.lo \
-	cris-dis.lo \
-	cris-opc.lo \
-	crx-dis.lo \
-	crx-opc.lo \
-	d10v-dis.lo \
-	d10v-opc.lo \
-	d30v-dis.lo \
-	d30v-opc.lo \
-	dlx-dis.lo \
-	fr30-asm.lo \
-	fr30-desc.lo \
-	fr30-dis.lo \
-	fr30-ibld.lo \
-	fr30-opc.lo \
-	frv-asm.lo \
-	frv-desc.lo \
-	frv-dis.lo \
-	frv-ibld.lo \
-	frv-opc.lo \
-	moxie-dis.lo \
-	moxie-opc.lo \
-	h8300-dis.lo \
-	h8500-dis.lo \
-	hppa-dis.lo \
-	i386-dis.lo \
-	i386-opc.lo \
-	i370-dis.lo \
-	i370-opc.lo \
-	i860-dis.lo \
-	i960-dis.lo \
-	ia64-dis.lo \
-	ia64-opc.lo \
-	ip2k-asm.lo \
-	ip2k-desc.lo \
-	ip2k-dis.lo \
-	ip2k-ibld.lo \
-	ip2k-opc.lo \
-	iq2000-asm.lo \
-	iq2000-desc.lo \
-	iq2000-dis.lo \
-	iq2000-ibld.lo \
-	iq2000-opc.lo \
-	lm32-asm.lo \
-	lm32-desc.lo \
-	lm32-dis.lo \
-	lm32-ibld.lo \
-	lm32-opc.lo \
-	lm32-opinst.lo \
-	m32c-asm.lo \
-	m32c-desc.lo \
-	m32c-dis.lo \
-	m32c-ibld.lo \
-	m32c-opc.lo \
-	m32r-asm.lo \
-	m32r-desc.lo \
-	m32r-dis.lo \
-	m32r-ibld.lo \
-	m32r-opc.lo \
-	m32r-opinst.lo \
-	m68hc11-dis.lo \
-	m68hc11-opc.lo \
-	m68k-dis.lo \
-	m68k-opc.lo \
-	m88k-dis.lo \
-	m10200-dis.lo \
-	m10200-opc.lo \
-	m10300-dis.lo \
-	m10300-opc.lo \
-	maxq-dis.lo \
-	mcore-dis.lo \
-	mep-asm.lo \
-	mep-desc.lo \
-	mep-dis.lo \
-	mep-ibld.lo \
-	mep-opc.lo \
-	mips-dis.lo \
-	microblaze-dis.lo \
-	mips-opc.lo \
-	mips16-opc.lo \
-	mmix-dis.lo \
-	mmix-opc.lo \
-	msp430-dis.lo \
-	mt-asm.lo \
-	mt-desc.lo \
-	mt-dis.lo \
-	mt-ibld.lo \
-	mt-opc.lo \
-	ns32k-dis.lo \
-	openrisc-asm.lo \
-	openrisc-desc.lo \
-	openrisc-dis.lo \
-	openrisc-ibld.lo \
-	openrisc-opc.lo \
-	or32-dis.lo \
-	or32-opc.lo \
-	pdp11-dis.lo \
-	pdp11-opc.lo \
-	pj-dis.lo \
-	pj-opc.lo \
-	ppc-dis.lo \
-	ppc-opc.lo \
-	s390-dis.lo \
-	s390-opc.lo \
-	score-dis.lo \
-	score7-dis.lo \
-	sh-dis.lo \
-	sh64-dis.lo \
-	sh64-opc.lo \
-	sparc-dis.lo \
-	sparc-opc.lo \
-	spu-dis.lo \
-	spu-opc.lo \
-	tic30-dis.lo \
-	tic4x-dis.lo \
-	tic54x-dis.lo \
-	tic54x-opc.lo \
-	tic80-dis.lo \
-	tic80-opc.lo \
-	v850-dis.lo \
-	v850-opc.lo \
-	vax-dis.lo \
-	w65-dis.lo \
-	xc16x-asm.lo \
-	xc16x-desc.lo \
-	xc16x-dis.lo \
-	xc16x-ibld.lo \
-	xc16x-opc.lo \
-	xstormy16-asm.lo \
-	xstormy16-desc.lo \
-	xstormy16-dis.lo \
-	xstormy16-ibld.lo \
-	xstormy16-opc.lo \
-	xtensa-dis.lo \
-	z80-dis.lo \
-	z8k-dis.lo
+ALL_MACHINES = $(TARGET_LIBOPCODES_CFILES:.c=.lo)
 
 OFILES = @BFD_MACHINES@
 
@@ -408,7 +269,7 @@
 libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
 libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
 # Allow dependency tracking to work on all the source files.
-EXTRA_libopcodes_la_SOURCES = $(CFILES)
+EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES)
 
 # libtool will build .libs/libopcodes.a.  We create libopcodes.a in
 # the build directory so that we don't have to convert all the
@@ -577,8 +438,8 @@
 	$(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)
+noinst_PROGRAMS = i386-gen
+i386_gen_LDADD = $(LIBIBERTY)
 
 $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h 
 	@echo $@
@@ -586,8 +447,8 @@
 $(srcdir)/i386-init.h: @MAINT@ i386-gen i386-opc.tbl i386-reg.tbl
 	./i386-gen --srcdir $(srcdir)
 
-ia64-gen: ia64-gen.o
-	$(LINK) ia64-gen.o $(LIBIBERTY)
+noinst_PROGRAMS += ia64-gen
+ia64_gen_LDADD = $(LIBIBERTY)
 
 # Don't wrap the line below, as @MAINT@ can be expanded to '#'.
 # Some make versions don't handle line continuations in comments.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opcodes: more build fixes
  2009-08-23  9:59 opcodes: more build fixes Ralf Wildenhues
@ 2009-08-24 12:55 ` Alan Modra
  2009-08-24 21:56   ` Ralf Wildenhues
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2009-08-24 12:55 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: binutils

On Sun, Aug 23, 2009 at 11:41:05AM +0200, Ralf Wildenhues wrote:
> z8kgen.c documents to generate z8k-opc.h, but there is no
> accompanying rule for this.  Intentional omission?

Unintentional I would say.

> Also, do I assume correctly that i386-gen and ia64-gen only work
> correctly in non-cross-compile situations, and are thus only enabled
> in maintainer-mode?  Because otherwise you wouldn't necessarily be able
> to execute code not compiled with CC_FOR_BUILD.  If that were to be
> changed (similar to how s390-opc.c is created), then the dependency
> tracking wouldn't necessarily work any more for files compiled with
> this.

I think it's a bug that CC_FOR_BUILD isn't used here.

> 	* Makefile.am (TARGET_LIBOPCODES_CFILES): New variable, taken
> 	from $(CFILES), sorted, with dis-buf.c, dis-init.c, disassemble.c,
> 	i386-gen.c, ia64-opc-a.c, ia64-opc-b.c, ia64-opc-f.c, ia64-opc-i.c,
> 	ia64-opc-m.c, ia64-opc-d.c, ia64-gen.c, ia64-asmtab.c removed, and
> 	msp430-dis.c added.
> 	(LIBOPCODES_CFILES): New variable, adding to
> 	TARGET_LIBOPCODES_CFILES also non-target library sources.
> 	(CFILES): Factorize based on $(LIBOPCODES_CFILES), adding generator
> 	files.
> 	(ALL_MACHINES): Factorize based on $(TARGET_LIBOPCODES_CFILES).
> 	(EXTRA_libopcodes_la_SOURCES): Use $(LIBOPCODES_CFILES).
> 	(i386-gen, ia64-gen): Remove.
> 	(noinst_PROGRAMS, i386_gen_LDADD, ia64_gen_LDADD): New variables.
> 	* Makefile.in: Regenerate.
> 	* po/POTFILES.in: Regenerate.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opcodes: more build fixes
  2009-08-24 12:55 ` Alan Modra
@ 2009-08-24 21:56   ` Ralf Wildenhues
  2009-08-24 22:24     ` Ralf Wildenhues
  2009-08-25  4:38     ` Alan Modra
  0 siblings, 2 replies; 5+ messages in thread
From: Ralf Wildenhues @ 2009-08-24 21:56 UTC (permalink / raw)
  To: binutils; +Cc: Dave Korn

Hello Alan,

* Alan Modra wrote on Mon, Aug 24, 2009 at 10:46:51AM CEST:
> On Sun, Aug 23, 2009 at 11:41:05AM +0200, Ralf Wildenhues wrote:
> > z8kgen.c documents to generate z8k-opc.h, but there is no
> > accompanying rule for this.  Intentional omission?
> 
> Unintentional I would say.

Ok.  Below has a first cut of such a rule.

> > Also, do I assume correctly that i386-gen and ia64-gen only work
> > correctly in non-cross-compile situations, and are thus only enabled
> > in maintainer-mode?  Because otherwise you wouldn't necessarily be able
> > to execute code not compiled with CC_FOR_BUILD.  If that were to be
> > changed (similar to how s390-opc.c is created), then the dependency
> > tracking wouldn't necessarily work any more for files compiled with
> > this.
> 
> I think it's a bug that CC_FOR_BUILD isn't used here.

Well, but in that case there are more issues than just CC_FOR_BUILD.
Using $(LINK) is wrong, too.  The inclusion of "config.h" from the
current directory is wrong, as that will have settings for the host
compiler $CC, not for $CC_FOR_BUILD.  LIBIBERTY is wrong, that should be
BUILD_LIBIBERTY, and for that we'd need more machinery to get its value
right.

And then there is DaveK's posted mail (without patch) to add LIBINTL,
which would also be wrong in cross compile mode, because it would have
to be BUILD_LIBINTL, and that would require even more other build
machinery changes.  (BTW, maybe the easiest way out is to just not use
i18n in generator binaries, like gcc/ does.)

At least if I understand correctly.

In this case, the *-gen* parts of my previous patch are wrong, and I
have applied it only after dropping these hunks:

> > 	(i386-gen, ia64-gen): Remove.
> > 	(noinst_PROGRAMS, i386_gen_LDADD, ia64_gen_LDADD): New variables.

The following lays some foundation for improving things, but it still
doesn't work if you enable both cross-compilation and maintainer-mode.

The patch goes back to manual dependencies for stuff built with the
$build compiler.  It adds suitable entries for the various *clean
targets.  Noticing that created C files ought to be built before the po/
machinery runs on them, subdir make ordering is fixed.  Consistently to
how is done in binutils/, $(EXEEXT_FOR_BUILD) and similar are used.

Also, to avoid parallel make failures, it needs manual dependencies for
the generator output files.

The z8kgen compilation required a compiler warning fix.

I don't mind whether this is applied now, or postponed until a more
complete solution is available, but to me it looks like at least it
shouldn't regress anywhere.

DaveK's LIBINTL addition is missing from the patch below.

Cheers,
Ralf

opcodes/ChangeLog:
2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* 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/Makefile.am b/opcodes/Makefile.am
index f9b7060..465ea05 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/z8k-opc.h b/opcodes/z8k-opc.h
index ba05fbe..837dd39 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 bb513ba..9fb7de2 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\

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opcodes: more build fixes
  2009-08-24 21:56   ` Ralf Wildenhues
@ 2009-08-24 22:24     ` Ralf Wildenhues
  2009-08-25  4:38     ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Wildenhues @ 2009-08-24 22:24 UTC (permalink / raw)
  To: binutils; +Cc: Dave Korn

* Ralf Wildenhues wrote on Mon, Aug 24, 2009 at 11:41:11PM CEST:
> 
> Also, to avoid parallel make failures, it needs manual dependencies for
> the generator output files.

To clarify what I meant with this: We need manual dependencies from the
output files generated by the *-gen programs to those objects whose
sources include these files:

> +i386-opc.lo: $(srcdir)/i386-tbl.h

> +ia64-opc.lo: $(srcdir)/ia64-asmtab.c

>  s390-opc.lo: s390-opc.tab

> +z8k-dis.lo: $(srcdir)/z8k-opc.h

because otherwise a
  make maintainer-clean; cd ..; ../src/configure ... && make

won't rebuild the headers early enough.  A rebuild in a built tree will
of course have correct dependencies listed in .deps/.  (Could also add
them to BUILT_SOURCES instead.)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: opcodes: more build fixes
  2009-08-24 21:56   ` Ralf Wildenhues
  2009-08-24 22:24     ` Ralf Wildenhues
@ 2009-08-25  4:38     ` Alan Modra
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Modra @ 2009-08-25  4:38 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: binutils, Dave Korn

On Mon, Aug 24, 2009 at 11:41:11PM +0200, Ralf Wildenhues wrote:
> * Alan Modra wrote on Mon, Aug 24, 2009 at 10:46:51AM CEST:
> > I think it's a bug that CC_FOR_BUILD isn't used here.
> 
> Well, but in that case there are more issues than just CC_FOR_BUILD.
> Using $(LINK) is wrong, too.  The inclusion of "config.h" from the
> current directory is wrong, as that will have settings for the host
> compiler $CC, not for $CC_FOR_BUILD.  LIBIBERTY is wrong, that should be
> BUILD_LIBIBERTY, and for that we'd need more machinery to get its value
> right.

I'd forgotten about the libiberty problem.  Please don't think my
comment that "it's a bug" means that I think you ought to fix it!

> And then there is DaveK's posted mail (without patch) to add LIBINTL,
> which would also be wrong in cross compile mode, because it would have
> to be BUILD_LIBINTL, and that would require even more other build
> machinery changes.  (BTW, maybe the easiest way out is to just not use
> i18n in generator binaries, like gcc/ does.)

Agreed.  We could also assume there are build libraries already
available on the build machine.  So, for example, just use -liberty
for the generator binaries when cross compiling.

> I don't mind whether this is applied now, or postponed until a more
> complete solution is available, but to me it looks like at least it
> shouldn't regress anywhere.

The patch is OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-25  2:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-23  9:59 opcodes: more build fixes Ralf Wildenhues
2009-08-24 12:55 ` Alan Modra
2009-08-24 21:56   ` Ralf Wildenhues
2009-08-24 22:24     ` Ralf Wildenhues
2009-08-25  4:38     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).