# $Id: Makefile.in,v 1.2 2000/01/23 09:40:30 lha 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@ -DDEBUG -D_KERNEL
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 		= xfs
PROGS		= xfs_load xfs_query xfs_unload

SUBDIRS		= bin

all: $(MOD) $(PROGS) all-subdirs

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

$(MOD): $(OBJ)
	$(LD) -e xfs_entry -o $@ \
	/lib/kernex.exp /lib/syscalls.exp $(srcdir)/foo.exp \
	$(OBJ) \
	-lcsys \
	-bexport:$(srcdir)/xfs.exp

xfs_load.o: xfs_load.c

xfs_load: xfs_load.o
	$(CC) -o $@ xfs_load.o

xfs_unload.o: xfs_unload.c

xfs_unload: xfs_unload.o
	$(CC) -o $@ xfs_unload.o

xfs_query.o: xfs_query.c

xfs_query: xfs_query.o
	$(CC) -o $@ xfs_query.o

load:	xfs_load
	./xfs_load $(MOD)

query:	xfs_query
	./xfs_query $(MOD)

unload:	xfs_unload
	./xfs_unload $(MOD)

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) $(PROGS) $(OBJ) *.o

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

TAGS:	$(SRC)
	etags $(SRC)

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