home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2831 / Makefile < prev    next >
Encoding:
Makefile  |  1991-02-22  |  9.6 KB  |  286 lines

  1. PROF = 
  2. COPTS = -O
  3. CFLAGS = $(COPTS) -I../include $(PROF)
  4. LINTFLAGS = -I../include
  5. JUNKLINT = 'possible pointer align'
  6. DBM =
  7. LIBS= ../libcnews.a
  8. THEM = expire histdups histinfo histslash mkdbm mkhistory \
  9.     upact doexpire mkadir recovact backwater
  10. DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \
  11.     histslash.c mkdbm.c mkhistory pgood tgood upact \
  12.     mkadir updatemin.c recovact backwater.c
  13. UPACT=upact
  14. # =()<NEWSARTS = @<NEWSARTS>@>()=
  15. NEWSARTS = /usr/spool/news
  16. # =()<NEWSSPOOL = @<NEWSSPOOL>@>()=
  17. NEWSSPOOL = /usr/lib/news
  18. # =()<NEWSBIN = @<NEWSBIN>@>()=
  19. NEWSBIN = /usr/lib/newsbin
  20. # =()<NEWSCTL = @<NEWSCTL>@>()=
  21. NEWSCTL = /usr/lib/news
  22. # workaround for System V make bug
  23. SHELL = /bin/sh
  24.  
  25. all:    $(THEM)
  26.     chmod +x $(THEM)
  27.  
  28. bininstall:    $(THEM)
  29.     -if test ! -d $(NEWSBIN)/expire ; then mkdir $(NEWSBIN)/expire; fi
  30.     cp $(THEM) $(NEWSBIN)/expire
  31.  
  32. explists:    explist.no explist.yes
  33.  
  34. cmp:    $(THEM)
  35.     for f in $(THEM) ; do cmp $(NEWSBIN)/expire/$$f $$f ; done
  36.  
  37. check:    $(THEM)
  38.     for f in $(THEM) ; do cmp $(NEWSBIN)/expire/$$f $$f || true ; done
  39.  
  40. newsinstall:    explist
  41.     -if test ! -r $(NEWSCTL)/explist ; then cp explist $(NEWSCTL)/explist ; fi
  42.  
  43. expire: expire.o $(LIBS)
  44.     $(CC) $(CFLAGS) $(LDFLAGS) expire.o $(PRE) $(DBM) $(LIBS) $(POST) -o $@
  45.  
  46. histinfo: histinfo.o $(LIBS)
  47.     $(CC) $(CFLAGS) $(LDFLAGS) histinfo.o $(PRE) $(LIBS) $(POST) -o $@
  48.  
  49. backwater: backwater.o $(LIBS)
  50.     $(CC) $(CFLAGS) $(LDFLAGS) backwater.o $(PRE) $(LIBS) $(POST) -o $@
  51.  
  52. updatemin:    updatemin.o $(LIBS)
  53.     $(CC) $(CFLAGS) $(LDFLAGS) updatemin.o $(PRE) $(LIBS) $(POST) -o $@
  54.  
  55. histslash:    histslash.o $(LIBS)
  56.     $(CC) $(CFLAGS) $(LDFLAGS) histslash.o $(PRE) $(LIBS) $(POST) -o $@
  57.  
  58. mkdbm:    mkdbm.o $(LIBS)
  59.     $(CC) $(CFLAGS) $(LDFLAGS) mkdbm.o $(PRE) $(LIBS) $(DBM) $(POST) -o $@
  60.  
  61. lint:    expire.c
  62.     lint -ha $(LINTFLAGS) expire.c 2>&1 | egrep -v $(JUNKLINT) | tee $@
  63.  
  64. explist.yes:
  65.     echo "# hold onto history lines 14 days, nobody gets >90 days" >$@
  66.     echo "/expired/            x    14    -" >>$@
  67.     echo "/bounds/            x    0-1-90    -" >>$@
  68.     echo >>$@
  69.     echo "# override later defaults for some groups of note" >>$@
  70.     echo "sci.space.shuttle,rec.birds    x    7    @" >>$@
  71.     echo >>$@
  72.     echo "# big non-tech groups held long enough for a long weekend" >>$@
  73.     echo "sci,rec,talk,soc,misc,alt    u    4    -" >>$@
  74.     echo >>$@
  75.     echo "# real noise gets thrown away fast" >>$@
  76.     echo "news.groups            x    2    -" >>$@
  77.     echo "junk,tor.news.stats        x    2    -" >>$@
  78.     echo >>$@
  79.     echo "# throw away some technical stuff not worth archiving" >>$@
  80.     echo "comp.os.vms,comp.mail.maps    x    7    -" >>$@
  81.     echo >>$@
  82.     echo "# default:  7 days and archive" >>$@
  83.     echo "all                x    7    @" >>$@
  84.  
  85. explist.no:    explist.yes
  86.     echo '# modified version, no archiving' >$@
  87.     echo '#' >>$@
  88.     sed 's/@/-/' explist.yes >>$@
  89.  
  90. explist:    explist.no
  91.     cp explist.no $@
  92.  
  93. # setup for regression test
  94. setup:
  95.     rm -f explist history active active.after history.proto
  96.     rm -rf arts arch arch2 arch3 nbin
  97.     >history.pag
  98.     >history.dir
  99.     echo "/expired/    x    0.08    -" >>explist
  100.     echo '/bounds/    x    0.01-0.1-0.11    -' >>explist
  101.     echo "bar,!bar.ugh    x    0.05    `pwd`/arch2" >>explist
  102.     echo 'mod    m    0.1    @' >>explist
  103.     echo 'mod    u    0.05    -' >>explist
  104.     echo 'urp    x    0.01-0.05-0.1    -' >>explist
  105.     echo "bletch    x    0.1    =`pwd`/arch3/bletch" >>explist
  106.     echo 'all    x    0.1    @' >>explist
  107.     mkdir nbin nbin/expire
  108.     for f in $(THEM) ; do ln $$f nbin/expire/$$f ; done
  109.     echo 'ln $$* >/dev/null 2>/dev/null' >nbin/newslock
  110.     echo 'echo 10' >nbin/spacefor
  111.     chmod +x nbin/* nbin/expire/*
  112.     mkdir arts arts/foo arts/bar arts/bar/ugh arts/urp arch arch2
  113.     mkdir arts/mod arts/mod/mod arts/mod/unmod arch3 arch3/bletch
  114.     mkdir arts/bletch
  115.     echo 'foo 00099 00000 y' >>active
  116.     echo 'foo 00099 00001 y' >>active.after
  117.     echo 'bar 00099 00000 m' >>active
  118.     echo 'bar 00099 00100 m' >>active.after
  119.     echo 'bar.ugh 00099 00000 m' >>active
  120.     echo 'bar.ugh 00099 00099 m' >>active.after
  121.     echo 'urp 00099 00000 n' >>active
  122.     echo 'urp 00099 00007 n' >>active.after
  123.     echo 'mod.mod 00013 00000 m' >>active
  124.     echo 'mod.mod 00013 00013 m' >>active.after
  125.     echo 'mod.unmod 00016 00000 y' >>active
  126.     echo 'mod.unmod 00016 00016 y' >>active.after
  127.     echo 'bletch 00099 00000 y' >>active
  128.     echo 'bletch 00099 00100 y' >>active.after
  129.     echo '<wont1>    9999~-    foo/1' >>history.proto
  130.     echo :foo/1: >arts/foo/1
  131.     echo 'MeSsAge-ID: <wont1>' >>arts/foo/1
  132.     echo '<will2>    1000~-    foo/2' >>history.proto
  133.     echo foo/2 >arts/foo/2
  134.     echo '<will3>    1000~100    foo/3' >>history.proto
  135.     echo foo/3 >arts/foo/3
  136.     echo '<two4>    100    bar/4' >>history.proto
  137.     echo :bar/4: >arts/bar/4
  138.     echo 'SuBjeCt: yes' >>arts/bar/4
  139.     echo '<will5>    100~    bar.ugh/5' >>history.proto
  140.     echo :bar/ugh/5: >arts/bar/ugh/5
  141.     echo >>arts/bar/ugh/5
  142.     echo 'Subject: no' >>arts/bar/ugh/5
  143.     echo '<gone6>    100~-    urp/6' >>history.proto
  144.     echo urp/6 >arts/urp/6
  145.     echo '<wont7>    9999~9999~xx~a    urp/7' >>history.proto
  146.     echo :urp/7: >arts/urp/7
  147.     echo 'mEssaGe-id: <wont7>' >>arts/urp/7
  148.     echo 'exPiRes: 9999' >>arts/urp/7
  149.     echo '<gone8>    100~20000    urp/8' >>history.proto
  150.     echo urp/8 >arts/urp/8
  151.     echo '<gone9>    100~-    urp/9' >>history.proto
  152.     echo '<wont10>    1000~20000    foo/10' >>history.proto
  153.     echo :foo/10: >arts/foo/10
  154.     echo 'Message-ID: <wont10>' >>arts/foo/10
  155.     echo 'Expires: 20000' >>arts/foo/10
  156.     echo 'Supersedes: <wont1>' >>arts/foo/10
  157.     echo >>arts/foo/10
  158.     echo '<will11>    100~20000    foo/11' >>history.proto
  159.     echo foo/11 >arts/foo/11
  160.     echo '<will12>    100~-    mod.mod/12' >>history.proto
  161.     echo mod/mod/12 >arts/mod/mod/12
  162.     echo '<wont13>    2000    mod.mod/13' >>history.proto
  163.     echo :mod/mod/13: >arts/mod/mod/13
  164.     echo 'Message-ID: <wont13>' >>arts/mod/mod/13
  165.     echo '<gone14>    100~-    mod.unmod/14' >>history.proto
  166.     echo mod/unmod/14 >arts/mod/unmod/14
  167.     echo '<gone15>    2000    mod.unmod/15' >>history.proto
  168.     echo mod/unmod/15 >arts/mod/unmod/15
  169.     echo '<wont16>    9999~-    mod.unmod/16' >>history.proto
  170.     echo :mod/unmod/16: >arts/mod/unmod/16
  171.     echo 'Message-ID: <wont16>' >>arts/mod/unmod/16
  172.     echo '<three17>    100~-    bletch/17' >>history.proto
  173.     echo bletch/17 >arts/bletch/17
  174.     egrep wont history.proto >history.after
  175.     echo '<gone96>    5000~-    /' >>history.proto
  176.     echo '<gone96>    5000~-' >>history.after
  177.     echo '<gone97>    5000~-' >>history.proto
  178.     echo '<gone97>    5000~-' >>history.after
  179.     echo '<gone98>    5000~-    urp/98' >>history.proto
  180.     echo '<gone98>    5000~-' >>history.after
  181.     echo urp/98 >arts/urp/98
  182.     echo '<multi99>    5000~-    bar/99, bar.ugh/99  foo/99 urp/99' >>history.proto
  183.     echo '<multi99>    5000~-    bar.ugh/99 foo/99' >>history.after
  184.     echo :foo/99:bar/99:bar/ugh/99:urp/99: >arts/foo/99
  185.     echo 'Message-ID: <multi99>' >>arts/foo/99
  186.     ln arts/foo/99 arts/bar/99
  187.     ln arts/foo/99 arts/bar/ugh/99
  188.     ln arts/foo/99 arts/urp/99
  189.     cp history.proto history
  190.  
  191. # regression test machinery
  192. D = NEWSARTS=`pwd`/arts NEWSCTL=`pwd` NEWSSPOOL=`pwd` NEWSBIN=`pwd`/nbin
  193. RUN = $(D) ./expire -a `pwd`/arch -n 10000
  194. FIXMIDFIELD = 's/    [0-9]*~*/    ~/;s/~    /~-    /;s/~xx~a//'
  195. FIXPATHS = "s;`pwd`;P;g"
  196. goodt:    expire setup    # do NOT run this unless you know what you're doing
  197.     $(RUN) -t explist 2>&1 | sed $(FIXPATHS) >tgood
  198.     chmod -w tgood
  199. goodp:    expire setup    # do NOT run this unless you know what you're doing
  200.     $(RUN) -p explist >pgood 2>&1
  201.     chmod -w pgood
  202. doit:    expire        # for debugging
  203.     echo "$(RUN) -t explist" >$@
  204.     chmod +x $@
  205.  
  206. # the regression test proper
  207. r:    $(THEM) $(UPACT) dircheck setup tgood pgood
  208.     chmod +x dircheck $(THEM)
  209.     $(RUN) -c explist
  210.     : "okay, it's sane"
  211.     $(RUN) -t explist >test.out 2>&1
  212.     sed $(FIXPATHS) test.out | cmp - tgood
  213.     : "okay, it seems to know what it's doing -- now, can it do it?"
  214.     $(RUN) -p explist >test.out 2>test.stderr
  215.     test ! -s test.stderr ;
  216.     cmp test.out pgood
  217.     test ! -f history.n ;
  218.     cmp history.proto history.o
  219.     egrep wont history.proto | ./dircheck arts
  220.     egrep 'will|two|gone|three' history.proto | ./dircheck -n arts
  221.     egrep will history.proto | ./dircheck arch
  222.     egrep 'wont|two|gone|three' history.proto | ./dircheck -n arch
  223.     egrep two history.proto | ./dircheck arch2
  224.     egrep 'will|wont|gone|three' history.proto | ./dircheck -n arch2
  225.     egrep three history.proto | ./dircheck arch3
  226.     egrep 'will|wont|gone|two' history.proto | ./dircheck -n arch3
  227.     test -f arts/foo/99 ;
  228.     test -f arts/bar/ugh/99 ;
  229.     test -f arch2/bar/99 ;
  230.     test ! -f arts/urp/99 ;
  231.     cmp history history.after
  232.     : "that's it for expire, on to upact and recovact"
  233.     $(D) ./$(UPACT)
  234.     cmp active active.after
  235.     $(D) ./$(UPACT)
  236.     cmp active active.after
  237.     $(D) ./recovact
  238.     cmp active active.after
  239.     sed '/^foo /s/99/09/' active.after >active
  240.     $(D) ./recovact
  241.     cmp active active.after
  242.     : "and for upact, on to mkhistory"
  243.     awk -F'    ' 'NF > 2' history | sed $(FIXMIDFIELD) | sort >history.after
  244.     rm -f history.pag history.dir
  245.     $(D) ./mkhistory
  246.     sort history | sed $(FIXMIDFIELD) | cmp - history.after
  247.     test -r history.pag ;
  248.     test -r history.dir ;
  249.     : "success!"
  250.  
  251. # variant regression test for -r
  252. rr:    $(THEM) $(UPACT) dircheck setup tgood pgood
  253.     chmod +x dircheck $(THEM)
  254.     $(RUN) -p -r explist >test.out 2>test.stderr
  255.     test ! -s test.stderr ;
  256.     cmp test.out pgood
  257.     cmp history.proto history
  258.     egrep wont history.proto | ./dircheck arts
  259.     egrep 'will|two|gone|three' history.proto | ./dircheck -n arts
  260.     egrep will history.proto | ./dircheck arch
  261.     egrep 'wont|two|gone|three' history.proto | ./dircheck -n arch
  262.     egrep two history.proto | ./dircheck arch2
  263.     egrep 'will|wont|gone|three' history.proto | ./dircheck -n arch2
  264.     egrep three history.proto | ./dircheck arch3
  265.     egrep 'will|wont|gone|two' history.proto | ./dircheck -n arch3
  266.     test -f arts/foo/99 ;
  267.     test -f arts/bar/ugh/99 ;
  268.     test -f arch2/bar/99 ;
  269.     test ! -f arts/urp/99 ;
  270.  
  271. tidy:
  272.     rm -f junk history history.pag history.dir history.o active active.tmp
  273.     rm -f history.n* *mon.out history.proto history.after test.out doit
  274.     rm -f active.old active.new explist lint active.after test.stderr
  275.     rm -rf arts arch arch2 arch3 nbin
  276.  
  277. clean:    tidy
  278.     rm -f *.o expire histslash mkdbm histinfo explist explist.*
  279.     rm -f dtr updatemin backwater
  280.  
  281. spotless:    clean    # don't run this unless you know what you're doing
  282.     rm -f pgood tgood
  283.  
  284. dtr:    $(DTR)
  285.     makedtr $(DTR) >$@
  286.