2.11BSD/src/new/pathalias/make.honey

#!/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 =  -DSTATIC=extern -DDEBUG
LDFLAGS =
YFLAGS = -d

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
	sed '/^# line/d' 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.1 Makefile ${HDRS} ${SRC} arpa-privates make.honey
	@bundle README CHANGES pathalias.1 Makefile ${HDRS} ${SRC} arpa-privates make.honey

bundle1: README CHANGES pathalias.1 Makefile ${HDRS}
	@bundle README CHANGES pathalias.1 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

make.honey: makefile
	@cp makefile make.honey

lint:	$(LSRC)
	lint -hbau $(CFLAGS) $(LSRC)
	lint makedb.c


# the remainder is site specific.

PATHFILES = paths/* pp/* pm/*

paths/internet: hosts.txt arpa-privates local.hosts
	arpatxt -fi -g citi -g umix -p arpa-privates local.hosts hosts.txt > paths/internet

AVOID =

# map output (input, really) to lower case; verbose; terminal domains
ARGS = -viD

PARGS=$(ARGS) $(AVOID) $(PATHFILES)
dwon:	paths/local paths/internet
	pathalias -l dwon $(PARGS) 2>ERRORS | sort -o dwon

# 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 $(PATHFILES); do 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

umich:
	pathalias -l umich $(PARGS) 2>umich.ERRORS | sort > umich

citi:	paths/local paths/internet
	pathalias -l citi $(PARGS) 2>citi.ERRORS | sort > citi

umix:
	pathalias -l umix $(PARGS) 2>umix.ERRORS | sort > umix