home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume7 / regex / makefile < prev    next >
Encoding:
Makefile  |  1988-10-17  |  2.4 KB  |  95 lines

  1. #
  2. # regex routines (PUBLIC DOMAIN)
  3. #
  4. # by:    Ozan S. Yigit (oz)
  5. #    Dept. of Computer Science
  6. #    York University
  7. #
  8. # Applicable to BSD:
  9. #
  10. # If you have the generic(?) regex routines
  11. # than you can compare the timings of these
  12. # routines to the generic ones by:
  13. #
  14. #    make times
  15. #
  16. # which will create two rudimentary greps
  17. # lgrep and ogrep. lgrep will use the generic
  18. # regex routines, and ogrep will use oz version
  19. # of regex. Several patterns will be searched
  20. # in /usr/dict/words, and the output of the greps
  21. # will be compared. [for reasons of sanity]
  22. #
  23. # Surely, you will note, the time tests are somewhat
  24. # biased, since /usr/dict/words contain *short* lines,
  25. # thereby the real-life case of searching a complex
  26. # expression within a long line is not covered. You
  27. # will find, however, that the PD regex routines will
  28. # search *as fast* as the generic ones in most
  29. # cases, and about 10% slower in some cases, when
  30. # tested with files containing *long* lines. 
  31. CFLAGS = -O
  32. #
  33. # test patterns
  34. #
  35. PAT1 = '[d-f]zz*.*m'
  36. PAT2 = 'fo[ornt]*.*b[a-d]*'
  37. PAT3 = '.th.'
  38. PAT4 = '\(ab\)[a-d]*\1'
  39. PAT5 = 'burp'
  40.  
  41. FILE = /usr/dict/words
  42. OUTD = /tmp/
  43.  
  44. RSRC = regex.o re_fail.o
  45.  
  46. regex:  $(RSRC)
  47. #
  48. #    insert code to put these into a library
  49. #
  50. rlint:
  51.     lint -phc regex.c
  52. debug:
  53.     cc -O -DDEBUG -o ogrep grep.c regex.c re_fail.c
  54.  
  55. lgrep:  grep.o
  56.     cc -o lgrep grep.o
  57.  
  58. ogrep:  grep.o $(RSRC)
  59.     cc -o ogrep grep.o $(RSRC)
  60.  
  61. times:  lgrep ogrep
  62.     @echo generic regex vs oz regex
  63. #    @echo pattern: $(PAT1)
  64.     time ogrep $(PAT1) $(FILE) >$(OUTD)ogrep.out
  65.     time lgrep $(PAT1) $(FILE) >$(OUTD)lgrep.out
  66.     @echo output differences:
  67.     -diff $(OUTD)ogrep.out $(OUTD)lgrep.out
  68.     @echo "---"
  69. #    @echo pattern: $(PAT2)
  70.     time ogrep $(PAT2) $(FILE) >$(OUTD)ogrep.out
  71.     time lgrep $(PAT2) $(FILE) >$(OUTD)lgrep.out
  72.     @echo output differences:
  73.     -diff $(OUTD)ogrep.out $(OUTD)lgrep.out
  74.     @echo "---"
  75. #    echo pattern: $(PAT3)
  76.     time ogrep $(PAT3) $(FILE) >$(OUTD)ogrep.out
  77.     time lgrep $(PAT3) $(FILE) >$(OUTD)lgrep.out
  78.     @echo output differences:
  79.     -diff $(OUTD)ogrep.out $(OUTD)lgrep.out
  80.     @echo "---"
  81. #    echo pattern: $(PAT4)
  82.     time ogrep $(PAT4) $(FILE) >$(OUTD)ogrep.out
  83.     time lgrep $(PAT4) $(FILE) >$(OUTD)lgrep.out
  84.     @echo output differences:
  85.     -diff $(OUTD)ogrep.out $(OUTD)lgrep.out
  86.     @echo "---"
  87. #    echo pattern: $(PAT5)
  88.     time ogrep $(PAT5) $(FILE) >$(OUTD)ogrep.out
  89.     time lgrep $(PAT5) $(FILE) >$(OUTD)lgrep.out
  90.     @echo output differences:
  91.     -diff $(OUTD)ogrep.out $(OUTD)lgrep.out
  92.     @echo "---"
  93.     @rm $(OUTD)ogrep.out $(OUTD)lgrep.out
  94.