# 
# $Source: /home/andcoz/mikonos/C/xattrd/RCS/Makefile,v $
#
# XAttrD by :       Giuseppe  Cattaneo
#                   Giuseppe  Persiano
#                   Angelo    Celentano
#                   Andrea    Cozzolino
#                   Aniello   Del Sorbo
#                   Ermelindo Mauriello
#                   Raffaele  Pisapia
#

#
# $Header: /home/andcoz/mikonos/C/xattrd/RCS/Makefile,v 1.4 1996/05/02 14:26:48 andcoz Exp $
#
# $Author: andcoz $ $Locker:  $
# $Date: 1996/05/02 14:26:48 $ $Revision: 1.4 $
#

# -+-_== 

CC = gcc
RPCGEN = rpcgen -C
CFLAGS = 

RPCGENERED = xattr.h xattr_xdr.c xattr_svc.c
SRCS = xattr_subs.o xattr_xdr.o xattr_svc.o xattrd.o

INSTALL = /usr/bin/install

.PHONY: clean all

all: xattrd 

xattr.h: xattr.x
	$(RPCGEN) -h -o xattr.h xattr.x

xattr_xdr.c: xattr.x xattr.h
	$(RPCGEN) -c xattr.x | \
		sed -e 's;^#include ".*/mount.h"$$;#include "mount.h";' >$@

xattr_svc.c: xattr.x xattr.h
	$(RPCGEN) -s tcp -s udp xattr.x | \
		sed -e 's;^#include ".*/mount.h"$$;#include "mount.h";' \
                    -e 's;main;real_main;' >$@

xattr_subs.o: xattr.h

xattrd: $(SRCS)
	$(CC) $(LDFLAGS) -o xattrd $(SRCS) $(LOADLIBES)

clean:
	rm -f *.o *~ xattrd $(RPCGENERED)

install: all
	$(INSTALL) -d -m 755 -g $(OWNER) -o $(GROUP) $(SBINDIR)
	$(INSTALL) -d -m 755 -g $(OWNER) -o $(GROUP) $(MANDIR)
	$(INSTALL) -m 755 -g $(OWNER) -o $(GROUP) -s xattrd $(SBINDIR)
	$(INSTALL) -m 755 -g $(OWNER) -o $(GROUP) xattrd.8 $(MANDIR)/man8
