VPATH = ../bin
vpath %.c $(REISERFS_KERNEL_SOURCE) $(REISERFS_LIB)

# kernel files needed for reiserfsck
KERNEL_C = fix_node.c do_balan.c lbalance.c ibalance.c stree.c prints.c buffer.c hashes.c
KERNEL_OBJS = fix_node.o do_balan.o lbalance.o ibalance.o stree.o prints.o buffer.o hashes.o

# files from utils's lib directory needed for reiserfsck
LIB_C = misc.c version.c io.c reiserfs.c
LIB_OBJS = misc.o version.o io.o reiserfs.o

# fsck's files
FSCK_C = main.c pass1.c pass2.c semantic.c pass4.c noname.c ubitmap.c info.c check.c ufile.c ustree.c uobjectid.c segments.c check_tree.c journal.c lost+found.c
FSCK_OBJS = main.o pass1.o pass2.o semantic.o pass4.o noname.o ubitmap.o info.o check.o ufile.o ustree.o uobjectid.o segments.o check_tree.o journal.o lost+found.o $(LIB_OBJS) $(KERNEL_OBJS)


FSCK = $(TMPBINDIR)/reiserfsck

.c.o:
	$(CC)  -DREISERFS_FSCK $(CFLAGS) $<

all: $(FSCK)

$(FSCK): $(FSCK_OBJS)
	$(CC) $(LFLAGS) -o $(FSCK) $(FSCK_OBJS)

clean:
	rm -f *.o $(FSCK) *~ TAGS .depend

dep:
	gcc -MM $(IDIRS) *.c ../../*.c > .depend

install:
	cp -f $(FSCK) $(SBIN)
	if [ -d $(MANDIR) ] ; then cp reiserfsck.8 $(MANDIR) ; gzip -f -9 $(MANDIR)/reiserfsck.8 ; fi

uninstall:
	rm -f $(MANDIR)/reiserfsck.8.gz $(SBIN)/reiserfsck


ifeq (.depend,$(wildcard .depend))
include .depend
endif









