CC = gcc
CFLAGS = -O2 -fomit-frame-pointer -I..
LDFLAGS = -s
LDLIBS =
GENFILES = rstat_clnt.c rstat_xdr.c rstat.h rstat.x
RPCGEN = ../rpcgen/rpcgen
OBJS = rstat.o rstat_clnt.o rstat_xdr.o

PROG = rstat

all: $(PROG)

$(PROG): $(OBJS)

rstat_clnt.c: rstat.h
	$(RPCGEN) -l rstat.x -o $@

rstat_xdr.c: /usr/include/rpcsvc/rstat.x
	$(RPCGEN) -c rstat.x -o $@

rstat.h: /usr/include/rpcsvc/rstat.x
	cp /usr/include/rpcsvc/rstat.x .
	$(RPCGEN) -h rstat.x -o $@

clean:
	rm -f core *.o *~ $(GENFILES) rstat

clobber: clean
	rm -f $(PROG)	

install: all
	install -o root -g root -m 0755 rstat ${DEBDIR}/usr/bin
	install -o root -g root -m 0644 rstat.1 ${DEBDIR}/usr/man/man1
