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]

makefile dependency revamp


The aim of this patch is to consistently generate dependencies despite
the fact that various versions of gcc differ in -MM output.  Older
versions of gcc (eg. gcc-3.3) suppress duplicate dependencies, perhaps
by accident, due to emitting a dependency after checking whether a
header has a multiple inclusion macro guard.  Newer versions of gcc
don't seem to do this, and I also found that a version of gcc-3.4.5 I
happened to have lying around didn't take note of the macro guard in
hashtab.h for some reason.

So, we need to sort and uniq the object files dependencies, but be
careful to keep the first dependency (the main .c file) in place for
makefile rules using $<.  I found a few other tweaks were needed, most
notably the gas multi-obj dependencies now are not edited by dep.sed
and automake complained about a trailing backslash continuation
followed by a blank line.

bfd/
	* dep-in.sed: Don't modify .o to .lo here.  Output one filename
	per line with all lines having continuation backslash.  Prefix
	first line with "A", following lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, modify .o to .lo here.  Use
	dep.sed here on dependencies, sort and uniq.
	* Makefile.in: Regenerate.
opcodes/
	* dep-in.sed: Don't modify .o to .lo here.  Output one filename
	per line with all lines having continuation backslash.  Prefix
	first line with "A", following lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, modify .o to .lo here.  Use
	dep.sed here on dependencies, sort and uniq.
	* Makefile.in: Regenerate.
binutils/
	* dep-in.sed: Output one filename per line with all lines having
	continuation backslash.  Prefix first line with "A", following
	lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, use dep.sed here on dependencies,
	sort and uniq.
	* Makefile.in: Regenerate.
gas/
	* dep-in.sed: Output one filename per line with all lines having
	continuation backslash.  Prefix first line with "A", following
	lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, use dep.sed here on dependencies,
	sort and uniq.
	(DEPTC, DEPOBJ, DEP2): Use dep.sed on dependencies, sort and uniq.
	Emit multi dependencies on one line.
	* Makefile.in: Regenerate.
gprof/
	* dep-in.sed: Output one filename per line with all lines having
	continuation backslash.  Prefix first line with "A", following
	lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, use dep.sed here on dependencies,
	sort and uniq.
	* Makefile.in: Regenerate.
ld/
	* dep-in.sed: Output one filename per line with all lines having
	continuation backslash.  Prefix first line with "A", following
	lines with "B".
	* Makefile.am (DEP): Don't use dep.sed here.
	(DEP1): Run $MKDEP on single files, use dep.sed here on dependencies,
	sort and uniq.
	* Makefile.in: Regenerate.

I've trimmed the regenerated Makefile.am dependency changes from
the following diffs since I hit the 400k post limit..

Index: bfd/dep-in.sed
===================================================================
RCS file: /cvs/src/src/bfd/dep-in.sed,v
retrieving revision 1.7
diff -u -p -r1.7 dep-in.sed
--- bfd/dep-in.sed	29 Oct 2005 23:47:42 -0000	1.7
+++ bfd/dep-in.sed	25 May 2009 13:40:58 -0000
@@ -3,7 +3,6 @@
 s/\\\n */ /g
 t loop
 
-s!\.o:!.lo:!
 s! \./! !g
 s! @BFD_H@!!g
 s!@SRCDIR@/../include!$(INCDIR)!g
@@ -11,7 +10,7 @@ s!@TOPDIR@/include!$(INCDIR)!g
 s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g
 s!@TOPDIR@/opcodes!$(srcdir)/../opcodes!g
 s!@SRCDIR@/!!g
-s! hosts/[^ ]*\.h! !g
+s! hosts/[^ ]*\.h!!g
 s! sysdep.h!!g
 s! \.\./bfd/sysdep.h!!g
 s! libbfd.h!!g
@@ -21,12 +20,8 @@ s! \$(INCDIR)/ansidecl\.h!!g
 s! \$(INCDIR)/symcat\.h!!g
 s! \.\./intl/libintl\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-s/ *:/:/g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.227
diff -u -p -r1.227 Makefile.am
--- bfd/Makefile.am	22 May 2009 09:33:14 -0000	1.227
+++ bfd/Makefile.am	25 May 2009 13:40:59 -0000
@@ -909,18 +909,23 @@ uninstall_libbfd:
 DEP: dep.sed $(CFILES) $(HFILES) bfd.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > DEPA
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
-	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEP1
+	if grep ' /' DEP1 > /dev/null 2> /dev/null; then \
 	  echo 'make DEP failed!'; exit 1; \
 	else \
-	  mv -f DEPA $@; \
+	  mv -f DEP1 $@; \
 	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
 	echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
-	$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+	for f in $?; do \
+	  $(MKDEP) $(INCLUDES) $(CFLAGS) $$f > DEPA; \
+	  sed -n -e '1s/\.o: .*/.lo: \\/p' -e q < DEPA >> DEP2; \
+	  sed -e '1s/.*: //' -f dep.sed < DEPA | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	rm -f DEPA
 	mv -f DEP2 $@
 
 dep.sed: dep-in.sed config.status
Index: opcodes/dep-in.sed
===================================================================
RCS file: /cvs/src/src/opcodes/dep-in.sed,v
retrieving revision 1.4
diff -u -p -r1.4 dep-in.sed
--- opcodes/dep-in.sed	30 Oct 2005 17:40:28 -0000	1.4
+++ opcodes/dep-in.sed	25 May 2009 13:41:02 -0000
@@ -3,7 +3,6 @@
 s/\\\n */ /g
 t loop
 
-s!\.o:!.lo:!
 s! \./! !g
 s! @BFD_H@! $(BFD_H)!g
 s!@INCDIR@!$(INCDIR)!g
@@ -13,12 +12,8 @@ s!@TOPDIR@/bfd!$(BFDDIR)!g
 s!@SRCDIR@/!!g
 s! \.\./intl/libintl\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-s/ *:/:/g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.137
diff -u -p -r1.137 Makefile.am
--- opcodes/Makefile.am	22 May 2009 09:33:16 -0000	1.137
+++ opcodes/Makefile.am	25 May 2009 13:41:02 -0000
@@ -641,18 +641,23 @@ sh-dis.lo: sh-dis.c
 DEP: dep.sed $(CFILES) $(HFILES) config.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > DEPA
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
-	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEP1
+	if grep ' /' DEP1 > /dev/null 2> /dev/null; then \
 	  echo 'make DEP failed!'; exit 1; \
 	else \
-	  mv -f DEPA $@; \
+	  mv -f DEP1 $@; \
 	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
 	echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
-	$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+	for f in $?; do \
+	  $(MKDEP) $(INCLUDES) $(CFLAGS) $$f > DEPA; \
+	  sed -n -e '1s/\.o: .*/.lo: \\/p' -e q < DEPA >> DEP2; \
+	  sed -e '1s/.*: //' -f dep.sed < DEPA | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	rm -f DEPA
 	mv -f DEP2 $@
 
 dep.sed: dep-in.sed config.status
Index: binutils/dep-in.sed
===================================================================
RCS file: /cvs/src/src/binutils/dep-in.sed,v
retrieving revision 1.4
diff -u -p -r1.4 dep-in.sed
--- binutils/dep-in.sed	30 Oct 2005 17:40:28 -0000	1.4
+++ binutils/dep-in.sed	25 May 2009 13:40:59 -0000
@@ -1,6 +1,7 @@
 :loop
 /\\$/N
-/\\$/b loop
+s/\\\n */ /g
+t loop
 
 s! \./! !g
 s!@INCDIR@!$(INCDIR)!g
@@ -11,11 +12,8 @@ s!@SRCDIR@/!!g
 s!@OBJDIR@/!!g
 s! \.\./intl/libintl\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: binutils/Makefile.am
===================================================================
RCS file: /cvs/src/src/binutils/Makefile.am,v
retrieving revision 1.107
diff -u -p -r1.107 Makefile.am
--- binutils/Makefile.am	22 May 2009 09:33:15 -0000	1.107
+++ binutils/Makefile.am	25 May 2009 13:40:59 -0000
@@ -398,18 +398,23 @@ DISTCLEANFILES = sysroff.c sysroff.h sit
 DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > DEPA
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
-	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEP1
+	if grep ' /' DEP1 > /dev/null 2> /dev/null; then \
 	  echo 'make DEP failed!'; exit 1; \
 	else \
-	  mv -f DEPA $@; \
+	  mv -f DEP1 $@; \
 	fi
 
 DEP1: $(CFILES) $(GENERATED_CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
 	echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
-	$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+	for f in $?; do \
+	  $(MKDEP) $(INCLUDES) $(CFLAGS) $$f > DEPA; \
+	  sed -n -e '1s/: .*/: \\/p' -e q < DEPA >> DEP2; \
+	  sed -e '1s/.*: //' -f dep.sed < DEPA | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	rm -f DEPA
 	mv -f DEP2 $@
 
 dep.sed: dep-in.sed config.status
Index: gas/dep-in.sed
===================================================================
RCS file: /cvs/src/src/gas/dep-in.sed,v
retrieving revision 1.11
diff -u -p -r1.11 dep-in.sed
--- gas/dep-in.sed	17 Feb 2007 13:33:56 -0000	1.11
+++ gas/dep-in.sed	25 May 2009 13:40:59 -0000
@@ -1,6 +1,7 @@
 :loop
 /\\$/N
-/\\$/b loop
+s/\\\n */ /g
+t loop
 
 s! \.\./! !g
 s! \./! !g
@@ -43,11 +44,8 @@ s! symbols\.h!!g
 s! tc\.h!!g
 s! write\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.169
diff -u -p -r1.169 Makefile.am
--- gas/Makefile.am	22 May 2009 09:33:15 -0000	1.169
+++ gas/Makefile.am	25 May 2009 13:41:00 -0000
@@ -893,12 +893,12 @@ DEP: dep.sed $(DEP_FILE_DEPS) DEPTC DEPO
 	$(MAKE) MKDEP="$(MKDEP)" srcdir="$${srcdir}" VPATH="$${srcdir}" DEP1
 	rm -rf DEPDIR
 	echo 'AMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW.' > DEPA
-	sed -f dep.sed < DEPTC >> DEPA
-	sed -f dep.sed < DEPOBJ >> DEPA
-	sed -f dep.sed < DEP2 >> DEPA
+	cat < DEPTC >> DEPA
+	cat < DEPOBJ >> DEPA
+	cat < DEP2 >> DEPA
 	echo 'BMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING ABOVE.' >> DEPA
 	echo '#MKDEP    DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW.' >> DEPA
-	sed -f dep.sed < DEP1 >> DEPA
+	cat < DEP1 >> DEPA
 	echo '$$(OBJS): $$(DEP_@target''_cpu_type@_@obj''_format@)' >> DEPA
 	echo '$$(TARG_CPU_O): $$(DEPTC_@target''_cpu_type@_@obj''_format@)' >> DEPA
 	echo '$$(OBJ_FORMAT_O): $$(DEPOBJ_@target''_cpu_type@_@obj''_format@)' >> DEPA
@@ -918,8 +918,14 @@ DEP1: $(CFILES) $(MULTI_CFILES)
 	echo '' > targ-env.h; \
 	echo '' > itbl-cpu.h; \
 	echo '' > itbl-parse.h; \
-	$(MKDEP) $(DEP_FLAGS) $? > DEP
-	mv -f DEPDIR/DEP $@
+	rm -f DEP2; \
+	for f in $?; do \
+	  $(MKDEP) $(DEP_FLAGS) $$f > DEP; \
+	  sed -n -e '1s/: .*/: \\/p' -e q < DEP >> DEP2; \
+	  sed -e '1s/.*://' -f ../dep.sed < DEP | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	mv -f DEPDIR/DEP2 $@
 
 # Work out the special dependencies for the tc-*.c files.
 DEPTC: $(TARGET_CPU_CFILES)
@@ -941,11 +947,14 @@ DEPTC: $(TARGET_CPU_CFILES)
 	      else \
 	        echo '' > cgen-desc.h; \
 	      fi ;\
-	      rm -f dummy.c; \
-	      cp $${srcdir}/config/tc-$${c}.c dummy.c; \
-	      $(MKDEP) $(DEP_FLAGS) dummy.c | \
-	        sed -e "s/dummy.o: dummy.c/DEPTC_$${c}_$${o} =/" >> ../DEPTCA; \
-	      rm -f dummy.c; \
+	      rm -f dumtc.c; \
+	      cp $${srcdir}/config/tc-$${c}.c dumtc.c; \
+	      echo "DEPTC_$${c}_$${o} = \\" >> ../DEPTCA; \
+	      $(MKDEP) $(DEP_FLAGS) dumtc.c | \
+		sed -e '1s/dumtc.o: //' -f ../dep.sed | \
+		LC_ALL=C sort | uniq | \
+		sed -e '/^A/d' -e 's/^B/  /' -e '$$s/ \\$$//' >> ../DEPTCA; \
+	      rm -f dumtc.c; \
 	    else true; fi; \
 	  done; \
 	done
@@ -953,14 +962,14 @@ DEPTC: $(TARGET_CPU_CFILES)
 	echo '  $$(INCDIR)/obstack.h $$(BFDDIR)/libhppa.h \' >> DEPTCA
 	echo '  $$(INCDIR)/opcode/hppa.h $$(BFDDIR)/som.h' >> DEPTCA
 	for c in $(MULTI_CPU_TYPES); do \
-	  echo "DEPTC_$${c}"'_multi = \' >> DEPTCA; \
+	  x="DEPTC_$${c}_multi ="; \
 	  for o in $(OBJ_FORMATS); do \
 	    $(MULTI_CPU_OBJ_VALID) \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(DEPTC_'"$${c}_$${o}"') \' >> DEPTCA; \
+	      x="$$x"' $$(DEPTC_'"$${c}_$${o}"')'; \
 	    else true; fi; \
 	  done; \
-	  echo '' >> DEPTCA; \
+	  echo "$$x" >> DEPTCA; \
 	done
 	mv -f DEPTCA DEPTC
 
@@ -979,11 +988,14 @@ DEPOBJ: $(OBJ_FORMAT_CFILES)
 	      echo '#include "te-generic.h"' > targ-env.h; \
 	      echo '' > itbl-cpu.h; \
 	      echo '' > itbl-parse.h; \
-	      rm -f dummy.c; \
-	      cp $${srcdir}/config/obj-$${o}.c dummy.c; \
-	      $(MKDEP) $(DEP_FLAGS) dummy.c | \
-	        sed -e "s/dummy.o: dummy.c/DEPOBJ_$${c}_$${o} =/" >> ../DEPOBJA; \
-	      rm -f dummy.c; \
+	      rm -f dumobj.c; \
+	      cp $${srcdir}/config/obj-$${o}.c dumobj.c; \
+	      echo "DEPOBJ_$${c}_$${o} = \\" >> ../DEPOBJA; \
+	      $(MKDEP) $(DEP_FLAGS) dumobj.c | \
+	        sed -e "s/dumobj.o: //" -f ../dep.sed | \
+		LC_ALL=C sort | uniq | \
+		sed -e '/^A/d' -e 's/^B/  /' -e '$$s/ \\$$//' >> ../DEPOBJA; \
+	      rm -f dumobj.c; \
 	    else true; fi; \
 	  done; \
 	done
@@ -992,14 +1004,14 @@ DEPOBJ: $(OBJ_FORMAT_CFILES)
 	echo '  $$(BFDDIR)/som.h  $$(INCDIR)/aout/stab_gnu.h \' >> DEPOBJA
 	echo '  $$(INCDIR)/aout/stab.def' >> DEPOBJA
 	for c in $(MULTI_CPU_TYPES); do \
-	  echo "DEPOBJ_$${c}"'_multi = \' >> DEPOBJA; \
+	  x="DEPOBJ_$${c}_multi ="; \
 	  for o in $(OBJ_FORMATS); do \
 	    $(MULTI_CPU_OBJ_VALID) \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(DEPOBJ_'"$${c}_$${o}"') \' >> DEPOBJA; \
+	      x="$$x"' $$(DEPOBJ_'"$${c}_$${o}"')'; \
 	    else true; fi; \
 	  done; \
-	  echo '' >> DEPOBJA; \
+	  echo "$$x" >> DEPOBJA; \
 	done
 	mv -f DEPOBJA DEPOBJ
 
@@ -1016,21 +1028,24 @@ DEP2: $(TARGET_CPU_HFILES) $(OBJ_FORMAT_
 	    if [ x$${valid} = xyes ]; then \
 	      echo '#include "tc-'"$${c}"'.h"' > targ-cpu.h; \
 	      echo '#include "obj-'"$${o}"'.h"' > dummy.c; \
+	      echo "DEP_$${c}_$${o} = \\" >> ../DEP2A; \
 	      $(MKDEP) $(DEP_FLAGS) dummy.c | \
-	        sed -e "s/dummy.o: dummy.c/DEP_$${c}_$${o} =/" >> ../DEP2A; \
+	        sed -e "s/dummy.o: //" -f ../dep.sed | \
+		LC_ALL=C sort | uniq | \
+		sed -e '/^A/d' -e 's/^B/  /' -e '$$s/ \\$$//' >> ../DEP2A; \
 	    else true; fi; \
 	  done; \
 	done
 	echo 'DEP_hppa_som = $$(BFDDIR)/som.h' >> DEP2A
 	for c in $(MULTI_CPU_TYPES); do \
-	  echo "DEP_$${c}"'_multi = \' >> DEP2A; \
+	  x="DEP_$${c}_multi ="; \
 	  for o in $(OBJ_FORMATS); do \
 	    $(MULTI_CPU_OBJ_VALID) \
 	    if [ x$${valid} = xyes ]; then \
-	      echo '$$(DEP_'"$${c}_$${o}"') \' >> DEP2A; \
+	      x="$$x"' $$(DEP_'"$${c}_$${o}"')'; \
 	    else true; fi; \
 	  done; \
-	  echo '' >> DEP2A; \
+	  echo "$$x" >> DEP2A; \
 	done
 	mv -f DEP2A DEP2
 
Index: gprof/dep-in.sed
===================================================================
RCS file: /cvs/src/src/gprof/dep-in.sed,v
retrieving revision 1.3
diff -u -p -r1.3 dep-in.sed
--- gprof/dep-in.sed	14 Aug 2003 07:04:30 -0000	1.3
+++ gprof/dep-in.sed	25 May 2009 13:41:01 -0000
@@ -1,7 +1,9 @@
 :loop
 /\\$/N
-/\\$/b loop
+s/\\\n */ /g
+t loop
 
+s! \./! !g
 s!@INCDIR@!$(INCDIR)!g
 s!@TOPDIR@/include!$(INCDIR)!g
 s!@BFDDIR@!$(BFDDIR)!g
@@ -10,11 +12,8 @@ s!@SRCDIR@/!!g
 s!@OBJDIR@/!!g
 s! \.\./intl/libintl\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: gprof/Makefile.am
===================================================================
RCS file: /cvs/src/src/gprof/Makefile.am,v
retrieving revision 1.46
diff -u -p -r1.46 Makefile.am
--- gprof/Makefile.am	22 May 2009 09:33:15 -0000	1.46
+++ gprof/Makefile.am	25 May 2009 13:41:01 -0000
@@ -181,18 +181,23 @@ install-data-local: install-info
 DEP: dep.sed $(gprof_SOURCES) $(noinst_HEADERS) gconfig.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > DEPA
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
-	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEP1
+	if grep ' /' DEP1 > /dev/null 2> /dev/null; then \
 	  echo 'make DEP failed!'; exit 1; \
 	else \
-	  mv -f DEPA $@; \
+	  mv -f DEP1 $@; \
 	fi
 
 DEP1: $(gprof_SOURCES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
 	echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
-	$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+	for f in $?; do \
+	  $(MKDEP) $(INCLUDES) $(CFLAGS) $$f > DEPA; \
+	  sed -n -e '1s/: .*/: \\/p' -e q < DEPA >> DEP2; \
+	  sed -e '1s/.*: //' -f dep.sed < DEPA | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	rm -f DEPA
 	mv -f DEP2 $@
 
 dep.sed: dep-in.sed config.status
Index: ld/dep-in.sed
===================================================================
RCS file: /cvs/src/src/ld/dep-in.sed,v
retrieving revision 1.5
diff -u -p -r1.5 dep-in.sed
--- ld/dep-in.sed	30 Oct 2005 17:40:28 -0000	1.5
+++ ld/dep-in.sed	25 May 2009 13:41:01 -0000
@@ -1,6 +1,7 @@
 :loop
 /\\$/N
-/\\$/b loop
+s/\\\n */ /g
+t loop
 
 s! \./! !g
 s!@INCDIR@!$(INCDIR)!g
@@ -11,11 +12,8 @@ s!@SRCDIR@/!!g
 s! \.\./bfd/hosts/[^ ]*\.h! !g
 s! \.\./intl/libintl\.h!!g
 
-s/\\\n */ /g
-
 s/ *$//
 s/  */ /g
-/:$/d
-
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
+s/^ */A/
+s/ / \\\nB/g
+$s/$/ \\/
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.264
diff -u -p -r1.264 Makefile.am
--- ld/Makefile.am	22 May 2009 09:33:15 -0000	1.264
+++ ld/Makefile.am	25 May 2009 13:41:02 -0000
@@ -2009,18 +2009,23 @@ endif
 DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > DEPA
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
-	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEP1
+	if grep ' /' DEP1 > /dev/null 2> /dev/null; then \
 	  echo 'make DEP failed!'; exit 1; \
 	else \
-	  mv -f DEPA $@; \
+	  mv -f DEP1 $@; \
 	fi
 
 DEP1: $(CFILES) $(GENERATED_CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
 	echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
-	$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
+	for f in $?; do \
+	  $(MKDEP) $(INCLUDES) $(CFLAGS) $$f > DEPA; \
+	  sed -n -e '1s/: .*/: \\/p' -e q < DEPA >> DEP2; \
+	  sed -e '1s/.*: //' -f dep.sed < DEPA | LC_ALL=C sort | uniq | \
+	    sed -e 's/^[AB]/  /' -e '$$s/ \\$$//' >> DEP2; \
+	done
+	rm -f DEPA
 	mv -f DEP2 $@
 
 dep.sed: dep-in.sed config.status

-- 
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]