# Makefile for the second extended file system programs
#
# Copyright (C) 1992, 1993 Remy Card (card@masi.ibp.fr)
#
# This file can be redistributed under the terms of the GNU General
# Public License

CC=		gcc
# 486 optimizations
#CC=		gcc -m486

# Default compiler options
CFLAGS=		-O6 -Wall -fomit-frame-pointer -pipe -DNO_DEBUG
LDFLAGS=	-O6 -s

# For debugging the programs
#CFLAGS=	-g
#LDFLAGS=	-g

# Delete -DDBMALLOC and the -ldbmalloc line if you don't want to use the 
# debugging malloc library.
#CFLAGS:=	$(CFLAGS) -I/usr/debug_include -DDBMALLOC
#LDLIBS:=	$(LDLIBS) -ldbmalloc

PROGS=		dirdump e2fsck mke2fs mklost+found tune2fs# convertefs
MANPAGES=	e2fsck.8 mke2fs.8 mklost+found.8 tune2fs.8
BINDIR=		/etc
ETCDIR=		/etc
MANDIR=		/usr/man/man8

all:		$(PROGS)

e2fsck:		badblocks1.o cache.o e2fsck.o inode.o lpf.o rdwr.o \
		tables1.o truncate.o

mke2fs:		badblocks2.o countblocks.o mke2fs.o tables2.o

clean:
	rm -f $(PROGS) *.o core

realclean:	clean
	rm -f *~ .depend

install:	$(PROGS) $(MANPAGES)
	cp $(PROGS) $(BINDIR)
	ln -sf $(BINDIR)/mke2fs $(ETCDIR)/mkfs.ext2
	ln -sf $(BINDIR)/e2fsck $(ETCDIR)/fsck.ext2
	if [ -d $(MANDIR) ]; then \
		cp $(MANPAGES) $(MANDIR); \
		ln -sf $(MANDIR)/mke2fs.8 $(MANDIR)/mkfs.ext2.8; \
		ln -sf $(MANDIR)/e2fsck.8 $(MANDIR)/fsck.ext2.8; \
	fi

dep depend .depend:
	rm -f .depend
	$(CPP) -M *.c >.depend

include .depend
