# Makefile for bsd/lib/libc/net.

CC	= false
ARCH	= eniac
CFLAGS	= -O9 -D_MINIX -I/usr/include/bsdcompat
CC1	= $(CC) -m$(ARCH) $(CFLAGS) -c

LIBRARY	= /usr/lib/$(CC)/$(ARCH)/libc.a
LIBBSD	= /usr/lib/$(CC)/$(ARCH)/libbsd.a
MAN	= /usr/man

all:	$(LIBRARY) $(LIBBSD) man

OBJECTS	= \
	$(LIBRARY)(gethostent.o) \
	$(LIBRARY)(gethostnamadr.o) \
	$(LIBRARY)(getnetbyaddr.o) \
	$(LIBRARY)(getnetbyname.o) \
	$(LIBRARY)(getnetent.o) \
	$(LIBRARY)(getproto.o) \
	$(LIBRARY)(getprotoent.o) \
	$(LIBRARY)(getprotoname.o) \
	$(LIBRARY)(getservbyname.o) \
	$(LIBRARY)(getservbyport.o) \
	$(LIBRARY)(getservent.o) \
	$(LIBRARY)(herror.o) \
	$(LIBRARY)(inet_addr.o) \
	$(LIBRARY)(inet_network.o) \
	$(LIBRARY)(inet_ntoa.o) \
	$(LIBRARY)(rcmd.o) \
	$(LIBRARY)(res_comp.o) \
	$(LIBRARY)(res_init.o) \
	$(LIBRARY)(res_mkquery.o) \
	$(LIBRARY)(res_query.o) \
	$(LIBRARY)(res_send.o) \
	$(LIBRARY)(sethostent.o) \

$(LIBRARY):	$(OBJECTS)
	$(CC) -c.a -o $@ *.o
	rm *.o

$(LIBRARY)(gethostent.o):	gethostent.c
	$(CC1) gethostent.c

$(LIBRARY)(gethostnamadr.o):	gethostnamadr.c
	$(CC1) gethostnamadr.c -O2

$(LIBRARY)(getnetbyaddr.o):	getnetbyaddr.c
	$(CC1) getnetbyaddr.c

$(LIBRARY)(getnetbyname.o):	getnetbyname.c
	$(CC1) getnetbyname.c

$(LIBRARY)(getnetent.o):	getnetent.c
	$(CC1) getnetent.c

$(LIBRARY)(getproto.o):	getproto.c
	$(CC1) getproto.c

$(LIBRARY)(getprotoent.o):	getprotoent.c
	$(CC1) getprotoent.c

$(LIBRARY)(getprotoname.o):	getprotoname.c
	$(CC1) getprotoname.c

$(LIBRARY)(getservbyname.o):	getservbyname.c
	$(CC1) getservbyname.c

$(LIBRARY)(getservbyport.o):	getservbyport.c
	$(CC1) getservbyport.c

$(LIBRARY)(getservent.o):	getservent.c
	$(CC1) getservent.c

$(LIBRARY)(herror.o):	herror.c
	$(CC1) herror.c

$(LIBRARY)(inet_addr.o):	inet_addr.c
	$(CC1) inet_addr.c

$(LIBRARY)(inet_network.o):	inet_network.c
	$(CC1) inet_network.c

$(LIBRARY)(inet_ntoa.o):	inet_ntoa.c
	$(CC1) inet_ntoa.c

$(LIBRARY)(rcmd.o):	rcmd.c
	$(CC1) rcmd.c

$(LIBRARY)(res_comp.o):	res_comp.c
	$(CC1) res_comp.c

$(LIBRARY)(res_debug.o):	res_debug.c
	$(CC1) res_debug.c

$(LIBRARY)(res_init.o):	res_init.c
	$(CC1) res_init.c

$(LIBRARY)(res_mkquery.o):	res_mkquery.c
	$(CC1) res_mkquery.c

$(LIBRARY)(res_query.o):	res_query.c
	$(CC1) res_query.c

$(LIBRARY)(res_send.o):	res_send.c
	$(CC1) res_send.c

$(LIBRARY)(sethostent.o):	sethostent.c
	$(CC1) sethostent.c

BSDOBJ	= \
	$(LIBBSD)(inet_makeaddr.o) \

$(LIBBSD):	$(BSDOBJ)
	$(CC) -c.a -o $@ *.o
	rm *.o

$(LIBBSD)(inet_makeaddr.o):	inet_makeaddr.c
	$(CC1) inet_makeaddr.c

man:	\
	$(MAN)/man3/rcmd.3 \
	$(MAN)/man3/resolver.3 \
	$(MAN)/man5/resolver.5 \

$(MAN)/man3/rcmd.3:	rcmd.3
	install -lc $? $@

$(MAN)/man3/resolver.3:	resolver.3
	install -lc $? $@

$(MAN)/man5/resolver.5:	resolver.5
	install -lc $? $@
