TOP	= ..
HDRS	= $(TOP)/crash.h $(TOP)/def.h
CSRCS	= inode.c clean_fs.c clean_sched.c clean_module.c bh.c operations.c\
	  file.c timer_vec.c clean_mm.c page.c block_device.c\
	  clean_sem.c clean_size.c clean_blkdev.c task_queue.c blkdev.c\
	  lvm.c clean_lvm.c table.c buffer.c ext2.c slab.c clean_slab.c\
	  clean_mmzone.c clean_usb.c usb.c clean_route.c route.c\
	  clean_neigh.c neighbour.c char_device.c vfsmount.c clean_tqueue.c\
	  clean_net.c socket.c dentry.c vm.c clean_vm.c clean_binfmts.c\
	  binfmts.c clean_swap.c swap.c clean_nfs.c nfs.c clean_nfsd.c\
	  nfsd.c clean_lockd.c lockd.c signal.c clean_tty.c tty.c user.c\
	  clean_genhd.c

include	$(TOP)/Rules.make

OBJS	= $(CSRCS:.c=.o)
INCLUDE	= -I$(TOP) -I$(INCDIR)
CFLAGS	= $(CDEBUG) $(INCLUDE)
TARGET	= libmcrash.a
DEPFILE	= Makefile.dep

GENHEAD	= slab.h flags_fs.h flags_mm.h flags_sched.h flags_vmalloc.h\
	  flags_mmzone.h flags_nfs_fs_i.h flags_nfs_fs_sb.h flags_nfs_mount.h\
	  flags_nfsd_export.h flags_signal.h

all:	$(GENHEAD) $(TARGET)

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

$(OBJS): $(HDRS)

slab.h:
	$(TOP)/script/gethead $(KERNELDIR)/mm/slab.c > slab.h

flags_fs.h:
	$(TOP)/script/bitname sflags:MS_ fsflags:FS_ bh_state_bits_bitname:BH_:1 flflags:FL_ istate:I_ $(KERNELDIR)/include/linux/fs.h > $@

flags_mm.h:
	$(TOP)/script/bitname pgflags:PG_:1 $(KERNELDIR)/include/linux/mm.h > $@

flags_sched.h:
	$(TOP)/script/bitname tsflags:PF_ $(KERNELDIR)/include/linux/sched.h > $@

flags_vmalloc.h:
	$(TOP)/script/bitname vsflags:VM_ $(KERNELDIR)/include/linux/vmalloc.h > $@

flags_mmzone.h:
	$(TOP)/script/bitname $(KERNELDIR)/include/linux/mmzone.h > $@

flags_nfs_fs_i.h:
	$(TOP)/script/bitname $(KERNELDIR)/include/linux/nfs_fs_i.h > $@

flags_nfs_fs_sb.h:
	$(TOP)/script/bitname $(KERNELDIR)/include/linux/nfs_fs_sb.h > $@

flags_nfs_mount.h:
	$(TOP)/script/bitname mflags:NFS_MOUNT_ $(KERNELDIR)/include/linux/nfs_mount.h > $@

flags_nfsd_export.h:
	$(TOP)/script/bitname expflags:NFSEXP_ $(KERNELDIR)/include/linux/nfsd/export.h > $@

flags_signal.h:
	$(TOP)/script/bitname saflags:SA_ $(KERNELDIR)/include/asm/signal.h > $@

flags_genhd.h:
	$(TOP)/script/bitname gdflags:GENHD_FL_ $(KERNELDIR)/include/linux/genhd.h > $@

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

depend:
	makedepend -f- $(INCLUDE) $(CSRCS) > $(DEPFILE)

ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
include $(DEPFILE)
endif
