# Generated automatically from Makefile.in by configure.
VERSION = 2.1
srcdir = .

CC = gcc
CPP = gcc -E

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644

DEFS =  -DMAJOR_IN_SYSMACROS=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_ST_RDEV=1 -DHAVE_STRERROR=1 -DHAVE_STATFS=1 -DHAVE_GETWD=1 -DHAVE_STRCASECMP=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_MNTENT_H=1 -DHAVE_UTIME_H=1 -DHAVE_SYS_VFS_H=1 -DHAVE_SYS_MOUNT_H=1 -DD_INO_IN_DIRENT=1 -DHAVE_GETMNTENT=1 -DMOUNTED_GETMNTENT1=1 -DSTAT_STATFS2_BSIZE=1 -DHAVE_MMAP=1 
LIBS =  -L/usr/include/ncurses/lib -lncurses $(XLIB)

CFLAGS = -g -O -fwritable-strings
CPPFLAGS =  -I/usr/include/ncurses -DBINDIR=\""$(bindir)/"\" -DLIBDIR=\""$(libdir)/"\" -DVERSION=\""$(VERSION)"\" $(XINC)
LDFLAGS = -O -fwritable-strings

prefix = /usr
exec_prefix = $(prefix)
binprefix =
manprefix =

bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
mandir = $(prefix)/man/man1
manext = 1

SHELL = /bin/sh

SRCS =	dir.c util.c main.c screen.c dialog.c key.c input.c menu.c\
	file.c win.c color.c help.c find.c profile.c user.c view.c \
	ext.c mouse.c setup.c auto.c zip.c dlg.c option.c \
	tree.c widget.c vfs.c chmod.c mad.c xcurses.c \
	wtools.c cons.handler.c chown.c subshell.c terms.c boxes.c \
	hotlist.c achown.c layout.c fsusage.c mountlist.c regex.c

HDRS =	color.h file.h input.h mouse.h user.h dialog.h find.h main.h \
	ncurses.h util.h dir.h global.h menu.h panel.h win.h mem.h \
	zip.h help.h profile.h dlg.h option.h tree.h \
	widget.h vfs.h chmod.h cons.saver.h mad.h wtools.h chown.h  \
	subshell.h auto.h view.h setup.h key.h ext.h boxes.h \
	hotlist.h layout.h fsusage.h mountlist.h regex.h

OBJS =	dir.o util.o main.o screen.o dialog.o key.o input.o menu.o\
	file.o win.o color.o help.o find.o profile.o user.o view.o \
	ext.o mouse.o setup.o auto.o zip.o dlg.o option.o \
	tree.o widget.o chmod.o mad.o wtools.o \
	cons.handler.o chown.o subshell.o terms.o boxes.o \
	hotlist.o achown.o layout.o fsusage.o mountlist.o \
         regex.o

DISTFILES = \
	$(HDRS) $(SRCS) README Makefile.in COPYING TODO mc.hlp \
	INSTALL mc.1 ChangeLog NEWS mc.menu mc.ext man2hlp.c \
	gindex.pl xnc.hlp LSM xmkdir configure configure.in \
	install.sh configure INSTALL.FAST GNUmakefile cons.saver.c \
	ncurses.patch create_vcs

DIST_TI = \
	terminfo/xterm.ti \
	terminfo/vt100.ti \
	terminfo/linux.ti \
	terminfo/tdiff

DIST_CONTRIB = \
	contrib/mc.ext \
	contrib/mc.menu

all: mc

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<

cons.saver: cons.saver.o
	$(CC) -N -s cons.saver.o -o cons.saver

install: installdirs all $(srcdir)/mc.1 install.saver
	$(INSTALL_PROGRAM) mc $(bindir)/$(binprefix)mc
	$(INSTALL_DATA) $(srcdir)/mc.1 $(mandir)/$(manprefix)mc.$(manext)
	$(INSTALL_DATA) $(srcdir)/mc.hlp $(libdir)/$(libprefix)mc.hlp
	$(INSTALL_DATA) $(srcdir)/mc.ext $(libdir)/$(libprefix)mc.ext
	$(INSTALL_DATA) $(srcdir)/mc.menu $(libdir)/$(libprefix)mc.menu

installdirs:
	$(srcdir)/xmkdir $(bindir) $(libdir) $(mandir)

install.saver:	cons.saver
	$(INSTALL_PROGRAM) -m 4755 cons.saver $(bindir)/$(binprefix)cons.saver
	sh $(srcdir)/create_vcs

uninstall:
	cd $(bindir); rm -f $(binprefix)mc; rm -f $(binprefix)cons.saver
	cd $(mandir); rm -f $(manprefix)mc.$(manext)
	cd $(libdir); rm -f $(libprefix)mc.hlp  $(libprefix)mc.ext 
	cd $(libdir); rm -f $(libprefix)mc.menu
	@echo Midnight Commander uninstalled

check:
	@echo no tests are supplied.

mc: $(OBJS) 
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

cross:
	make CC=gcc-linux CPP="gcc-linux -E" \
	CPPFLAGS="$(CPPFLAGS) -I/usr/local/lib/gcc-lib/i386-linux-linux/include/ncurses "

mc.hlp: ync.hlp xnc.hlp gindex.pl
	cat ync.hlp $(srcdir)/xnc.hlp | $(srcdir)/gindex.pl > mc.hlp

ync.hlp: mc.1 man2hlp
	./man2hlp 58 $(srcdir)/mc.1 > ync.hlp

mc.html: mc.1 man2hlp
	./man2hlp 0 $(srcdir)/mc.1 >body.html
	cat index.html body.html >mc.html
	rm index.html body.html


#Makefile: Makefile.in config.status
#	$(SHELL) config.status

config.status: configure
	$(SHELL) config.status --recheck

configure: configure.in
	cd $(srcdir); autoconf

TAGS: $(SRCS)
	etags $(SRCS)

clean:
	rm -f mc nc cons.saver man2hlp *.o core a.out

realclean: clean
	rm -f .depend
	rm -f TAGS
	rm -f *~
	rm -f config.cache

dist: mc.hlp
	-mkdir ../mc-$(VERSION)
	-mkdir ../mc-$(VERSION)/contrib
	-mkdir ../mc-$(VERSION)/terminfo
	cp $(DISTFILES)    ../mc-$(VERSION)
	cp $(DIST_TI)      ../mc-$(VERSION)/terminfo
	cp $(DIST_CONTRIB) ../mc-$(VERSION)/contrib
	(cd ..; tar cvf - mc-$(VERSION) | \
	gzip -f9 > mc-$(VERSION).tar.gz)

depend dep:
	$(CPP) -M $(CPPFLAGS) $(DEFS) $(CFLAGS) $(srcdir)/*.c > .depend

