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

  1. # =()<@<INCLUDE>@>()=
  2. .include "../include/config.make"
  3.  
  4. BINS=gngp newslock ctime canonhdr getabsdate sizeof dbz\
  5.     now $(DOSPACEFOR)
  6. PROGS=$(BINS) newshostname report lock unlock touchlock staleness dbzinfo \
  7.     spacefor queuelen mkpdir
  8. DEST=$(NEWSBIN)
  9. ALLNB=$(PROGS) namecheck.awk canonsys.awk
  10. ALL=$(ALLNB)
  11.  
  12. all:    $(ALL)
  13.     $(MX) $(PROGS)
  14.  
  15. install:    $(ALL)
  16.     $(MKDIR) $(DEST)
  17.     $(TO) $(DEST) $(ALLNB)
  18.  
  19. setup:    $(ALL)
  20.  
  21. cmp:    $(ALL)
  22.     @$(IN) $(DEST) $(ALLNB)
  23.     : the numbers here do not matter, but all the spacefors should succeed
  24.     $(DEST)/spacefor 1000 incoming
  25.     $(DEST)/spacefor 1000 articles
  26.     $(DEST)/spacefor 1000 control
  27.     $(DEST)/spacefor 1000 outbound
  28.     $(DEST)/spacefor 1000 batchfiles
  29.     $(DEST)/spacefor 1000 archive
  30.  
  31. $(BINS):    $(LIB)
  32.  
  33. gngp:    gngp.o
  34.     $(CC) $(LDFLAGS) gngp.o $(LIBS) -o $@
  35.  
  36. ctime:    ctime.o
  37.     $(CC) $(LDFLAGS) ctime.o $(LIBS) -o $@
  38.  
  39. newslock:    newslock.o
  40.     $(CC) $(LDFLAGS) newslock.o $(LIBS) -o $@
  41.  
  42. canonhdr:    canonhdr.o
  43.     $(CC) $(LDFLAGS) canonhdr.o $(LIBS) -o $@
  44.  
  45. getabsdate:    getabsdate.o
  46.     $(CC) $(LDFLAGS) getabsdate.o $(LIBS) -o $@
  47.  
  48. sizeof:    sizeof.o
  49.     $(CC) $(LDFLAGS) sizeof.o $(LIBS) -o $@
  50.  
  51. dbz:    dbz.o
  52.     $(CC) $(LDFLAGS) dbz.o $(LIBS) -o $@
  53.  
  54. dbz.c:    ../libdbz/dbzmain.c
  55.     cp ../libdbz/dbzmain.c $@
  56.  
  57. now:    now.o
  58.     $(CC) $(LDFLAGS) now.o $(LIBS) -o $@
  59.  
  60. spacefor:    sf.$(SPACEFOR)
  61.     cp sf.$(SPACEFOR) $@
  62.  
  63. queuelen:    queuelen.$(QUEUELEN)
  64.     cp queuelen.$(QUEUELEN) $@
  65.  
  66. sf.bsd:    sfshproto makefile
  67.     cp sfshproto $@
  68.  
  69. sf.v7:    sfshproto makefile
  70.     sed '/dfunit=/s/1024/512/;/nr = 2/s//nr = 1/;/nf = 4/s//nf = 2/;/stupid/d' sfshproto >$@
  71.  
  72. sf.sysv:    sfshproto makefile
  73.     sed '/dfunit=/s/1024/512/;/awk/s~|~| sed "s/.*:/: :/" |~;/nf = 4/s//nf = 3/;/stupid/s/4BSD/System V/' sfshproto >$@
  74.  
  75. sf.xenix:    sfshproto makefile
  76.     sed '/dfunit=/s/1024/512/;/awk/s~|~| sed "s/.*:/: :/" |~;/nr = 2/s//nr = 1/;/nf = 4/s//nf = 3/;/stupid/s/4BSD/Xenix/' sfshproto >$@
  77.  
  78. sf.sgi:    sfshproto makefile
  79.     sed '/dfunit=/s/1024/512/;/nf = 4/s//nf = 5/;/stupid/s/4BSD/SGI/' sfshproto >$@
  80.  
  81. sf.null:    makefile
  82.     echo '#! /bin/sh' >$@
  83.     echo 'echo 100' >>$@
  84.  
  85. sf.statfs sf.statvfs sf.ustat sf.ultrix:    sfcproto makefile dospacefor
  86.     cp sfcproto sf.$(SPACEFOR)
  87.  
  88. dospacefor:    dowhatever.o do$(SPACEFOR).o
  89.     $(CC) $(LDFLAGS) dowhatever.o do$(SPACEFOR).o $(LIBS) -o $@
  90.  
  91. queuelen.pre:    queuelen.vo
  92.     sed '/grade=d/s//grade=./' queuelen.vo >$@
  93.  
  94. queuelen.null:
  95.     echo '#! /bin/sh' >$@
  96.     echo 'echo 0' >>$@
  97.  
  98. r:    $(ALL) rclean
  99.     $(MX) $(PROGS) shellcheck
  100.     : If this fails, you missed a vital path directory, and later
  101.     : regression tests would fail messily for that reason.
  102.     $(HERE) test " `echo hi | wc -l`" -eq 1 ;
  103.     : If this fails, you have a buggy shell, probably bash, and the
  104.     : C News locking system will not work properly as a result.
  105.     ./shellcheck
  106.     : a sketchy test of locking
  107.     $(HERE) ./lock LOCKtest $$$$
  108.     test -s LOCKtest ;
  109.     : If the following fails, you probably have either a buggy make
  110.     : or a buggy shell, e.g. an old version of bash.
  111.     $(HERE) if ./lock -o LOCKtest $$$$ ; then false ; else true ; fi
  112.     test -s LOCKtest ;
  113.     : test that touchlock really does update locks
  114.     echo hi >tmp.lock
  115.     sleep 2
  116.     $(HERE) ./touchlock LOCKtest
  117.     test -s LOCKtest ;
  118.     test " `find L* -newer tmp.lock -print`" = " LOCKtest" ;
  119.     : and try unlocking things
  120.     $(HERE) ./unlock LOCKtest
  121.     test ! -f LOCKtest ;
  122.     : ctime
  123.     : 756362361 is Mon, 20 Dec 1993 04:39:21 GMT -- checked by calculator
  124.     test "`./ctime -u 756362361`" = "Mon Dec 20 04:39:21 1993"
  125.     test "`./ctime -i 756362361`" = "Mon, 20 Dec 1993 04:39:21 GMT"
  126.     : getabsdate
  127.     test "`./getabsdate 'Mon Dec 20 04:39:21 GMT 1993'`" = "756362361"
  128.     test "`./getabsdate 'Mon, 20 Dec 1993 04:39:21 GMT'`" = "756362361"
  129.     test "`./getabsdate 'Sun, 19 Dec 1993 23:39:21 -0500'`" = "756362361"
  130.     test "`./getabsdate \"\`./ctime -i 756362361\`\"`" = "756362361"
  131.     NEWSTZ=3660 ; export NEWSTZ ; test "`./getabsdate 'Dec 20 03:38:21 1993'`" = "756362361"
  132.     : canonhdr
  133.     echo 'newsgroups: sci.space' >tmp.in
  134.     echo 'Newsgroups: sci.space' >tmp.good
  135.     echo 'MeSsage-id: <nothing>' >>tmp.in
  136.     echo 'Message-ID: <nothing>' >>tmp.good
  137.     echo 'PATH: nowhere!nobody' >>tmp.in
  138.     echo 'Path: nowhere!nobody' >>tmp.good
  139.     echo 'folloWup-To: poster' >>tmp.in
  140.     echo 'Followup-To: poster' >>tmp.good
  141.     cp tmp.good tmp.gooddate
  142.     echo 'dATe: Sat, 18 Dec 1993 23:39:21 -0500' >>tmp.in
  143.     echo 'Date: Sat, 18 Dec 1993 23:39:21 -0500' >>tmp.good
  144.     echo 'Date: Sun, 19 Dec 1993 04:39:21 GMT' >>tmp.gooddate
  145.     echo 'Expires: Sun, 19 Dec 1993 23:39:21 -0500' >>tmp.in
  146.     echo 'Expires: Sun, 19 Dec 1993 23:39:21 -0500' >>tmp.good
  147.     echo 'Expires: Mon, 20 Dec 1993 04:39:21 GMT' >>tmp.gooddate
  148.     echo >>tmp.in
  149.     echo 'Deleted: gone' >>tmp.in
  150.     ./canonhdr <tmp.in >tmp.out
  151.     cmp tmp.good tmp.out || diff tmp.good tmp.out
  152.     ./canonhdr -d <tmp.in >tmp.out
  153.     cmp tmp.gooddate tmp.out || diff tmp.gooddate tmp.out
  154.     sed 's/, 19 Dec 1993.*/ Dec 19 23:39:21 EST 1993/' tmp.in >tmp.din
  155.     ./canonhdr -d <tmp.din >tmp.out
  156.     cmp tmp.gooddate tmp.out || diff tmp.gooddate tmp.out
  157.     sed 's/: /:/' tmp.in >tmp.822
  158.     ./canonhdr -m <tmp.822 >tmp.out
  159.     cmp tmp.good tmp.out || diff tmp.good tmp.out
  160.     NEWSTZ=3660 ; export NEWSTZ ; ./canonhdr -dm <ch.in >tmp.ch
  161.     cmp ch.out tmp.ch || diff ch.out tmp.ch
  162.     : namecheck.awk
  163.     test " `echo | awk -f namecheck.awk`" = " empty name" ;
  164.     test " `echo a b | awk -f namecheck.awk`" = " white space in name" ;
  165.     test " `echo 'a    b' | awk -f namecheck.awk`" = " white space in name" ;
  166.     test " `(echo a ; echo b) | awk -f namecheck.awk`" = " newline(s) in name" ;
  167.     $(MX) namecheck.r
  168.     sed -n '/^[^#]/p' namecheck.t >tmp.nc
  169.     ./namecheck.r <tmp.nc
  170.     : a somewhat sketchy check of spacefor
  171.     mkdir arts arts/in.coming
  172.     $(HERE) ./spacefor 1024000 incoming >tmp.sf
  173.     test `egrep '^[0-9]+$$' tmp.sf | wc -l` -eq 1 ;
  174.     : the actual number should be about the free space in this filesystem,
  175.     : in 1000KB units, less 5... unless you modify spacefor
  176.     cat tmp.sf
  177.     : report
  178.     : this attempts to send test mail to you, or failing that, to
  179.     : newsmaster...
  180.     echo "nonurgentto=$${LOGNAME-newsmaster}" >report.ctl
  181.     echo "urgentto=$${LOGNAME-newsmaster}" >>report.ctl
  182.     echo "This is a test message verifying correctness of the" >tmp.m
  183.     echo "configuration of C News.  Please disregard." >>tmp.m
  184.     $(HERE) ./report -u "first test (urg)" <tmp.m
  185.     $(HERE) ./report "second test (non-urg)" <tmp.m
  186.     : success
  187.     : but more needed... someday...
  188.  
  189. rclean:
  190.     rm -f tmp.* report.ctl L*
  191.     rm -rf arts
  192.  
  193. clean:    rclean
  194.     rm -f *.o core $(BINS) spacefor queuelen sf.* dospacefor dbz.c
  195.