home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / DMAKE35X.ZIP / PRINT.MK < prev    next >
Text File  |  1990-08-15  |  2KB  |  65 lines

  1. # Make a listing of either everything so far, or just the stuff that has
  2. # been updated since the last time a printout was made.
  3. # The targets are:
  4. #    print        - to print only updated files.
  5. #    printall    - to print entire tree.
  6. #
  7. # MACROS are:
  8. #    PRINTER        - printer name on which to put output, output
  9. #              goes to a file if no printer name is given.
  10. #    PRINTFLAGS    - flags to pass to the printer.
  11. #    PRINTEXCLUDE    - substrings in file names not to include in output.
  12.  
  13. GROUPFLAGS  :=
  14. SEDLIST = _sed_e_flag_'/{ $(PRINTEXCLUDE) }/d'
  15. FILIST  = $(TMPDIR)/pr$$$$
  16. OFILE   = $(TMPDIR)/pr$$$$.out
  17.  
  18. .IF $(PRINTEXCLUDE)
  19.    SEDARGS = $(SEDLIST:s/_sed_e_flag_/-e /)
  20. .END
  21.  
  22. printall : print_remove_ctl print;
  23. print_remove_ctl:;@-$(RM) control/print
  24.  
  25. print:
  26. @[
  27.    if [ -f control/print ]; then
  28.       find . -type f -newer control/print -print |\
  29.       sort -t. +2 +1 -2 |\
  30.       sed $(SEDARGS) >$(FILIST);
  31.       if [ -s $(FILIST) ]; then
  32.      find . -type f -print | sort -t. +2 +1 -2 |\
  33.      sed $(SEDARGS) >$(FILIST).full;
  34.      cpr -c -T control/title -N -C `cat $(FILIST).full` >$(OFILE);
  35.      cpr -c -N `cat $(FILIST)` >> $(OFILE);
  36.      $(RM) $(FILIST).full;
  37.       else
  38.      echo "No modified files since last printing";
  39.       fi
  40.    else
  41.       find . -type f -print | sort -t. +2 +1 -2 |\
  42.       sed $(SEDARGS) >$(FILIST);
  43.       if [ -s $(FILIST) ]; then
  44.      cpr -c -T control/title -N `cat $(FILIST)` >$(OFILE);
  45.       fi
  46.    fi
  47.  
  48.    if [ -s $(OFILE) ]; then
  49. .IF $(PRINTER)
  50.       $(PRINT) $(PRINTFLAGS) $(OFILE);
  51.       echo "Listing printed on $(PRINTER)";
  52. .IF $(PRINTKEEPTMP) == $(NULL)
  53.       $(RM) $(OFILE);
  54. .END
  55. .ELSE
  56.       echo "Listing can be temporarily found in $(OFILE)";
  57. .END
  58.    fi
  59. .IF $(PRINTKEEPTMP) == $(NULL)
  60.    $(RM) $(FILIST)
  61. .END
  62.    touch control/print;
  63.    exit 0
  64. ]
  65.