home *** CD-ROM | disk | FTP | other *** search
- #!/bin/make -f
- # pathalias -- by steve bellovin, as told to peter honeyman
-
- ### configuration section
- ###
- # if you can't or don't intend to use dbm files,
- # don't bother with DBM or makedb
- DBM = -ldbm
- # or if you roll your own ...
- # DBM = dbm.o
- ###
- # where is getopt (if not in the c library)?
- # GETOPT = -lgetopt
- ### end of configuration section
-
- CC = cc -g
- CFLAGS = -DDEBUG
- LDFLAGS =
- YFLAGS = -dD
- YYDEBUG=0
-
- OBJ = addlink.o addnode.o local.o main.o mapit.o mapaux.o mem.o parse.o printit.o
- OFILES = addlink.O addnode.O local.O main.O mapit.O mapaux.O mem.O parse.O printit.O
- HDRS = def.h config.h
- CSRC = addlink.c addnode.c local.c main.c mapit.c mapaux.c mem.c printit.c
- LSRC = $(CSRC) parse.c
- SRC = $(CSRC) parse.y makedb.c arpatxt.c
-
- pathalias: & $(OBJ)
- $(CC) $(OBJ) $(LDFLAGS) -o pathalias
-
- all: pathalias makedb arpatxt
-
- $(OBJ): $(HDRS)
-
- parse.c: parse.y $(HDRS)
- $(YACC) $(YFLAGS) parse.y
- echo '#define YYDEBUG' > parse.c
- sed -e '/^# line/d' -e 's/yydebug = 0/yydebug = $(YYDEBUG)/' y.tab.c >> parse.c
-
- makedb: makedb.o
- $(CC) makedb.o $(LDFLAGS) $(DBM) -o makedb
-
- makedb.o: config.h
-
- arpatxt: arpatxt.o
- $(CC) arpatxt.o $(LDFLAGS) -o arpatxt
-
- clean:
- rm -f *.o y.tab.? parse.c
-
- tags: $(SRC) $(HDRS)
- ctags -w $(SRC) $(HDRS)
-
- bundle: README CHANGES pathalias.8 Makefile ${HDRS} ${SRC} arpa-privates make.honey
- @bundle README CHANGES pathalias.8 Makefile ${HDRS} ${SRC} arpa-privates make.honey
-
- bundle1: README CHANGES pathalias.8 Makefile ${HDRS}
- @bundle README CHANGES pathalias.8 Makefile ${HDRS}
-
- bundle2: addlink.c addnode.c local.c main.c
- @bundle addlink.c addnode.c local.c main.c
-
- bundle3: mapit.c mapaux.c
- @bundle mapit.c mapaux.c
-
- bundle4: mem.c printit.c parse.y
- @bundle mem.c printit.c parse.y makedb.c
-
- bundle5: makedb.c arpatxt.c arpa-privates make.honey
- @bundle makedb.c arpatxt.c arpa-privates make.honey
-
- ftp:
- @make -s bundle | compress > /usr/ftp/pub/honey/pathalias.Z
-
- make.honey: makefile
- @cp makefile make.honey
-
- lint: $(LSRC)
- lint -hbu $(CFLAGS) $(LSRC)
- lint makedb.c
-
-
- # the remainder is site specific.
-
- LOCAL = paths/citi paths/internet
- FILES = pp/* $(LOCAL)
-
- paths/internet: hosts.txt arpa-privates local.hosts arpatxt
- arpatxt -vfi -g citi -g umix -g mailrus -p arpa-privates local.hosts hosts.txt > paths/internet
-
- AVOID =
-
- # map output (input, really) to lower case; verbose; terminal domains
- ARGS = -iD
-
- PARGS=$(ARGS) $(AVOID) $(FILES)
- # desperation debugging -- examine the costs.
- costs:
- pathalias -icvvD ${PARGS} 2>error.costs | awk '{printf("%s\t%s\t%s\n", $$2, $$1, $$3)}' | sort -o pa.costs
-
- # make one BIG file. a BIG bad idea.
- cat:
- for i in $(FILES); do echo "file {$$i}"; cat $$i; echo 'private {}'; done > CAT
-
- # make a pathparse database. -g is undocumented.
- edges:
- pathalias -g edges $(PARGS) 2>ERRORS > edges.hosts
- # makedb edges pa
-
- # kill bogus domains with mr. grep, then sort
- 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
-
- # round up the usual suspects
- citi dwon umix mailrus: $(LOCAL)
- pathalias -l $@ $(PARGS) | $(POSTPROC) > $@
-