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 move-if-change for VPATH builds


I was visually inspecting the letter I've just sent and have found an
error in the patch (in binutils/Makefile.am, the "MOVE_IF_CHANGE ="
line). I'm surprised that this didn't pop up during compilation.

Sending the fixed patch. Please ignore the previous one, and sorry for
the inconvenience.


On Sun, 2007-12-23 at 01:13 +0300, Dmitry Shatrov wrote:
> Hello, binutils list!
> 
> I'm proposing a patch that fixes a problem I've had with building
> binutils-2.18. Building binutils-2.18 fails under the following
> conditions:
> 1. makeinfo is not installed
> 2. binutils are built in an external directory "binutils-build"
> 
> I am building it from an external directory because the "Linux From
> Scratch" book says that it is a recommended way of building binutils.
> 
> The build is failing because in binutils-2.18.tar.bz2 the timestamp of
> bfd/elf.c is greater than the timestamp of bfd/doc/elf.texi, so elf.texi
> is treated as requiring reubilding. As the result, bfd/doc/elf.texi gets
> reextracted from bfd/elf.c, and its timestamp becomes greater than the
> timestamp of bfd.texinfo. Building the latter fails, because makeinfo is
> missing.
> 
> This problem doesn't get triggered when building from the directory
> where binutils is unpacked, because there is the "move-if-change" script
> which determines that the newly extracted elf.tmp is actually the same
> as the present elf.texi, and thus the timestamp of elf.texi doesn't get
> changed. It turns out that the "move-if-change" script in its current
> form is inappropriate for VPATH builds: it doesn't break anything, but
> also doesn't help in situations it is meant to help.
> 
> What I suggest is making "move-if-change" aware of the directory where
> building is performed by passing "$(srcdir)" to it as the first
> argument. The only change in the algorithm is adding the following rule:
> "If the destination file "dstfile" is the same as the source file and
> the destination file doesn't exist in the current directory, then create
> a symbolic link "dstfile" pointing to "$(srcdir)/dstfile".
> 
> The rest of the patch is about making all invocations of
> "move-if-change" to supply "$(srcdir)" as the first argument.
> 
> The patch is against current binutils from CVS.
> 
> I've tested it for a while, with both texinfo installed and removed, for
> VPATH and non-VPATH builds, and for different combinations of timestamps
> on corresponding ".c", ".texi" and ".info" files, and it seems to work
> fine.
> 
> The patch includes changes to several "configure.ac" and "Makefile.am"
> files, but I didn't update corresponding "configure" and "Makefile.in"
> files before diff'ing, so autoconf and automake have to be invoked in
> all directories with the changed files after applying the patch.
> 
> Wbr,
> Dmitry
diff -urN binutils-orig/bfd/doc/Makefile.am binutils/bfd/doc/Makefile.am
--- binutils-orig/bfd/doc/Makefile.am	2007-04-09 19:36:44.000000000 +0400
+++ binutils/bfd/doc/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -54,6 +54,8 @@
 info_TEXINFOS = bfd.texinfo
 bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
 
+MOVE_IF_CHANGE = $(srcdir)/../../move-if-change "$(srcdir)"
+
 MKDOC = chew$(EXEEXT_FOR_BUILD)
 
 INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
@@ -63,7 +65,7 @@
 	$(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \
 	  $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
 	  $(INCLUDES); \
-	$(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
+	$(SHELL) $(MOVE_IF_CHANGE) chew.$$$$ $(MKDOC)
 
 chew.o: chew.c
 	$(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c
@@ -81,114 +83,114 @@
 aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
-	$(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
+	$(SHELL) $(MOVE_IF_CHANGE) aoutx.tmp aoutx.texi
 
 archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
-	$(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
+	$(SHELL) $(MOVE_IF_CHANGE) archive.tmp archive.texi
 
 archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
-	$(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
+	$(SHELL) $(MOVE_IF_CHANGE) archures.tmp archures.texi
 
 # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
 # bfd.texinfo on an 8.3 filesystem.
 bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
-	$(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
+	$(SHELL) $(MOVE_IF_CHANGE) bfd.tmp bfdt.texi
 
 cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
-	$(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
+	$(SHELL) $(MOVE_IF_CHANGE) cache.tmp cache.texi
 
 coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
-	$(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
+	$(SHELL) $(MOVE_IF_CHANGE) coffcode.tmp coffcode.texi
 
 core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
-	$(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
+	$(SHELL) $(MOVE_IF_CHANGE) core.tmp core.texi
 
 elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
-	$(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
+	$(SHELL) $(MOVE_IF_CHANGE) elf.tmp elf.texi
 
 elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
-	$(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
+	$(SHELL) $(MOVE_IF_CHANGE) elfcode.tmp elfcode.texi
 
 mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
-	$(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
+	$(SHELL) $(MOVE_IF_CHANGE) mmo.tmp mmo.texi
 
 format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
-	$(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
+	$(SHELL) $(MOVE_IF_CHANGE) format.tmp format.texi
 
 libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
-	$(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
+	$(SHELL) $(MOVE_IF_CHANGE) libbfd.tmp libbfd.texi
 
 bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
-	$(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
+	$(SHELL) $(MOVE_IF_CHANGE) bfdio.tmp bfdio.texi
 
 bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
-	$(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
+	$(SHELL) $(MOVE_IF_CHANGE) bfdwin.tmp bfdwin.texi
 
 opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str  <$(srcdir)/../opncls.c >opncls.tmp
-	$(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
+	$(SHELL) $(MOVE_IF_CHANGE) opncls.tmp opncls.texi
 
 reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
-	$(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
+	$(SHELL) $(MOVE_IF_CHANGE) reloc.tmp reloc.texi
 
 section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
-	$(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
+	$(SHELL) $(MOVE_IF_CHANGE) section.tmp section.texi
 
 syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
-	$(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
+	$(SHELL) $(MOVE_IF_CHANGE) syms.tmp syms.texi
 
 targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
-	$(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
+	$(SHELL) $(MOVE_IF_CHANGE) targets.tmp targets.texi
 
 init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
-	$(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
+	$(SHELL) $(MOVE_IF_CHANGE) init.tmp init.texi
 
 hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
-	$(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
+	$(SHELL) $(MOVE_IF_CHANGE) hash.tmp hash.texi
 
 linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
 	$(MAKE) $(MKDOC)
 	./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
-	$(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
+	$(SHELL) $(MOVE_IF_CHANGE) linker.tmp linker.texi
 
 LIBBFD_H_DEP = \
 	$(srcdir)/../libbfd-in.h	\
diff -urN binutils-orig/bfd/Makefile.am binutils/bfd/Makefile.am
--- binutils-orig/bfd/Makefile.am	2007-11-08 16:51:06.000000000 +0300
+++ binutils/bfd/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -10,6 +10,8 @@
 CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
 MKDEP = gcc -MM
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 SUBDIRS = doc po
 
 bfddocdir = doc
@@ -742,7 +744,7 @@
 	  esac ; \
 	done ; \
 	echo $$f > tofiles
-	$(SHELL) $(srcdir)/../move-if-change tofiles ofiles
+	$(SHELL) $(MOVE_IF_CHANGE) tofiles ofiles
 	touch stamp-ofiles
 
 ofiles: stamp-ofiles ; @true
@@ -767,7 +769,7 @@
 	if [ -f $$libtooldir/libbfd.a ]; then \
 	  cp $$libtooldir/libbfd.a libbfd.tmp; \
 	  $(RANLIB) libbfd.tmp; \
-	  $(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
+	  $(SHELL) $(MOVE_IF_CHANGE) libbfd.tmp libbfd.a; \
 	else true; fi
 	touch stamp-lib
 
@@ -894,17 +896,17 @@
 dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 host-aout.lo: Makefile
 
@@ -920,7 +922,7 @@
 stmp-bfd-h: bfd-in3.h
 	rm -f bfd-tmp.h
 	cp bfd-in3.h bfd-tmp.h
-	$(SHELL) $(srcdir)/../move-if-change bfd-tmp.h $(BFD_H)
+	$(SHELL) $(MOVE_IF_CHANGE) bfd-tmp.h $(BFD_H)
 	rm -f bfd-tmp.h
 	touch stmp-bfd-h
 
@@ -936,11 +938,11 @@
 headers:
 	(cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS))
 	cp $(bfddocdir)/bfd.h bfd-in2.h-new
-	$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
+	$(SHELL) $(MOVE_IF_CHANGE) bfd-in2.h-new $(srcdir)/bfd-in2.h
 	cp $(bfddocdir)/libbfd.h libbfd.h-new
-	$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
+	$(SHELL) $(MOVE_IF_CHANGE) libbfd.h-new $(srcdir)/libbfd.h
 	cp $(bfddocdir)/libcoff.h libcoff.h-new
-	$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
+	$(SHELL) $(MOVE_IF_CHANGE) libcoff.h-new $(srcdir)/libcoff.h
 
 # We only rebuild the header files automatically if we have been
 # configured with --enable-maintainer-mode.
@@ -949,21 +951,21 @@
 stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
 	(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
 	cp $(bfddocdir)/bfd.h bfd-in2.h-new
-	$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
+	$(SHELL) $(MOVE_IF_CHANGE) bfd-in2.h-new $(srcdir)/bfd-in2.h
 	touch stmp-bin2-h
 
 $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true
 stmp-lbfd-h: $(LIBBFD_H_FILES)
 	(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
 	cp $(bfddocdir)/libbfd.h libbfd.h-new
-	$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
+	$(SHELL) $(MOVE_IF_CHANGE) libbfd.h-new $(srcdir)/libbfd.h
 	touch stmp-lbfd-h
 
 $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true
 stmp-lcoff-h: $(LIBCOFF_H_FILES)
 	(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
 	cp $(bfddocdir)/libcoff.h libcoff.h-new
-	$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
+	$(SHELL) $(MOVE_IF_CHANGE) libcoff.h-new $(srcdir)/libcoff.h
 	touch stmp-lcoff-h
 
 MOSTLYCLEANFILES = ofiles stamp-ofiles
diff -urN binutils-orig/binutils/Makefile.am binutils/binutils/Makefile.am
--- binutils-orig/binutils/Makefile.am	2007-10-24 08:55:01.000000000 +0400
+++ binutils/binutils/Makefile.am	2007-12-23 01:21:15.000000000 +0300
@@ -17,6 +17,8 @@
 YFLAGS = -d
 LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
 AM_CFLAGS = $(WARN_CFLAGS)
@@ -395,17 +397,17 @@
 dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
 
diff -urN binutils-orig/gas/Makefile.am binutils/gas/Makefile.am
--- binutils-orig/gas/Makefile.am	2007-10-24 08:55:39.000000000 +0400
+++ binutils/gas/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -13,6 +13,8 @@
 YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo @LEX@ ; fi`
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 # We have to set this, because autoconf 2.59 does not substitute YFLAGS.
 # Autoconf 2.61 does, so this can be removed when we upgrade.
 YFLAGS =
@@ -1007,19 +1009,19 @@
 	sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \
 	  < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \
 	  < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^.MKDEP.*WARNING BELOW./,/^.MKDEP.*WARNING ABOVE./d' \
 	  < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 # HEED THE MKDEP WARNINGS.
 # ANYTHING CHANGED OR ADDED BETWEEN THE WARNING LINES MAY GO AWAY.
diff -urN binutils-orig/gprof/Makefile.am binutils/gprof/Makefile.am
--- binutils-orig/gprof/Makefile.am	2007-10-24 08:56:12.000000000 +0400
+++ binutils/gprof/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -17,6 +17,8 @@
 
 MKDEP = gcc -MM
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 INCLUDES = -DDEBUG -I../bfd -I$(srcdir)/../include \
 	-I$(srcdir)/../bfd @INCINTL@ -I. \
 	-DLOCALEDIR="\"$(datadir)/locale\""
@@ -166,17 +168,17 @@
 dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(SHELL) $(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
 
diff -urN binutils-orig/ld/Makefile.am binutils/ld/Makefile.am
--- binutils-orig/ld/Makefile.am	2007-10-24 08:56:47.000000000 +0400
+++ binutils/ld/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -7,6 +7,8 @@
 
 tooldir = $(exec_prefix)/$(target_alias)
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
 YFLAGS = -d
 LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
@@ -1940,17 +1942,17 @@
 dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
 
diff -urN binutils-orig/libiberty/configure.ac binutils/libiberty/configure.ac
--- binutils-orig/libiberty/configure.ac	2007-07-17 22:05:02.000000000 +0400
+++ binutils/libiberty/configure.ac	2007-12-22 23:54:16.000000000 +0300
@@ -237,7 +237,7 @@
 fi
 
 frag=xhost-mkfrag
-${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag
+${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change "${srcdir}" temp-frag xhost-mkfrag
 
 host_makefile_frag=${frag}
 AC_SUBST_FILE(host_makefile_frag)
diff -urN binutils-orig/move-if-change binutils/move-if-change
--- binutils-orig/move-if-change	2005-09-07 04:42:19.000000000 +0400
+++ binutils/move-if-change	2007-12-22 23:54:16.000000000 +0300
@@ -2,21 +2,31 @@
 # Like mv $1 $2, but if the files are the same, just delete $1.
 # Status is zero if successful, nonzero otherwise.
 
-usage="$0: usage: $0 SOURCE DEST"
+usage="$0: usage: $0 SRCDIR SOURCE DEST"
 
 case $# in
-2) ;;
+3) ;;
 *) echo "$usage" >&2; exit 1;;
 esac
 
-for arg in "$1" "$2"; do
+for arg in "$1" "$2" "$3"; do
   case $arg in
    -*) echo "$usage" >&2; exit 1;;
   esac
 done
 
-if test -r "$2" && cmp -s "$1" "$2"; then
-  rm -f "$1"
+SRCDIR="$1"
+SRC="$2"
+DST="$3"
+
+REF="${SRCDIR}/${DST}"
+
+if test -r "$REF" && cmp -s "$SRC" "$REF"; then
+  rm -f "$SRC"
+  if [ ! -r "$DST" ]; then
+    ln -s "$REF" "$DST"
+  fi
 else
-  mv -f "$1" "$2"
+  mv -f "$SRC" "$DST"
 fi
+
diff -urN binutils-orig/opcodes/cgen.sh binutils/opcodes/cgen.sh
--- binutils-orig/opcodes/cgen.sh	2007-07-05 13:49:00.000000000 +0400
+++ binutils/opcodes/cgen.sh	2007-12-22 23:54:16.000000000 +0300
@@ -111,41 +111,41 @@
 
 	# Customise generated files for the particular architecture.
 	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-desc.h1 > tmp-desc.h
-	${rootdir}/move-if-change tmp-desc.h ${srcdir}/${prefix}-desc.h
+	${rootdir}/move-if-change "${srcdir}" tmp-desc.h ${srcdir}/${prefix}-desc.h
 
 	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" < tmp-desc.c1 > tmp-desc.c
-	${rootdir}/move-if-change tmp-desc.c ${srcdir}/${prefix}-desc.c
+	${rootdir}/move-if-change "${srcdir}" tmp-desc.c ${srcdir}/${prefix}-desc.c
 
 	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-opc.h1 > tmp-opc.h
-	${rootdir}/move-if-change tmp-opc.h ${srcdir}/${prefix}-opc.h
+	${rootdir}/move-if-change "${srcdir}" tmp-opc.h ${srcdir}/${prefix}-opc.h
 
 	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" < tmp-opc.c1 > tmp-opc.c
-	${rootdir}/move-if-change tmp-opc.c ${srcdir}/${prefix}-opc.c
+	${rootdir}/move-if-change "${srcdir}" tmp-opc.c ${srcdir}/${prefix}-opc.c
 
 	case $extrafiles in
 	*opinst*)
 	  sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" < tmp-opinst.c1 >tmp-opinst.c
-	  ${rootdir}/move-if-change tmp-opinst.c ${srcdir}/${prefix}-opinst.c
+	  ${rootdir}/move-if-change "${srcdir}" tmp-opinst.c ${srcdir}/${prefix}-opinst.c
 	  ;;
 	esac
 
 	cat ${srcdir}/cgen-ibld.in tmp-ibld.in1 | \
 	  sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" > tmp-ibld.c
-	${rootdir}/move-if-change tmp-ibld.c ${srcdir}/${prefix}-ibld.c
+	${rootdir}/move-if-change "${srcdir}" tmp-ibld.c ${srcdir}/${prefix}-ibld.c
 
 	sed -e "/ -- assembler routines/ r tmp-asm.in1" ${srcdir}/cgen-asm.in \
 	  | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" > tmp-asm.c
-	${rootdir}/move-if-change tmp-asm.c ${srcdir}/${prefix}-asm.c
+	${rootdir}/move-if-change "${srcdir}" tmp-asm.c ${srcdir}/${prefix}-asm.c
 
 	sed -e "/ -- disassembler routines/ r tmp-dis.in1" ${srcdir}/cgen-dis.in \
 	  | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
 		-e "s/@prefix@/${prefix}/" > tmp-dis.c
-	${rootdir}/move-if-change tmp-dis.c ${srcdir}/${prefix}-dis.c
+	${rootdir}/move-if-change "${srcdir}" tmp-dis.c ${srcdir}/${prefix}-dis.c
 
 	# Remove temporary files.
 	rm -f tmp-desc.h1 tmp-desc.c1
diff -urN binutils-orig/opcodes/Makefile.am binutils/opcodes/Makefile.am
--- binutils-orig/opcodes/Makefile.am	2007-12-21 20:04:04.000000000 +0300
+++ binutils/opcodes/Makefile.am	2007-12-22 23:54:16.000000000 +0300
@@ -9,6 +9,8 @@
 BFDDIR = $(srcdir)/../bfd
 MKDEP = gcc -MM
 
+MOVE_IF_CHANGE = $(srcdir)/../move-if-change "$(srcdir)"
+
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
 AM_CFLAGS = $(WARN_CFLAGS)
@@ -385,7 +387,7 @@
 	if [ -f $$libtooldir/libopcodes.a ]; then \
 	  cp $$libtooldir/libopcodes.a libopcodes.tmp; \
 	  $(RANLIB) libopcodes.tmp; \
-	  $(SHELL) $(srcdir)/../move-if-change libopcodes.tmp libopcodes.a; \
+	  $(SHELL) $(MOVE_IF_CHANGE) libopcodes.tmp libopcodes.a; \
 	else true; fi
 	touch stamp-lib
 
@@ -632,17 +634,17 @@
 dep: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
 	cat DEP >> tmp-Makefile
-	$(srcdir)/../move-if-change tmp-Makefile Makefile
+	$(MOVE_IF_CHANGE) tmp-Makefile Makefile
 
 dep-in: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
 	cat DEP >> tmp-Makefile.in
-	$(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
+	$(MOVE_IF_CHANGE) tmp-Makefile.in $(srcdir)/Makefile.in
 
 dep-am: DEP
 	sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
 	cat DEP >> tmp-Makefile.am
-	$(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
+	$(MOVE_IF_CHANGE) tmp-Makefile.am $(srcdir)/Makefile.am
 
 .PHONY: dep dep-in dep-am
 

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