home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / expire / makefile < prev    next >
Makefile  |  1995-04-27  |  8KB  |  254 lines

  1. # =()<@<INCLUDE>@>()=
  2. .include "../include/config.make"
  3.  
  4.  
  5.  
  6. BINS=expire
  7. PROGS=$(BINS) upact doexpire expireiflow
  8. DEST=$(NEWSBIN)/expire
  9. ALL=$(PROGS) explist.eg
  10. UPACTOPT=
  11. UPACTBARF=
  12.  
  13. all:    $(ALL)
  14.     $(MX) $(PROGS)
  15.  
  16. install:    $(PROGS)
  17.     $(MKDIR) $(DEST)
  18.     $(TO) $(DEST) $(PROGS)
  19.  
  20. setup:    explist.eg
  21.     $(TO) -n -e $(NEWSCTL) explist.eg
  22.  
  23. cmp:    $(ALL)
  24.     @$(IN) $(DEST) $(PROGS)
  25.     @$(IN) -i -e $(NEWSCTL) explist.eg
  26.  
  27. $(BINS):    $(LIB)
  28.  
  29. expire: expire.o
  30.     $(CC) $(LDFLAGS) expire.o $(LIBS) -o $@
  31.  
  32. histinfo: histinfo.o
  33.     $(CC) $(LDFLAGS) histinfo.o $(LIBS) -o $@
  34.  
  35. histslash:    histslash.o
  36.     $(CC) $(LDFLAGS) histslash.o $(LIBS) -o $@
  37.  
  38. lint:    expire.c
  39.     lint $(LINTFLAGS) expire.c 2>&1
  40.  
  41. explist.regw:
  42.     rm -f $@
  43.     echo "/expired/    x    0.08    -" >>$@
  44.     echo '/bounds/    x    0.01-0.1-0.11    - ' >>$@
  45.     echo '#comment' >>$@
  46.     echo >>$@
  47.     echo ' ' >>$@
  48.     echo "bar,!bar.ugh    x    0.05    `pwd`/arch2" >>$@
  49.     echo 'mod    m    0.1    @' >>$@
  50.     echo 'mod    u    0.05    -' >>$@
  51.     echo 'urp    x    0.01-0.05-0.1    -' >>$@
  52.     echo "bletch    x    0.1    =`pwd`/arch3/bletch" >>$@
  53.     echo 'unused    x    1    -' >>$@
  54.     echo 'all    x    0.1    @' >>$@
  55.  
  56. explist.reg:    explist.regw
  57.     rm -f $@
  58.     egrep -v '^unused' explist.regw >$@
  59.  
  60. UTILS=../util/dbz ../util/mkpdir ../maint/checkactive ../util/gngp
  61. AUTILS=../util/canonsys.awk ../util/namecheck.awk
  62.  
  63. ../util/dbz:
  64.     cd ../util ; $(MAKE) dbz
  65.  
  66. ../util/mkpdir:
  67.     cd ../util ; $(MAKE) mkpdir
  68.  
  69. ../util/gngp:
  70.     cd ../util ; $(MAKE) gngp
  71.  
  72. ../maint/checkactive:
  73.     cd ../maint ; $(MAKE) checkactive
  74.  
  75. BARFS=active.barf active.nobarf
  76. AB=active.$(UPACTBARF)barf
  77.  
  78. active.barf:
  79.     echo 'barf.puke 01111 01112 y' >$@
  80.  
  81. active.nobarf:
  82.     touch $@
  83.  
  84. # setup for regression test
  85. rsetup:    $(PROGS) $(UTILS) $(AUTILS) explist.reg explist.regw $(BARFS)
  86.     $(MX) $(PROGS) dircheck
  87.     >history.pag
  88.     >history.dir
  89.     mkdir bin
  90.     cp $(UTILS) bin
  91.     echo 'exit 0' >bin/lock
  92.     echo 'exit 0' >bin/unlock
  93.     echo 'echo 10' >bin/spacefor
  94.     echo 'echo fred' >bin/newshostname
  95.     $(MX) bin/*
  96.     cp $(AUTILS) .
  97.     echo "ME:all" >sys
  98.     mkdir arts arts/foo arts/bar arts/bar/ugh arts/urp arch arch2
  99.     mkdir arts/mod arts/mod/mod arts/mod/unmod arch3 arch3/bletch
  100.     mkdir arts/bletch arts/lost+found arts/barf arts/barf/puke
  101.     mkdir arts/control arts/junk
  102.     echo 'foo 00103 00001 y ' >>active
  103.     echo 'foo 00103 00098 y' >>active.after
  104.     echo 'bar 00099 00001 m' >>active
  105.     echo 'bar 00099 00100 m' >>active.after
  106.     echo 'bar.ugh 00099 00001 m' >>active
  107.     echo 'bar.ugh 00099 00099 m' >>active.after
  108.     echo 'urp 00099 00001 n' >>active
  109.     echo 'urp 00099 00007 n' >>active.after
  110.     echo 'mod.mod 00013 00001 m' >>active
  111.     echo 'mod.mod 00013 00013 m' >>active.after
  112.     echo 'mod.unmod 00016 00001 y' >>active
  113.     echo 'mod.unmod 00016 00016 y' >>active.after
  114.     echo 'bletch 00099 00001 y' >>active
  115.     echo 'bletch 00100 00001 y' >>active.after
  116.     echo 'control 00000 00001 y' >>active
  117.     echo 'control 00000 00001 y' >>active.after
  118.     echo 'junk 00000 00001 y' >>active
  119.     echo 'junk 00000 00001 y' >>active.after
  120.     cat $(AB) >>active
  121.     cat $(AB) >>active.after
  122.     echo nevermore >arts/lost+found/1
  123.     echo '<wont1>    9999~-    foo/98' >>history.proto
  124.     echo :foo/98: >arts/foo/98
  125.     echo 'MeSsAge-ID: <wont1>' >>arts/foo/98
  126.     echo '<will2>    1000~-    foo/99' >>history.proto
  127.     echo foo/99 >arts/foo/99
  128.     echo '<will3>    1000~100    foo/100' >>history.proto
  129.     echo foo/100 >arts/foo/100
  130.     echo '<two4>    100    bar/4' >>history.proto
  131.     echo :bar/4: >arts/bar/4
  132.     echo 'SuBjeCt: yes' >>arts/bar/4
  133.     echo '<will5>    100~    bar.ugh/5' >>history.proto
  134.     echo :bar/ugh/5: >arts/bar/ugh/5
  135.     echo >>arts/bar/ugh/5
  136.     echo 'Subject: no' >>arts/bar/ugh/5
  137.     echo '<gone6>    100~-    urp/6' >>history.proto
  138.     echo urp/6 >arts/urp/6
  139.     echo '<wont7>    9999~9999~xx~a    urp/7' >>history.proto
  140.     echo :urp/7: >arts/urp/7
  141.     echo 'mEssaGe-id: <wont7>' >>arts/urp/7
  142.     echo 'exPiRes: 9999' >>arts/urp/7
  143.     echo '<gone8>    100~20000    urp/8' >>history.proto
  144.     echo urp/8 >arts/urp/8
  145.     echo '<gone9>    100~-    urp/9' >>history.proto
  146.     echo '<wont10>    1000~20000    foo/101' >>history.proto
  147.     echo :foo/101: >arts/foo/101
  148.     echo 'Message-ID: <wont10>' >>arts/foo/101
  149.     echo 'Expires:  20000' >>arts/foo/101
  150.     echo 'Supersedes: <wont1>' >>arts/foo/101
  151.     echo >>arts/foo/101
  152.     echo '<will11>    100~20000    foo/102' >>history.proto
  153.     echo foo/102 >arts/foo/102
  154.     echo '<will12>    100~-    mod.mod/12' >>history.proto
  155.     echo mod/mod/12 >arts/mod/mod/12
  156.     echo '<wont13>    2000    mod.mod/13' >>history.proto
  157.     echo :mod/mod/13: >arts/mod/mod/13
  158.     echo 'Message-ID: <wont13>' >>arts/mod/mod/13
  159.     echo '<gone14>    100~-    mod.unmod/14' >>history.proto
  160.     echo mod/unmod/14 >arts/mod/unmod/14
  161.     echo '<gone15>    2000    mod.unmod/15' >>history.proto
  162.     echo mod/unmod/15 >arts/mod/unmod/15
  163.     echo '<wont16>    9999~-    mod.unmod/16' >>history.proto
  164.     echo :mod/unmod/16: >arts/mod/unmod/16
  165.     echo 'Message-ID:    <wont16>' >>arts/mod/unmod/16
  166.     echo '<three17>    100~-    bletch/17' >>history.proto
  167.     echo bletch/17 >arts/bletch/17
  168.     egrep wont history.proto >history.after
  169.     echo '<gone96>    5000~-' >>history.proto
  170.     echo '<gone96>    5000~-' >>history.after
  171.     echo '<gone98>    5000~-    urp/98' >>history.proto
  172.     echo '<gone98>    5000~-' >>history.after
  173.     echo urp/98 >arts/urp/98
  174.     echo '<multi99>    5000~-    bar/99, bar.ugh/99  foo/103 urp/99' >>history.proto
  175.     echo '<multi99>    5000~-    bar.ugh/99 foo/103' >>history.after
  176.     echo :foo/103:bar/99:bar/ugh/99:urp/99: >arts/foo/103
  177.     echo 'Message-ID:  <multi99>' >>arts/foo/103
  178.     ln arts/foo/103 arts/bar/99
  179.     ln arts/foo/103 arts/bar/ugh/99
  180.     ln arts/foo/103 arts/urp/99
  181.     cp history.proto history
  182.  
  183. # regression test machinery
  184. RUN=$(HERE) ./expire -H `pwd` -a `pwd`/arch -n 10000 -B 256
  185. FIXMIDFIELD='s/    [0-9]*~*/    ~/;s/~    /~-    /;s/~xx~a//'
  186. FIXPATHS="s;`pwd`;P;g"
  187.  
  188. # good-output files for regression check
  189. goodt:    expire rsetup    # do NOT run this unless you know what you're doing
  190.     $(RUN) -t explist.reg 2>&1 | sed $(FIXPATHS) >tgood
  191.     chmod -w tgood
  192. goodp:    expire setup    # do NOT run this unless you know what you're doing
  193.     $(RUN) -p explist.reg >pgood 2>&1
  194.     chmod -w pgood
  195. doit:    expire        # for debugging
  196.     echo "$(RUN) -t explist.reg" >$@
  197.     $(MX) $@
  198.  
  199. # the regression test proper
  200. r:    $(PROGS) rclean rsetup dircheck tgood pgood
  201.     $(RUN) -c explist.regw >test.out 2>test.stderr
  202.     test ! -s test.out ;
  203.     cmp wgood test.stderr || diff wgood test.stderr
  204.     : "okay, it's sane"
  205.     $(RUN) -t explist.reg >test.out 2>&1
  206.     sed $(FIXPATHS) test.out | cmp - tgood
  207.     : "okay, it seems to know what it's doing -- now, can it do it?"
  208.     $(RUN) -p explist.reg >test.out 2>test.stderr
  209.     test ! -s test.stderr ;
  210.     cmp test.out pgood
  211.     test ! -f history.n ;
  212.     cmp history.proto history.o
  213.     egrep wont history.proto | ./dircheck arts
  214.     egrep 'will|two|gone|three' history.proto | ./dircheck -n arts
  215.     egrep will history.proto | ./dircheck arch
  216.     egrep 'wont|two|gone|three' history.proto | ./dircheck -n arch
  217.     egrep two history.proto | ./dircheck arch2
  218.     egrep 'will|wont|gone|three' history.proto | ./dircheck -n arch2
  219.     egrep three history.proto | ./dircheck arch3
  220.     egrep 'will|wont|gone|two' history.proto | ./dircheck -n arch3
  221.     test -f arts/foo/103 ;
  222.     test -f arts/bar/ugh/99 ;
  223.     test -f arch2/bar/99 ;
  224.     test ! -f arts/urp/99 ;
  225.     cmp history history.after
  226.     test -s history.dir ;
  227.     test -s history.pag ;
  228.     : "that's it for expire, on to upact"
  229.     echo "sed '/bletch/s/099/100/' active >active.up" >junk
  230.     echo "mv active.up active" >>junk
  231.     $(MX) junk
  232.     $(HERE) ./upact $(UPACTOPT) -I `pwd`/junk '-#'
  233.     test ! -s active.errs ;
  234.     cmp active.after active.tmp || diff active.after active.tmp
  235.     mv active.tmp active
  236.     sed '/bletch/s/001 /101 /' active.after >active.after2
  237.     $(HERE) ./upact $(UPACTOPT)
  238.     cmp active.after2 active || diff active.after2 active
  239.     sed '/^foo /s/103/009/' active.after2 >active
  240.     $(HERE) ./upact -b $(UPACTOPT)
  241.     cmp active.after2 active || diff active.after2 active
  242.     : "success!"
  243.  
  244. rclean:
  245.     rm -f junk history history.pag history.dir history.o active active.tmp
  246.     rm -f history.n* *mon.out history.proto history.after test.out doit
  247.     rm -f active.old active.new explist.reg lint active.after* test.stderr
  248.     rm -f active.errs explist.regw $(BARFS)
  249.     rm -f canonsys.awk namecheck.awk sys L*
  250.     rm -rf arts arch arch2 arch3 bin
  251.  
  252. clean:    rclean
  253.     rm -f *.o expire
  254.