home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff374.lzh / Mat / MAKEDEP < prev    next >
Text File  |  1990-10-08  |  1KB  |  31 lines

  1. .K PAT,>/K
  2. .BRA {
  3. .KET }
  4. ;;    MAKEDEP   --  Create dependency lists for C makefiles.
  5.  
  6. ;;  Source files are assumed to have the ".c" extension, and #includes
  7. ;; to end in either ".h" or ".c".  The script is NOT smart enough to do
  8. ;; nested includes!
  9.  
  10. mat #?.c key {PAT}
  11. if WARN
  12.     Mat >T:depen "'#include # (?||<)^#?.(h|c)^#?" "^1 " tag ^B@@@^F@^|^B@@@^F@ nolines {PAT}.c
  13. else
  14.     Mat >T:depen "'#include # (?||<)^#?.(h|c)^#?" "^1 " tag ^B@@@^F@^|^B@@@^F@  nolines {PAT}
  15. endif
  16. if "{>}" eq ""
  17.     Mat @@@^#?^.c@^#? "^B^1.o : ^1.c ^3" T:depen label ^B###
  18. else
  19.     Mat >{>} @@@^#?^.c@^#? "^B^1.o : ^1.c ^3" T:depen label ^B###
  20. endif
  21. del T:depen
  22.  
  23. ;; Creating a dependency list in "make" format requires two passes of Mat.
  24. ;; The first pass creates a temporary file ("T:depen") that contains one
  25. ;; line for each line scanned.  After a (probably unnecessary) "@@@" prefix
  26. ;; comes the filename, another "@" and all the included filenames found
  27. ;; (assumed to end in either ".h" or ".c").
  28. ;; The second pass strips the ".c" extension off the filename (it MUST BE
  29. ;; a ".c" file!) and rearranges things into a standard dependency line.
  30.  
  31.