# Generated automatically from Makefile.in by configure.
# Makefile for the Universal NFS Server.	-*- Indented-Text -*-
# Copyright (C) 1993 Rick Sladkey.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

VPATH = .
srcdir = $(VPATH)

CC = gcc
AR = ar
RANLIB = ranlib

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
RPCGEN = rpcgen -C

DEFS = -DHAVE_CONFIG_H
LIBS = libns.a 

CFLAGS = -g
LDFLAGS = -g
WARNFLAGS = -Wall
RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
TRANSPORTFLAGS = -I -s udp -s tcp

prefix = /usr/local
exec_prefix = $(prefix)

bindir = $(exec_prefix)/etc
infodir = $(prefix)/info
man5dir = $(prefix)/man/man5
man5ext = .5
man8dir = $(prefix)/man/man8
man8ext = .8

# Prefix to be prepended to each installed RPC program, normally `rpc.'.
rpcprefix = rpc.
# Prefix to be prepended to each installed program, normally empty or `g'.
binprefix = 

#### End of system configuration section. ####

SHELL = /bin/sh

SRCS		= version.c logging.c fh.c auth_init.c auth_clnt.c \
		  nfsd.c dispatch.c getattr.c mountd.c showmount.c
LIBSRCS		= fileblocks.c fsusage.c realpath.c strerror.c \
		  utimes.c mkdir.c rename.c getopt.c getopt1.c \
		  alloca.c eaccess.c mountlist.c xmalloc.c \
		  xstrdup.c strdup.c strstr.c nfsmounted.c
XDRFILES	= mount.x nfs_prot.x
GENFILES	= mount.h mount_xdr.c mount_svc.c nfs_prot.h nfs_prot_xdr.c
HDRS		= system.h nfsd.h auth.h fh.h logging.h
LIBHDRS		= fsusage.h getopt.h mountlist.h
MANPAGES	= exports.5 mountd.8 nfsd.8 showmount.8
LIBOBJS		= version.o getopt.o getopt1.o eaccess.o \
		  fsusage.o mountlist.o xmalloc.o xstrdup.o \
		  nfsmounted.o  
OBJS		= logging.o fh.o auth_init.o auth_clnt.o
NFSD_OBJS	= nfsd.o dispatch.o getattr.o nfs_prot_xdr.o $(OBJS)
MOUNTD_OBJS	= mountd.o mount_svc.o mount_xdr.o $(OBJS)
SHOWMOUNT_OBJS	= showmount.o mount_xdr.o

DISTFILES	= $(SRCS) $(HDRS) $(MANPAGES) \
		  $(XDRFILES) $(LIBSRCS) $(LIBHDRS) \
		  ChangeLog README NEWS TODO INSTALL COPYING \
		  Makefile.in configure.in aclocal.m4 acconfig.h \
		  config.h.in configure mkinstalldirs

all: $(rpcprefix)mountd $(rpcprefix)nfsd showmount
.PHONY: all

.PHONY: info dvi
info: nfs-server.info
dvi: nfs-server.dvi

COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) -I. -I$(srcdir) $(CFLAGS) $(WARNFLAGS)

.c.o:
	$(COMPILE) $<

.PHONY: install installdirs
install: installdirs $(rpcprefix)mountd $(rpcprefix)nfsd
	$(INSTALL_PROGRAM) $(rpcprefix)mountd $(bindir)/$(rpcprefix)$(binprefix)mountd
	$(INSTALL_PROGRAM) $(rpcprefix)nfsd $(bindir)/$(rpcprefix)$(binprefix)nfsd
	$(INSTALL_PROGRAM) showmount $(bindir)/$(binprefix)showmount
	$(INSTALL_DATA) $(srcdir)/exports.5 $(man5dir)/$(binprefix)exports$(man5ext)
	$(INSTALL_DATA) $(srcdir)/mountd.8 $(man8dir)/$(binprefix)mountd$(man8ext)
	$(INSTALL_DATA) $(srcdir)/nfsd.8 $(man8dir)/$(binprefix)nfsd$(man8ext)
	$(INSTALL_DATA) $(srcdir)/showmount.8 $(man8dir)/$(binprefix)showmount$(man8ext)
	if [ 'x$(rpcprefix)' != 'x' ]; then \
		rm -f $(man8dir)/$(rpcprefix)$(binprefix)mountd$(man8ext); \
		ln $(man8dir)/$(binprefix)mountd$(man8ext) $(man8dir)/$(rpcprefix)$(binprefix)mountd$(man8ext); \
		rm -f $(man8dir)/$(rpcprefix)$(binprefix)nfsd$(man8ext); \
		ln $(man8dir)/$(binprefix)nfsd$(man8ext) $(man8dir)/$(rpcprefix)$(binprefix)nfsd$(man8ext); \
	fi
installdirs:
	${srcdir}/mkinstalldirs $(bindir) $(man5dir) $(man8dir)

$(rpcprefix)mountd: $(MOUNTD_OBJS) libns.a
	$(CC) $(LDFLAGS) -o $@ $(MOUNTD_OBJS) $(LIBS)

$(rpcprefix)nfsd: $(NFSD_OBJS) libns.a
	$(CC) $(LDFLAGS) -o $@ $(NFSD_OBJS) $(LIBS)

showmount: $(SHOWMOUNT_OBJS) libns.a
	$(CC) $(LDFLAGS) -o $@ $(SHOWMOUNT_OBJS) $(LIBS)

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

mount.h: mount.x
	rm -f $@
	$(RPCGEN) -h -o $@ $?
mount_xdr.c: mount.x
	rm -f $@
	$(RPCGEN) -c $? | \
		  sed 's;^#include ".*/mount.h"$$;#include "mount.h";' >$@
mount_svc.c: mount.x
	rm -f $@
	$(RPCGEN) $(TRANSPORTFLAGS) $? | \
		sed -e 's/main/mountd_&/' \
		    -e 's/static int _rpc/int _rpc/' \
		    -e 's;^#include ".*/mount.h"$$;#include "mount.h";' >$@
	if grep 'int _rpcfdtype' $@ >/dev/null; then \
		:; \
	else \
		echo 'int _rpcfdtype;' >tmp; \
		cat $@ >>tmp; \
		mv tmp $@; \
	fi

nfs_prot_xdr.o: nfs_prot_xdr.c
	$(COMPILE) $(RPC_WARNFLAGS) -c nfs_prot_xdr.c
mount_xdr.o: mount_xdr.c
	$(COMPILE) $(RPC_WARNFLAGS) -c mount_xdr.c
mount_svc.o: mount_svc.c
	$(COMPILE) $(RPC_WARNFLAGS) -c mount_svc.c

$(MOUNTD_OBJS): config.h nfs_prot.h mount.h
$(NFSD_OBJS): config.h nfs_prot.h mount.h
$(SHOWMOUNT_OBJS): config.h mount.h

libns.a: $(LIBOBJS)
	rm -f $@
	$(AR) cr $@ $(LIBOBJS)
	-$(RANLIB) $@

nfs-server.info: nfs-server.texi
	$(MAKEINFO) -I$(srcdir) -o nfs-server.info $(srcdir)/nfs-server.texi
nfs-server.dvi: nfs-server.texi
	$(TEXI2DVI) $(srcdir)/nfs-server.texi

.PHONY: check
check: nfs-server
	@echo nothing to check

Makefile: Makefile.in config.h.in config.status
	$(SHELL) config.status
config.status: configure
	$(SHELL) config.status --recheck
configure: configure.in aclocal.m4
	cd $(srcdir) && autoconf
config.h.in: configure.in acconfig.h
	cd $(srcdir) && autoheader

TAGS: $(SRCS)
	etags $(SRCS)

.PHONY: clean mostlyclean distclean realclean dist

clean:
	rm -f $(rpcprefix)mountd $(rpcprefix)nfsd showmount *.o libns.a core
	rm -f nfs-server.dvi nfs-server.?? nfs-server.??s
	rm -f $(GENFILES)

mostlyclean: clean

distclean: clean
	rm -f Makefile config.status

realclean: distclean
	rm -f TAGS nfs-server.info*

dist: $(DISTFILES)
	echo nfs-server-`sed -e '/version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(DISTFILES) `cat .fname`
	tar chzf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
