(defun fixdep ()
  "Reformat Makefile dependencies lists."
  (interactive "*")
  (setq save-fill fill-column)		; save current fill col
  (search-backward ":")			; find beginning of list
  (beginning-of-line)
  (set-mark (point))			; save beginning of list
  (search-forward "\n\n")		; find end of list
  (forward-char -1)
  (narrow-to-region (mark) (point))	; save that and narrow
  (goto-char (point-min))		; go back to top
  (if (search-forward "\t" nil t)	; possible alternate end-of-list
      (narrow-to-region (point-min) (- (point) 1)))
  (goto-char (point-min))		; back to the top
  (replace-string "\\" "")		; get rid of backslashes
  (goto-char (point-min))		; back to the top
  (replace-regexp "^ *" "")		; delete leading spaces
  (goto-char (point-min))		; back to the top (again)
  (setq fill-column 76)			; first line is special
  (fill-paragraph nil)			; fill it
  (goto-char (point-min))		; back to the top
  (setq fill-column 74)
  (next-line 1)
  (insert "\n")
  (fill-paragraph nil)			; fill it
  (goto-char (point-min))
  (next-line 1)
  (delete-char 1)
  (goto-char (point-min))
  (replace-string "\n" " \\\n  ")
  (delete-char -5)
  (insert "\n")
  (setq fill-column save-fill)
  (widen)
)
