#
# T.C.F.S. 2.0 Alpha 1 
#
#                 This  program  handles  RPC  "NFS"  data  requests
#               adopting a secure transfer protocol.
#                 This   is  an  unsecure   and  unchecked  version,
#               use at your own risk.
# 
#               Please, report Bugs to: <tcfs@edu-gw.dia.unisa.it>
#
# Authors:	Giuseppe Cattaneo, <cattaneo@udsab.dia.unisa.it>
#		Giuseppe Persiano, <giuper@udsab.dia.unisa.it>
#		Andrea Cozzolino, <andcoz@edu-gw.dia.unisa.it>
#		Angelo Celentano, <angcel@edu-gw.dia.unisa.it>
#		Aniello Del Sorbo, <anidel@edu-gw.dia.unisa.it>
#		Ermelindo Mauriello, <ermmau@edu-gw.dia.unisa.it>
#		Raffaele Pisapia, <rafpis@edu-gw.dia.unisa.it>
#
#   Permission to  use, copy, and modify  this software  without fee
# is hereby granted, provided that this entire notice is included in
# all copies  of  any  software  which  is  or  includes a  copy  or
# modification of this software and in all copies  of the supporting
# documentation for such software.
#
#   This  software is  distribuited  under  the  GNU General  Public
# License  (version  2, June  1991). Check  the  file  'COPING'  for
# more  infos. Some  parts of  this  software  derive  from the  NFS
# implementation in the Linux kernel 2.0.x.
#
# This software  maybe be used  for any  purpose provided  the above
# copyright  notice  is retained.  It  is  supplied  as is,  with no
# warranty expressed or implied.
#
#

# -+-_==

# To make "ext" the default file system type for mount
#  (used when no other type is specified), replace \"minix\" by \"ext2\".
# Use iso9660 instead, since CDROMs are popular.
DEFAULT_FSTYPE=\"iso9660\"

# you need rpcgen and libc-4.2 or rpclib to compile in the NFS support
DEFINES = -DHAVE_TCFS -DHAVE_NFS -DFSTYPE_DEFAULT=$(DEFAULT_FSTYPE)

include MCONFIG
#CC = gcc
#OPTFLAGS=	-O2 -m486 -fomit-frame-pointer
##OPTFLAGS=	-O2 -fomit-frame-pointer  # or change on make's command line
CFLAGS = -g -pipe $(OPTFLAGS) -I../
WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
#LDFLAGS = -s -N
LDLIBS =
RPCSVCDIR = rpcsvc
RPC_CFLAGS = -Wno-unused 
RPCGEN = rpcgen

## for suid progs (mount, umount)
#BINDIR = /bin
## for nosuid progs (swapon)
#SBINDIR = /etc

# End of configuration section.

COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES)
LINK = $(CC) $(LDFLAGS)

SUID_PROGS = mount 
NOSUID_PROGS = 
PROGS = $(SUID_PROGS) $(NOSUID_PROGS)

# comment these out if you are not compiling in NFS support
NFS_OBJS = tcfsmount.o nfsmount.o mount_xdr.o mount_clnt.o
GEN_FILES = mount.h mount_xdr.c mount_clnt.c
# uncomment this if you don't have libc-4.2 but do have the rpclib
# GEN_FILES = mount.x mount.h mount_xdr.c mount_clnt.c

# comment these out if you are not compiling in loop support
LO_OBJS=lomount.o

all: $(PROGS)

%.o: %.c
	$(COMPILE) $<

mount: mount.o fstab.o sundries.o version.o smbmount.o $(NFS_OBJS) $(LO_OBJS)
	$(LINK) $^ $(LDLIBS) -o $@

umount: umount.o fstab.o sundries.o version.o $(LO_OBJS)
	$(LINK) $^ $(LDLIBS) -o $@

swapon:	swapon.o fstab.o version.o
	$(LINK) $^ $(LDLIBS) -o $@

smbfsmount.o: mount.h sundries.h

nfsmount.o mount_xdr.o mount_clnt.o: mount.h

tcfsmount.o mount_xdr.o mount_clnt.o: mount.h

sundries.o: mount.h

umount.o: mount.h

mount_clnt.o: mount_clnt.c
	$(COMPILE) $(RPC_CFLAGS) mount_clnt.c

mount_xdr.o: mount_xdr.c
	$(COMPILE) $(RPC_CFLAGS) mount_xdr.c

mount.h mount_xdr.c mount_clnt.c: mount.x
	rm -f mount.h mount_xdr.c mount_clnt.c
	$(RPCGEN) -h -o mount.h mount.x
	$(RPCGEN) -c -o mount_xdr.c mount.x
	$(RPCGEN) -l -o mount_clnt.c mount.x

mount.x:
	cp $(RPCSVCDIR)/mount.x .

clean:
	rm -f a.out core *~ *.o $(PROGS)

clobber: clean
	rm -f $(PROGS) $(GEN_FILES)

