home *** CD-ROM | disk | FTP | other *** search
- #!/bin/make -f
- # pathalias -- by steve bellovin, as told to peter honeyman
-
- # if you can't or don't intend to use dbm files, don't bother with makedb
- DBM = -ldbm
- # or if you roll your own ...
- # DBM = dbm.o
-
- CC = cc -g -p
- CFLAGS =
- LDFLAGS =
- YFLAGS = -d
-
- OBJ = addlink.o addnode.o extern.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 extern.c local.c main.c mapit.c mapaux.c mem.c printit.c
- SRC = $(CSRC) parse.y
- LSRC = $(CSRC) parse.c
-
- pathalias: & $(OBJ)
- $(CC) $(LDFLAGS) $(OBJ) -o pathalias
-
- all: pathalias makedb
-
- $(OBJ): def.h
-
- # if touch had a proper exit status, this would work...
- def.h: config.h
- -touch -c def.h
- get -s sccs/s.def.h
-
- parse.c: parse.y def.h
- $(YACC) $(YFLAGS) parse.y
- mv y.tab.c parse.c
-
- makedb: makedb.o
- $(CC) makedb.o $(DBM) -o makedb
-
- makedb.o: config.h
-
- clean:
- rm -f *.o y.tab.? parse.c
-
- tags: $(SRC) $(HDRS) makedb.c
- ctags -w $^
-
- bundle: README CHANGES pathalias.1 Makefile ${HDRS} ${SRC} makedb.c make.v8
- @bundle $^
-
- bundle1: README CHANGES pathalias.1 Makefile def.h config.h addlink.c
- @bundle $^
-
- bundle2: addnode.c extern.c local.c main.c mapit.c
- @bundle $^
-
- bundle3: mapaux.c mem.c printit.c parse.y makedb.c make.v8
- @bundle $^
-
- make.v8: makefile
- @cp makefile make.v8
-
- lint: $(LSRC)
- lint $(CFLAGS) $(LSRC)
- lint makedb.c
-
- # v8 make rules for sccs
- %: & sccs/s.%
- get -s sccs/s.$%
-
- # the remainder is site specific and can be deleted. it doesn't have
- # to be this complicated, but a makefile tends to swell after three or
- # four years.
-
- # hosts running delivermail
- DELIVERMAIL = tilt
-
- # hosts running sendmail
- SENDMAIL = quirky flakey yoyo panic
-
- # all neighbors
- NEIGHBORS = princeton ${DELIVERMAIL} ${SENDMAIL}
-
- # including me
- SITES = down ${NEIGHBORS}
-
- PATHFILES = paths/[^.]* paths.bell/[^.]* paths.internet/[^.]* path.map/[^.]*
-
- # from observation and rumor. avoid like the plague
- DEADHOSTS = -d tucc -d netword -d harvard -d whuxlb -d conejo
-
- DEADLINKS = -d siemens!uiucdcs -d allegra!rcalabs -d amdcad!chi -d allegra!shasta -d allegra!olympus -d shasta!imagen
-
- DEADNETS = -d internet
-
- DEAD = ${DEADHOSTS} ${DEADLINKS} ${DEADNETS}
-
- # map output (input, really) to lower case. dead links.
- ARGS = -i
-
- paths: ${SITES}
-
- down: paths/princeton
- time -v pathalias -v ${ARGS} $(DEAD) $(PATHFILES) 2>ERRORS > down.new
- sort -o down down.new
-
- # DELIVERMAIL and SENDMAIL have exactly the same links as down, so turn
- # down %s
- # up up!%s
- # into
- # up %s
- # down down!%s
-
- ${DELIVERMAIL}: down
- sed -e 's/^down %s$$/$@ %s/' \
- -e 's/^$@ $@!%s$$/down down!%s/'\
- -e 's/^/0 /' down | sort > $@
-
- # reorder the output and generate phoney costs for sendmail neighbors
- ${SENDMAIL}: down
- sed -e 's/^down %s$$/$@ %s/' \
- -e 's/$@ $@!%s$$/down down!%s/'\
- -e 's/ / 0 /' down |sort > $@
-
- # install everywhere
- shipit: ${NEIGHBORS}
- for i in ${SENDMAIL} princeton; do cp $$i /n/$$i/usr/local/lib/pathaliases; done
- for i in ${DELIVERMAIL}; do cp $$i /n/$$i/usr/local/lib/pathaliases; $$i newaliases done
- touch shipit
-
- # reorder the output for princeton/sendmail/uubang and generate phoney costs.
- princeton: down
- pathalias ${ARGS} $(DEAD) -l princeton $(PATHFILES) 2>ERRORS | sort | sed 's/\(.*\) \(.*\)/\1 0 \2/' > princeton
-
- # desperation debugging -- examine the costs.
- costs:
- pathalias -vci ${DEAD} -l down $(PATHFILES) > down.costs 2>ERRORS
-
- # make one BIG file. a BIG bad idea.
- cat:
- cat $(PATHFILES) > CAT
-
- # make a pathparse database. -g flag is undocumented.
- edges: down
- pathalias -i -g edges $(PATHFILES) >/dev/null
- makedb edges down
-