|
|
1.1 root 1: #!/bin/make -f
2: # pathalias -- by steve bellovin, as told to peter honeyman
3:
4: # if you can't or don't intend to use dbm files, don't bother with makedb
5: DBM = -ldbm
6: # or if you roll your own ...
7: # DBM = dbm.o
8:
9: CC = cc -g -p
10: CFLAGS =
11: LDFLAGS =
12: YFLAGS = -d
13:
14: OBJ = addlink.o addnode.o extern.o local.o main.o mapit.o mapaux.o mem.o parse.o printit.o
15: HDRS = def.h config.h
16: CSRC = addlink.c addnode.c extern.c local.c main.c mapit.c mapaux.c mem.c printit.c
17: SRC = $(CSRC) parse.y
18: LSRC = $(CSRC) parse.c
19:
20: pathalias: & $(OBJ)
21: $(CC) $(LDFLAGS) $(OBJ) -o pathalias
22:
23: all: pathalias makedb
24:
25: $(OBJ): def.h
26:
27: # if touch had a proper exit status, this would work...
28: def.h: config.h
29: -touch -c def.h
30: get -s sccs/s.def.h
31:
32: parse.c: parse.y def.h
33: $(YACC) $(YFLAGS) parse.y
34: mv y.tab.c parse.c
35:
36: makedb: makedb.o
37: $(CC) makedb.o $(DBM) -o makedb
38:
39: makedb.o: config.h
40:
41: clean:
42: rm -f *.o y.tab.? parse.c
43:
44: tags: $(SRC) $(HDRS) makedb.c
45: ctags -w $^
46:
47: bundle: README CHANGES pathalias.1 Makefile ${HDRS} ${SRC} makedb.c make.v8
48: @bundle $^
49:
50: bundle1: README CHANGES pathalias.1 Makefile def.h config.h addlink.c
51: @bundle $^
52:
53: bundle2: addnode.c extern.c local.c main.c mapit.c
54: @bundle $^
55:
56: bundle3: mapaux.c mem.c printit.c parse.y makedb.c make.v8
57: @bundle $^
58:
59: make.v8: makefile
60: @cp makefile make.v8
61:
62: lint: $(LSRC)
63: lint $(CFLAGS) $(LSRC)
64: lint makedb.c
65:
66: # v8 make rules for sccs
67: %: & sccs/s.%
68: get -s sccs/s.$%
69:
70: # the remainder is site specific and can be deleted. it doesn't have
71: # to be this complicated, but a makefile tends to swell after three or
72: # four years.
73:
74: # hosts running delivermail
75: DELIVERMAIL = tilt
76:
77: # hosts running sendmail
78: SENDMAIL = quirky flakey yoyo panic
79:
80: # all neighbors
81: NEIGHBORS = princeton ${DELIVERMAIL} ${SENDMAIL}
82:
83: # including me
84: SITES = down ${NEIGHBORS}
85:
86: PATHFILES = paths/[^.]* paths.bell/[^.]* paths.internet/[^.]* path.map/[^.]*
87:
88: # from observation and rumor. avoid like the plague
89: DEADHOSTS = -d tucc -d netword -d harvard -d whuxlb -d conejo
90:
91: DEADLINKS = -d siemens!uiucdcs -d allegra!rcalabs -d amdcad!chi -d allegra!shasta -d allegra!olympus -d shasta!imagen
92:
93: DEADNETS = -d internet
94:
95: DEAD = ${DEADHOSTS} ${DEADLINKS} ${DEADNETS}
96:
97: # map output (input, really) to lower case. dead links.
98: ARGS = -i
99:
100: paths: ${SITES}
101:
102: down: paths/princeton
103: time -v pathalias -v ${ARGS} $(DEAD) $(PATHFILES) 2>ERRORS > down.new
104: sort -o down down.new
105:
106: # DELIVERMAIL and SENDMAIL have exactly the same links as down, so turn
107: # down %s
108: # up up!%s
109: # into
110: # up %s
111: # down down!%s
112:
113: ${DELIVERMAIL}: down
114: sed -e 's/^down %s$$/$@ %s/' \
115: -e 's/^$@ $@!%s$$/down down!%s/'\
116: -e 's/^/0 /' down | sort > $@
117:
118: # reorder the output and generate phoney costs for sendmail neighbors
119: ${SENDMAIL}: down
120: sed -e 's/^down %s$$/$@ %s/' \
121: -e 's/$@ $@!%s$$/down down!%s/'\
122: -e 's/ / 0 /' down |sort > $@
123:
124: # install everywhere
125: shipit: ${NEIGHBORS}
126: for i in ${SENDMAIL} princeton; do cp $$i /n/$$i/usr/local/lib/pathaliases; done
127: for i in ${DELIVERMAIL}; do cp $$i /n/$$i/usr/local/lib/pathaliases; $$i newaliases done
128: touch shipit
129:
130: # reorder the output for princeton/sendmail/uubang and generate phoney costs.
131: princeton: down
132: pathalias ${ARGS} $(DEAD) -l princeton $(PATHFILES) 2>ERRORS | sort | sed 's/\(.*\) \(.*\)/\1 0 \2/' > princeton
133:
134: # desperation debugging -- examine the costs.
135: costs:
136: pathalias -vci ${DEAD} -l down $(PATHFILES) > down.costs 2>ERRORS
137:
138: # make one BIG file. a BIG bad idea.
139: cat:
140: cat $(PATHFILES) > CAT
141:
142: # make a pathparse database. -g flag is undocumented.
143: edges: down
144: pathalias -i -g edges $(PATHFILES) >/dev/null
145: makedb edges down
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.