* post.in (.depend): Refuse to do anything if srcdir is ".". Find a shortcut
authorKen Raeburn <raeburn@mit.edu>
Sat, 1 Sep 2001 04:06:44 +0000 (04:06 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 1 Sep 2001 04:06:44 +0000 (04:06 +0000)
name for SRCTOP to eliminate "foo/.." subsequences, in case the compiler does
the same.  Run depfix.sed after the directory-specific substitutions, not
before.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13718 dc483132-0cff-0310-8789-dd5450dbe970

src/config/ChangeLog
src/config/post.in

index 1471def05ea109834ab497e3c9f0c657ce8a666d..beb6138fcfa797fc3fbaecb6319d04bd273e04fd 100644 (file)
@@ -1,3 +1,10 @@
+2001-09-01  Ken Raeburn  <raeburn@mit.edu>
+
+       * post.in (.depend): Refuse to do anything if srcdir is ".".  Find
+       a shortcut name for SRCTOP to eliminate "foo/.." subsequences, in
+       case the compiler does the same.  Run depfix.sed after the
+       directory-specific substitutions, not before.
+
 2001-08-07  Ezra Peisach  <epeisach@mit.edu>
 
        * post.in (all-recurse clean-recurse distclean-recurse
index e0ea7213dad828956564d85534e1445ac2b4c403..9e27de820659f23dcf02cac7792841f7108de61f 100644 (file)
@@ -3,13 +3,25 @@
 check-windows::
 
 .depend: $(SRCS) $(SRCTOP)/util/depfix.sed
+       if test "$(srcdir)" = "." ; then \
+               echo 1>&2 error: cannot build dependencies with srcdir=. ; \
+               echo 1>&2 "(can't distinguish generated files from source files)" ; \
+               exit 1 ; \
+       fi
        if test -n "$(SRCS)" ; then \
+               r="$(SRCTOP)" ; oldr=hello ; \
+               while test "$$r" != "$$oldr" ; do \
+                       oldr="$$r" ; \
+                       r=`echo "$$oldr" | sed -e 's;/[a-z][a-z0-9_\-]*/../;/;g' -e 's;/[a-z][a-z0-9_\-]*/..$$;;g'` ; \
+               done ; \
                $(CC) -M $(ALL_CFLAGS) $(SRCS) | \
-                       sed -f $(SRCTOP)/util/depfix.sed | \
-                       sed -e 's; $(SRCTOP)/; $$(SRCTOP)/;g' | \
-                       sed -e 's; $(srcdir)/; $$(srcdir)/;g' | \
-                       sed -e 's; $(BUILDTOP)/; $$(BUILDTOP)/;g' | \
-                       sed -e 's; \./; ;g' > .depend; \
+                       sed -e 's; \./; ;g' \
+                               -e "s; $$r/"'; $$(SRCTOP)/;g' \
+                               -e 's; $(SRCTOP)/; $$(SRCTOP)/;g' \
+                               -e 's; $(srcdir)/; $$(srcdir)/;g' \
+                               -e 's; $(BUILDTOP)/; $$(BUILDTOP)/;g' | \
+                       sed -f $(SRCTOP)/util/depfix.sed \
+                       > .depend; \
        else :; fi
 
 depend:: .depend