This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]: Fix dependencies in opcodes/Makefile.am


On Fri, Sep 04, 2009 at 02:55:04PM +0200, Tristan Gingold wrote:
> Hi,
> 
> while trying to regenerate files for the release, I got a failure in opcodes:
> On my system (Darwin), LIBINTL is defined as '.../libintl.a -liconv' and
> therefore can't be used as a dependency.  Looks like LIBINTL_DEP is the
> right macro for that.
> 
> Ok for mainline ?  (Will backport to the branch).
> 
> Tristan.
> 
> opcodes/
> 2009-09-04  Tristan Gingold  <gingold@adacore.com>
> 
> 	* Makefile.am (i386-gen): Use LIBINTL_DEP for dependency instead
> 	of BUILD_LIBINTL.
> 	(ia64-gen): Ditto.
> 	(z8kgen$): Ditto.
> 	* Makefile: Regenerate.

This is OK, but can we do something about the cross-compile case?
How does the following hack look?

Index: opcodes/configure.in
===================================================================
RCS file: /cvs/src/src/opcodes/configure.in,v
retrieving revision 1.92
diff -u -p -r1.92 configure.in
--- opcodes/configure.in	6 Aug 2009 17:38:04 -0000	1.92
+++ opcodes/configure.in	4 Sep 2009 14:45:48 -0000
@@ -101,6 +101,22 @@ AC_CACHE_CHECK(linker --as-needed suppor
 
 LT_LIB_M
 
+#Libs for generator progs
+if test "x$cross_compiling" = "xno"; then
+  BUILD_LIBS=../libiberty/libiberty.a
+  BUILD_LIB_DEPS=$BUILD_LIBS
+else
+  # if cross-compiling, assume we already have -liberty
+  # and that the version is compatible with new headers.
+  BUILD_LIBS=-liberty
+  BUILD_LIB_DEPS=
+fi
+BUILD_LIBS="$BUILD_LIBS $LIBINTL"
+BUILD_LIB_DEPS="$BUILD_LIB_DEPS $LIBINTL_DEP"
+
+AC_SUBST(BUILD_LIBS)
+AC_SUBST(BUILD_LIB_DEPS)
+
 # Horrible hacks to build DLLs on Windows and a shared library elsewhere.
 SHARED_LDFLAGS=
 SHARED_LIBADD=
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.148
diff -u -p -r1.148 Makefile.am
--- opcodes/Makefile.am	3 Sep 2009 04:47:46 -0000	1.148
+++ opcodes/Makefile.am	4 Sep 2009 14:45:48 -0000
@@ -36,12 +36,8 @@ endif
 # This is where bfd.h lives.
 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)
-# And so is this.
-BUILD_LIBINTL = $(LIBINTL)
+BUILD_LIBS = @BUILD_LIBS@
+BUILD_LIB_DEPS = @BUILD_LIB_DEPS@
 
 # Header files.
 HFILES = \
@@ -457,8 +453,8 @@ MOSTLYCLEANFILES = i386-gen$(EXEEXT_FOR_
 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) $(BUILD_LIBINTL)
-	$(LINK_FOR_BUILD) i386-gen.o $(BUILD_LIBIBERTY) $(BUILD_LIBINTL)
+i386-gen$(EXEEXT_FOR_BUILD): i386-gen.o $(BUILD_LIB_DEPS)
+	$(LINK_FOR_BUILD) i386-gen.o $(BUILD_LIBS)
 
 i386-gen.o: i386-gen.c i386-opc.h $(srcdir)/../include/opcode/i386.h \
 	$(INCDIR)/ansidecl.h $(INCDIR)/getopt.h $(INCDIR)/hashtab.h \
@@ -474,8 +470,8 @@ $(srcdir)/i386-init.h: @MAINT@ i386-gen$
 
 i386-opc.lo: $(srcdir)/i386-tbl.h
 
-ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIBIBERTY) $(BUILD_LIBINTL)
-	$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBIBERTY) $(BUILD_LIBINTL)
+ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIB_DEPS)
+	$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBS)
 
 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 \
@@ -501,8 +497,8 @@ s390-opc.tab: s390-mkopc$(EXEEXT_FOR_BUI
 
 s390-opc.lo: s390-opc.tab
 
-z8kgen$(EXEEXT_FOR_BUILD): z8kgen.o $(BUILD_LIBIBERTY) $(BUILD_LIBINTL)
-	$(LINK_FOR_BUILD) z8kgen.o $(BUILD_LIBIBERTY) $(BUILD_LIBINTL)
+z8kgen$(EXEEXT_FOR_BUILD): z8kgen.o $(BUILD_LIB_DEPS)
+	$(LINK_FOR_BUILD) z8kgen.o $(BUILD_LIBS)
 
 z8kgen.o: z8kgen.c
 	$(COMPILE_FOR_BUILD) -c $(srcdir)/z8kgen.c


-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]