TOP	= ..
HDRS	= $(TOP)/crash.h $(TOP)/def.h

include	$(TOP)/Rules.make

ifeq ($(XFS),yes)
CSRCS		= table.c clean_mount.c mount.c pagebuf.c clean_vfs.c vfs.c\
		  clean_inode.c inode.c clean_log.c log.c clean_trans.c \
		  trans.c
CSRCS_pagebuf	= clean_pagebuf.c
GENHEAD		= flags_pagebuf.h
else
CSRCS		= noxfs.c
endif

OBJS		= $(CSRCS:.c=.o)
OBJS_pagebuf	= $(CSRCS_pagebuf:.c=.o)
CFLAGS	= $(CDEBUG) -I$(TOP) -I$(INCDIR)
CFLAGS	+= -I$(KERNELDIR)/fs/xfs
CFLAGS	+= -I$(KERNELDIR)/fs
TARGET	= libxfs.a

all:	$(TARGET)

$(TARGET): $(GENHEAD) $(OBJS) $(OBJS_pagebuf)
	$(AR) cr $(TARGET) $(OBJS) $(OBJS_pagebuf)

$(OBJS): $(HDRS)

$(OBJS_pagebuf): $(HDRS) $(CSRCS_pagebuf)
	$(CC) $(CDEBUG) -I$(TOP) -I$(INCDIR) -I$(KERNELDIR)/fs/xfs/pagebuf -c $*.c

ifeq ($(XFSDIR),old)
flags_pagebuf.h:
	$(TOP)/script/bitname $(KERNELDIR)/include/linux/page_buf.h > $@
else
flags_pagebuf.h:
	$(TOP)/script/bitname $(KERNELDIR)/fs/xfs/pagebuf/page_buf.h > $@
endif

clean:
	/bin/rm -f $(TARGET) *.o *~ *.swp $(GENHEAD)
