home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / auucp+-1.02 / fuucp_plus_src.lzh / pathalias / make.honey < prev    next >
Encoding:
Text File  |  1990-06-10  |  3.0 KB  |  117 lines

  1. #!/bin/make -f
  2. # pathalias -- by steve bellovin, as told to peter honeyman
  3.  
  4. ### configuration section
  5. ###
  6. # if you can't or don't intend to use dbm files,
  7. # don't bother with DBM or makedb
  8. DBM = -ldbm
  9. # or if you roll your own ...
  10. # DBM = dbm.o
  11. ###
  12. # where is getopt (if not in the c library)?
  13. # GETOPT = -lgetopt
  14. ### end of configuration section 
  15.  
  16. CC = cc -g
  17. CFLAGS =  -DDEBUG
  18. LDFLAGS =
  19. YFLAGS = -dD
  20. YYDEBUG=0
  21.  
  22. OBJ = addlink.o addnode.o local.o main.o mapit.o mapaux.o mem.o parse.o printit.o
  23. OFILES = addlink.O addnode.O local.O main.O mapit.O mapaux.O mem.O parse.O printit.O
  24. HDRS = def.h config.h
  25. CSRC = addlink.c addnode.c local.c main.c mapit.c mapaux.c mem.c printit.c
  26. LSRC = $(CSRC) parse.c
  27. SRC = $(CSRC) parse.y makedb.c arpatxt.c
  28.  
  29. pathalias: & $(OBJ)
  30.     $(CC) $(OBJ) $(LDFLAGS) -o pathalias
  31.  
  32. all: pathalias makedb arpatxt
  33.  
  34. $(OBJ):    $(HDRS)
  35.  
  36. parse.c: parse.y $(HDRS)
  37.     $(YACC) $(YFLAGS) parse.y
  38.     echo '#define YYDEBUG' > parse.c
  39.     sed -e '/^# line/d' -e 's/yydebug = 0/yydebug = $(YYDEBUG)/' y.tab.c >> parse.c
  40.  
  41. makedb: makedb.o
  42.     $(CC) makedb.o $(LDFLAGS) $(DBM) -o makedb
  43.  
  44. makedb.o: config.h
  45.  
  46. arpatxt: arpatxt.o
  47.     $(CC) arpatxt.o $(LDFLAGS) -o arpatxt
  48.  
  49. clean:
  50.     rm -f *.o y.tab.? parse.c
  51.  
  52. tags: $(SRC) $(HDRS)
  53.     ctags -w $(SRC) $(HDRS)
  54.  
  55. bundle: README CHANGES pathalias.8 Makefile ${HDRS} ${SRC} arpa-privates make.honey
  56.     @bundle README CHANGES pathalias.8 Makefile ${HDRS} ${SRC} arpa-privates make.honey
  57.  
  58. bundle1: README CHANGES pathalias.8 Makefile ${HDRS}
  59.     @bundle README CHANGES pathalias.8 Makefile ${HDRS}
  60.  
  61. bundle2: addlink.c addnode.c local.c main.c
  62.     @bundle addlink.c addnode.c local.c main.c
  63.  
  64. bundle3: mapit.c mapaux.c
  65.     @bundle mapit.c mapaux.c
  66.  
  67. bundle4: mem.c printit.c parse.y
  68.     @bundle mem.c printit.c parse.y makedb.c
  69.  
  70. bundle5: makedb.c arpatxt.c arpa-privates make.honey
  71.     @bundle  makedb.c arpatxt.c arpa-privates make.honey
  72.  
  73. ftp:
  74.     @make -s bundle | compress > /usr/ftp/pub/honey/pathalias.Z
  75.  
  76. make.honey: makefile
  77.     @cp makefile make.honey
  78.  
  79. lint:    $(LSRC)
  80.     lint -hbu $(CFLAGS) $(LSRC)
  81.     lint makedb.c
  82.  
  83.  
  84. # the remainder is site specific.
  85.  
  86. LOCAL = paths/citi paths/internet
  87. FILES = pp/* $(LOCAL)
  88.  
  89. paths/internet: hosts.txt arpa-privates local.hosts arpatxt
  90.     arpatxt -vfi -g citi -g umix -g mailrus -p arpa-privates local.hosts hosts.txt > paths/internet
  91.  
  92. AVOID =
  93.  
  94. # map output (input, really) to lower case; verbose; terminal domains
  95. ARGS = -iD
  96.  
  97. PARGS=$(ARGS) $(AVOID) $(FILES)
  98. # desperation debugging -- examine the costs.
  99. costs:
  100.     pathalias -icvvD ${PARGS} 2>error.costs | awk '{printf("%s\t%s\t%s\n", $$2, $$1, $$3)}' | sort -o pa.costs 
  101.  
  102. # make one BIG file.  a BIG bad idea.
  103. cat:
  104.     for i in $(FILES); do echo "file {$$i}"; cat $$i; echo 'private {}'; done > CAT
  105.  
  106. # make a pathparse database.  -g is undocumented.
  107. edges:
  108.     pathalias -g edges $(PARGS) 2>ERRORS > edges.hosts
  109. #    makedb edges pa
  110.  
  111. # kill bogus domains with mr. grep, then sort
  112. POSTPROC = egrep -v '(\.(com|edu|mil|gov|net|org|arpa|[a-z][a-z])    .*!.*!)|(.\.(com|edu|mil|gov|net|org|arpa|[a-z][a-z])    )' | sort
  113.  
  114. # round up the usual suspects
  115. citi dwon umix mailrus:    $(LOCAL)
  116.     pathalias -l $@ $(PARGS) | $(POSTPROC) > $@
  117.