# Name: Makefile
# Description: Makefile for the nfs directory. It uses rpcgen to generate
#     the rpc server stubs.
# Author: Christian Starkjohann <cs@hal.kph.tuwien.ac.at>
# Date: 1996-11-14
# Copyright: GNU-GPL
# Tabsize: 4


INCLUDES = -I. -I..
RPCGEN = rpcgen 
TRANSPORTFLAGS =  -s udp -s tcp

XDRFILES	= nfs_prot.x
OFILES		= nfs_prot_xdr.o mount.o nfs_funcs.o syscalls.o

all: nfs.o

COMPILE = $(CC) $(ARCH) -c $(INCLUDES) $(CFLAGS)

.c.o:
	$(COMPILE) $<

nfs.o: $(OFILES)
	$(LD) $(ARCH) -r -o $@ $(OFILES)

# the purpose of the sed "s/char data/long long data/" hack is to ensure
# proper alignment. [Marc Boucher <marc@CAM.ORG>]
nfs_prot.h: nfs_prot.x
	rm -f $@
	$(RPCGEN) -h $? | \
		sed 's@char data\[NFS_FHSIZE\];@long long data\[NFS_FHSIZE / sizeof(long long)\];@' > $@

nfs_prot_xdr.c: nfs_prot.x
	rm -f $@
	$(RPCGEN) -c $? | \
		sed 's;^#include ".*/nfs_prot.h"$$;#include "nfs_prot.h";' >$@

nfs_prot_xdr.o: nfs_prot_xdr.c nfs_prot.h
	$(COMPILE) $(RPC_WARNFLAGS) -c nfs_prot_xdr.c

clean:
	rm -f $(OFILES) nfs.o nfs_prot.h nfs_prot_xdr.c nfs_prot_sstub.c

