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

  1. # =()<@<INCLUDE>@>()=
  2. .include "../include/config.make"
  3.  
  4. RFC=-DHAVERFCIZE
  5. DEBUG=-DDBZDEBUG
  6.  
  7. # database sizes for performance tests, regression, and regression prime-find
  8. TSIZE=12007
  9. RSIZE=4019
  10. RPSIZE=2679
  11.  
  12. # history files for regression and performance tests
  13. RHIST=hist3.3
  14. R2HIST=hist10
  15. THIST=hist13
  16.  
  17. OBJS=dbz.o dbzdbm.o
  18. ALL=$(OBJS)
  19.  
  20. u:    $(ALL)
  21.     $(UPDATE) $(OBJS)
  22.  
  23. o:    $(OBJS)
  24.  
  25. cmp:    $(ALL)
  26.     $(LIBCMP) $(OBJS)
  27.     cmp dbzmain.c ../util/dbz.c
  28.     cmp ../include/dbz.h dbz.h
  29.  
  30. # the following is made explicit to simplify modifications on systems (mostly
  31. # x86 System Vs) where -O fouls up dbz.o somehow
  32. dbz.o:    dbz.c
  33.     $(CC) $(CFLAGS) -c dbz.c
  34.  
  35. t:    tdbz fake
  36.  
  37. lint:
  38.     lint $(LINTFLAGS) dbzmain.c dbz.c dbzdbm.c
  39.  
  40. rdbz tdbz fake byteflip:    $(LIB)
  41.  
  42. rdbz.o:    dbz.c
  43.     cp dbz.c rdbz.c
  44.     $(CC) $(CFLAGS) $(DEBUG) -DDEFSIZE=$(RSIZE) -c rdbz.c
  45.     rm -f rdbz.c
  46.  
  47. rdbzmain.o:    dbzmain.c
  48.     cp dbzmain.c rdbzmain.c
  49.     $(CC) $(CFLAGS) $(RFC) -c rdbzmain.c
  50.     rm -f rdbzmain.c
  51.  
  52. tdbz.o:    dbz.c
  53.     cp dbz.c tdbz.c
  54.     $(CC) $(CFLAGS) -DDEFSIZE=$(TSIZE) -c tdbz.c
  55.     rm -f tdbz.c
  56.  
  57. tdbz:    dbzmain.o tdbz.o dbzdbm.o
  58.     $(CC) $(LDFLAGS) dbzmain.o tdbz.o dbzdbm.o $(LIBS) -o $@
  59.  
  60. rdbz:    rdbzmain.o rdbz.o dbzdbm.o
  61.     $(CC) $(LDFLAGS) rdbzmain.o rdbz.o dbzdbm.o $(LIBS) -o $@
  62.  
  63. fake:    fake.o random.o
  64.     $(CC) $(LDFLAGS) fake.o random.o $(LIBS) -o $@
  65.  
  66. byteflip:    byteflip.o
  67.     $(CC) $(LDFLAGS) byteflip.o $(LIBS) -o $@
  68.  
  69. hist10:    fake
  70.     ./fake -t -e 75 10000 >$@
  71.  
  72. hist3.3:    fake
  73.     ./fake -t -e 75 3300 >$@
  74.  
  75. hist13:    fake
  76.     ./fake -t -e 75 13000 >$@
  77.  
  78. r:    rclean rdbz $(RHIST) $(R2HIST) byteflip getmap revbytes altbytes
  79.     : 'WARNING:  creates about 2MB of debris...'
  80.     : crude check of synthetic history file
  81.     ( sed 25q $(RHIST) ; tail -25 $(RHIST) ) >histjunk
  82.     cmp histjunk firstlast25
  83.     rm -f histjunk
  84.     : basic tests, exercising as many options as possible
  85.     cp $(RHIST) dbase
  86.     mkdir xx
  87.     chmod -w xx
  88.     ./rdbz -E 1000 -0 -M -i -S -u -U -C xx dbase
  89.     rmdir xx
  90.     sed '/>    0/d' $(RHIST) >dbase.used
  91.     test "`cat dbase.used | wc -l`" -eq "`sed -n '2s/ .*//p' dbase.dir`" ;
  92.     ./rdbz -v dbase
  93.     cp $(RHIST) dbase2
  94.     ./rdbz -E 1000 -0 -p $(RPSIZE) -t '    ' dbase2
  95.     cmp $(RHIST) dbase
  96.     cmp dbase dbase2
  97.     cmp dbase.dir dbase2.dir
  98.     cmp dbase.pag dbase2.pag
  99.     ./rdbz -E 1000 -0 -c dbase
  100.     ./rdbz -E 1000 -0 -c -i -q -M -U dbase
  101.     : build a database and then add to it
  102.     sed 1000q $(RHIST) >dbase2
  103.     sed 1,1000d $(RHIST) >dbase2.add
  104.     ./rdbz -E 1000 -0 -w dbase2
  105.     ./rdbz -E 1000 -0 -a dbase2 dbase2.add
  106.     cmp dbase dbase2
  107.     cmp dbase.dir dbase2.dir
  108.     cmp dbase.pag dbase2.pag
  109.     : build based on existing one, test extraction and readonly files
  110.     ./rdbz -E 1000 -0 -f dbase dbase2
  111.     test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$1}' dbase2.dir`" ;
  112.     test "`cat dbase.used | wc -l`" -eq "`awk 'NR==2{print $$2}' dbase2.dir`" ;
  113.     chmod -w dbase2.dir dbase2.pag
  114.     ./rdbz -E 1000 -x dbase2 dbase >dbase.temp
  115.     cmp dbase.used dbase.temp
  116.     : try some small case perversions
  117.     sed 's/\(@[^     ]*\)A/\1a/' dbase >dbase.ick
  118.     ./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
  119.     cmp dbase.used dbase.temp
  120.     sed -n 's/A\([^     ]*@\)/a\1/p' dbase >dbase.ick
  121.     ./rdbz -x dbase2 dbase.ick >dbase.temp
  122.     test ! -s dbase.temp ;
  123.     rm -f dbase2.dir dbase2.pag
  124.     : try it without tags, case-insensitive, with case perversions
  125.     ./rdbz -E 1000 -0 -p '0 b 1' dbase2
  126.     tr '[A-M][n-z]' '[a-m][N-Z]' <dbase2 >dbase.ick
  127.     ./rdbz -E 1000 -x dbase2 dbase.ick >dbase.temp
  128.     cmp dbase.used dbase.temp
  129.     rm -f dbase.temp dbase.ick
  130.     : test various perversions of byte ordering
  131.     awk -f revbytes dbase.dir >dbase2.dir
  132.     chmod +x getmap
  133.     ./byteflip `./getmap dbase.dir` `./getmap dbase2.dir` <dbase.pag >dbase2.pag
  134.     cp dbase dbase2
  135.     ./rdbz -E 1000 -0 -c dbase2
  136.     awk -f altbytes dbase.dir >dbase2.dir
  137.     dd conv=swab <dbase.pag >dbase2.pag
  138.     ./rdbz -E 1000 -0 -c dbase2
  139.     cp dbase2 dbase3
  140.     ./rdbz -E 1000 -0 -f dbase2 dbase3
  141.     ./rdbz -E 1000 -0 -c dbase3
  142.     test " `./getmap dbase2.dir`" = " `./getmap dbase3.dir`" ;
  143.     : test massive overflow, throw in case sensitivity and tag mask
  144.     cp $(R2HIST) dbase
  145.     ./rdbz -E 1000 -0 -p '0 0 7ffc0000' dbase
  146.     ./rdbz -E 1000 -0 -cq dbase
  147.     sed 100q dbase | egrep '[aA].*    ' | tr aA Aa >dbase.ick
  148.     ./rdbz -x dbase dbase.ick >dbase.temp
  149.     test ! -s dbase.temp ;
  150.     : check tag autoshrinking, tag size computing
  151.     test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 8191" ;
  152.     ./rdbz -E 1000 -0 -f dbase dbase
  153.     test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 8190" ;
  154.     cp $(RHIST) dbase
  155.     ./rdbz -E 1000 -0 -p '0 0 0' -T 1000000 dbase
  156.     test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 127" ;
  157.     ./rdbz -E 1000 -0 -p '0 0 0' -T 500000000 dbase
  158.     test " `awk 'NR == 1 { print $$7 }' dbase.dir`" = " 3" ;
  159.     : success!
  160.  
  161. rclean:
  162.     rm -f dbase dbase[23] dbase.* dbase[23].* fake fake.o random.o
  163.     rm -f rdbz rdbz.o rdbzmain.? $(RHIST) $(R2HIST) byteflip byteflip.o
  164.     rm -f histjunk core
  165.     test ! -d xx || rmdir xx
  166.  
  167. clean:    rclean
  168.     rm -f *.o dbz [a-z]dbz [a-z][a-z]dbz junk* PostScript.out
  169.     rm -f hist* dbase* *.bak mon.out gmon.out core dbm.h
  170.