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

  1. # =()<@<INCLUDE>@>()=
  2. .include "../include/config.make"
  3.  
  4. BINS=histinfo
  5. NORMAL=$(BINS) newsdaily newswatch newsboot addgroup delgroup adddirs \
  6.     act.to.times histfrom newsfrom addmissing newshist badexpiry \
  7.     newsflag mkhistory locknews histdups logroll mergeactive \
  8.     checkactive
  9. CUSTOM=spaceshort
  10. UI=cnewsdo
  11. DPROGS=$(NORMAL) $(CUSTOM)
  12. PROGS=$(DPROGS) $(UI)
  13. DEST=$(NEWSBIN)/maint
  14. ALL=$(PROGS)
  15.  
  16. all:    $(ALL)
  17.     $(MX) $(PROGS)
  18.  
  19. install:    $(PROGS)
  20.     $(MKDIR) $(DEST)
  21.     $(TO) $(DEST) $(NORMAL)
  22.     $(TO) -n $(DEST) $(CUSTOM)
  23.  
  24. ui:    $(UI)
  25.     $(MKDIR) $(UIBIN)
  26.     $(TO) $(UIBIN) $(UI)
  27.  
  28. setup:
  29.  
  30. cmp:    $(ALL)
  31.     @$(IN) $(DEST) $(NORMAL)
  32.     @$(IN) -i $(DEST) $(CUSTOM)
  33.     @$(IN) $(UIBIN) $(UI)
  34.     $(DEST)/checkactive -q
  35.  
  36. $(BINS):    $(LIB)
  37.  
  38. histinfo:    histinfo.o
  39.     $(CC) $(LDFLAGS) histinfo.o $(LIBS) -o $@
  40.  
  41. # regression test machinery
  42. FIXMIDFIELD='s/    [1-9][0-9]*~/    1~/'
  43.  
  44. ../util/dbz:
  45.     cd ../util ; $(MAKE) dbz
  46.  
  47. ../util/gngp:
  48.     cd ../util ; $(MAKE) gngp
  49.  
  50. rsetup:    $(PROGS) ../util/dbz ../util/gngp ../util/namecheck.awk ../util/canonsys.awk
  51.     $(MX) $(PROGS)
  52.     mkdir bin maint
  53.     cp histinfo histdups maint
  54.     cp ../util/dbz ../util/gngp bin
  55.     echo 'exit 0' >bin/lock
  56.     echo 'exit 0' >bin/unlock
  57.     echo 'echo here' >bin/newshostname
  58.     echo 'echo 0' >bin/now
  59.     $(MX) maint/* bin/*
  60.     cp ../util/namecheck.awk ../util/canonsys.awk .
  61.     mkdir arts arts/foo arts/bar arts/bar/ugh arts/urp
  62.     mkdir arts/bletch arts/lost+found
  63.     mkdir arts/junk arts/control
  64.     echo nevermore >arts/lost+found/1
  65.     echo '<okay1>    9999~-    foo/1' >history.gbase
  66.     echo 'MeSsAge-ID: <okay1>' >arts/foo/1
  67.     echo '<okay2>    9999~-    bar.ugh/7' >>history.gbase
  68.     echo 'Message-ID: <okay2>' >arts/bar/ugh/7
  69.     echo '<cross2>    9999~-    bar.ugh/8 foo/2' >>history.gbase
  70.     echo 'Message-ID: <cross2>' >arts/foo/2
  71.     ln arts/foo/2 arts/bar/ugh/8
  72.     echo '<cross4>    9999~-    bar.ugh/9 bar/13 foo/3 urp/2' >>history.gbase
  73.     echo 'Message-ID: <cross4>' >arts/foo/3
  74.     ln arts/foo/3 arts/bar/ugh/9
  75.     ln arts/foo/3 arts/bar/13
  76.     ln arts/foo/3 arts/urp/2
  77.     echo '<link2>    9999~tomorrow    bar.ugh/10 foo/4' >>history.gbase
  78.     echo 'Message-ID: <link2>' >arts/foo/4
  79.     echo 'Expires: tomorrow' >>arts/foo/4
  80.     ln arts/foo/4 arts/bar/ugh/10
  81.     echo '<bar.ugh/11@trash>    0~0    bar.ugh/11' >>history.gbase
  82.     echo >arts/bar/ugh/11
  83.     echo '<bar.ugh/12@trash>    0~0    bar.ugh/12' >>history.gbase
  84.     echo 'Expires: not~today' >arts/bar/ugh/12
  85.     echo 'Message-ID: <legal>' >>arts/bar/ugh/12
  86.     echo '<bar.ugh/13@trash>    0~0    bar.ugh/13' >>history.gbase
  87.     echo 'Message-ID: illegal' >arts/bar/ugh/13
  88.     sed $(FIXMIDFIELD) history.gbase | sort >history.good
  89.     echo 'here/there:foo,bar,bletch/nonsense' >sys
  90.  
  91. r:    $(PROGS) rclean rsetup
  92.     : "mkhistory"
  93.     $(HERE) ./mkhistory >mkh.out 2>mkh.diag
  94.     echo './mkhistory: (warning) empty/trash articles found, will expire at once' >mkh.good
  95.     echo "./mkhistory:    (grep history file for '@trash' to see them)" >>mkh.good
  96.     cmp mkh.good mkh.diag || diff mkh.good mkh.diag
  97.     test ! -s mkh.out ;
  98.     sed $(FIXMIDFIELD) history | sort >history.fixed
  99.     cmp history.good history.fixed || diff history.good history.fixed
  100.     test -r history.pag ;
  101.     test -r history.dir ;
  102.     : "addmissing"
  103.     echo '<missing>    9999~-    bar.ugh/14' >>history.gbase
  104.     echo 'Message-ID: <missing>' >arts/bar/ugh/14
  105.     sed $(FIXMIDFIELD) history.gbase | sort >history.good
  106.     sleep 2 ;    # ensure article looks older than addmissing startup
  107.     $(HERE) ./addmissing -v >addm.out 2>addm.diag
  108.     sed $(FIXMIDFIELD) history | sort >history.fixed
  109.     cmp history.good history.fixed || diff history.good history.fixed
  110.     sed $(FIXMIDFIELD) addm.out | sort >addm.fixed
  111.     echo "./addmissing: found 1 articles missing from history:" >addm.good
  112.     echo "<missing>    1~-    bar.ugh/14" >>addm.good
  113.     cmp addm.good addm.fixed || diff addm.good addm.fixed
  114.     test ! -s addm.diag ;
  115.     : "cnewsdo, using addmissing as test command"
  116.     echo '<missing2>    9999~-    bar.ugh/15' >>history.gbase
  117.     echo 'Message-ID: <missing2>' >arts/bar/ugh/15
  118.     sed $(FIXMIDFIELD) history.gbase | sort >history.good
  119.     sleep 2 ;    # ensure article looks older than addmissing startup
  120.     touch active
  121.     $(HERE) ./cnewsdo addmissing >addm.out 2>addm.diag
  122.     sed $(FIXMIDFIELD) history | sort >history.fixed
  123.     cmp history.good history.fixed || diff history.good history.fixed
  124.     test ! -s addm.out ;
  125.     test ! -s addm.diag ;
  126.     : quick verification that checkactive at least runs, not a good test...
  127.     echo "foo 77 01 m" >active
  128.     echo "bar 99 77 y" >>active
  129.     echo "control 00 01 y" >>active
  130.     echo "junk 00 01 y" >>active
  131.     echo "bletch 0000000000 00001 =foo" >>active
  132.     $(HERE) ./checkactive >ca.out 2>ca.diag
  133.     test ! -s ca.out ;
  134.     test ! -s ca.diag ;
  135.     : give mergeactive a try
  136.     echo "foo 0 nobody" >active.times
  137.     echo "bar 0 nobody" >>active.times
  138.     echo "control 0 nobody" >>active.times
  139.     echo "junk 0 nobody" >>active.times
  140.     echo "bletch 0 regression@here" >>active.times
  141.     echo "foo 22 21 m" >active.new
  142.     echo "bletch 777 002 =foo" >>active.new
  143.     mv active active.good
  144.     egrep -v bletch active.good >active
  145.     mv active.times actimes.good
  146.     egrep -v bletch actimes.good >active.times
  147.     $(HERE) ./mergeactive active.new >ma.out 2>ma.diag
  148.     test ! -s ma.out ;
  149.     test ! -s ma.diag ;
  150.     cmp active.good active || diff active.good active
  151.     cmp actimes.good active.times || diff actimes.good active.times
  152.     : "success!"
  153.  
  154. rclean:
  155.     rm -f history history.pag history.dir active active.* active.times*
  156.     rm -f history.n* history.* *.out *.diag *.good *.fixed actimes.*
  157.     rm -f namecheck.awk canonsys.awk sys
  158.     rm -rf arts maint bin
  159.  
  160. clean:    rclean
  161.     rm -f *.o core $(BINS)
  162.