home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / zsh / Source / src / config / bz.makevpath < prev    next >
Encoding:
Text File  |  1994-04-07  |  996 b   |  49 lines

  1. # --- bz.makevpath
  2.  
  3. # --- cc?
  4.  
  5. test -z "$makecc_done" && . bz.makecc
  6.  
  7. # --- does $MAKE grok VPATH?
  8.  
  9. test -z "$MAKE" && MAKE=make    # failsafe
  10. echo "    checking whether $MAKE understands VPATH..." >&2
  11.  
  12. make_groks_VPATH=
  13.  
  14. oldwd=`pwd`
  15. mkdir $VPATHTMP $VPATHTMPa $VPATHTMPb
  16. if test -d "$VPATHTMP" -a -d "$VPATHTMPa" -a -d "$VPATHTMPb"
  17. then
  18.   cd $VPATHTMPa && echo 'static int foo = 42;' > foo.c
  19.   if test -f $VPATHTMPa/foo.c
  20.   then
  21.     cd $VPATHTMPb && {
  22.       cat > Makefile <<'foo'
  23. foo.o:    foo.c
  24.     @$(CC) -c $<
  25. foo
  26.       if test -f $VPATHTMPb/Makefile
  27.       then
  28.         $MAKE VPATH=$VPATHTMPa 2>/dev/null
  29.         test -s $VPATHTMPb/foo.o && make_groks_VPATH=yep
  30.         rm -f $VPATHTMPb/foo.o $VPATHTMPb/Makefile
  31.       fi
  32.     }
  33.     rm -f $VPATHTMPa/foo.c
  34.   fi
  35.   (cd $VPATHTMP && \
  36.    rmdir $VPATHTMPa && \
  37.    rmdir $VPATHTMPb && \
  38.    cd .. && rmdir $VPATHTMP)
  39. fi
  40. cd $oldwd
  41.  
  42. echo
  43. echo "    ($MAKE does "`test -z "$make_groks_VPATH" && echo "not "`"understand VPATH...)"
  44. echo
  45.  
  46. make_groks_VPATH_done=yep
  47.  
  48. ###
  49.