# $Id: Makefile.in,v 1.9 2000/02/24 03:04:57 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

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

INCLUDES	= -I. -I$(srcdir) \
		  -I../../include -I$(srcdir)/../../include \
		  -I$(srcdir)/../include
DEFS		= @DEFS@ -D_KERNEL -DDEBUG \
		  -D_K32U64 -D_PAGESZ=4096 \
		  @KERNEL_CFLAGS@ @KERNEL_CPPFLAGS@
# -DR4000 -DIP32

CFLAGS		= $(DEFS) $(INCLUDES) @CFLAGS@ @KRB4_INC_FLAGS@ \
		  -non_shared -elf -32 -mips2 -G0 -Wc,-pic0 -r -d -jalr

LDFLAGS		= -32

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 		= xfs

SUBDIRS		= bin

all: $(MOD) all-subdirs

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

$(MOD): $(OBJ)
	$(LD) $(LDFLAGS) -d -r -o $(MOD) $(OBJ)

load:
	ml ld -v -d -c xfs -p xfs_dev

unload:
	ml unload `ml list | awk '/xfs/ { print $2}'`

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

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

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

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

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

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

distclean: clean distclean-subdirs
	rm -f Makefile

TAGS:	$(SRC)
	etags $(SRC)

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