# $Id: Makefile.in,v 1.16 2000/02/24 03:05:24 assar Exp $

SHELL		= /bin/sh

srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@
#CC		= cc
LD		= ld

INSTALL		= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS 	= @top_srcdir@/mkinstalldirs

AFS		= /afs

prefix 		= @prefix@
exec_prefix	= @exec_prefix@
libexecdir 	= @libexecdir@

INCLUDES	= -I. -I$(srcdir) \
		  -I../../include -I$(srcdir)/../../include \
		  -I$(srcdir)/../include
DEFS		= @DEFS@ @KERNEL_CFLAGS@ @KERNEL_CPPFLAGS@ -DDEBUG
CFLAGS		= $(DEFS) $(INCLUDES) @CFLAGS@ @KRB4_INC_FLAGS@

SRC		=				\
		xfs_deb.c			\
		xfs_common.c			\
		xfs_dev.c			\
		xfs_message.c			\
		xfs_node.c			\
		xfs_syscalls.c			\
		xfs_vfsops.c			\
		xfs_vnodeops.c			\
		xfs_wrap.c

OBJ 		= $(SRC:.c=.o)
MOD 		= modxfs
MODREAL		= xfs

SUBDIRS		= bin

all: $(MOD) all-subdirs

all-subdirs:
	for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) all); \
	done

$(MOD): $(OBJ)
	$(LD) -r -o ./$(MOD) $(OBJ)

load: $(MOD)
	rm -fr foo
	mkdir foo
	cp $(MOD) foo/$(MODREAL)
	(cd foo ; modload $(MODREAL))

unload:
	 foo=`modinfo | awk '$$6 ~ /xfs/ { print $$1 ; exit 0; }'`; \
         if test $$foo != ""; then modunload -i $$foo ; fi

mount:
	./bin/mount_xfs /dev/xfs0 $(AFS)

unmount:
	umount $(AFS)


install: all install-subdirs
	$(MKINSTALLDIRS) $(DESTDIR)$(libexecdir)
	$(INSTALL_DATA) $(MOD) $(DESTDIR)$(libexecdir)/$(MODREAL)

uninstall:
	rm -f $(DESTDIR)$(libexecdir)/$(MODREAL)

install-subdirs:
	for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) install); \
	done

clean:	clean-subdirs
	rm -f $(MOD) $(MODREAL) $(OBJ)

clean-subdirs:
	for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) clean); \
	done

Makefile: Makefile.in ../../config.status
	cd ../.. ; CONFIG_FILES=xfs/solaris/Makefile CONFIG_HEADERS= $(SHELL) config.status


TAGS:	$(SRC)
	etags $(SRC)

.PHONY: all all-subdirs load install uninstall install-subdirs clean clean-subdirs
