#	@(#)Makefile	5.14 (Berkeley) 12/22/91
#	tset for linux -- fixes made by Juha.Virtanen@hut.fi Jun 7 1993

CC =		gcc -m486
INSTALL = 	install

PROG =		tset
RESET =		reset
MAN =		tset.1
LIBS =		std stdcrt vt100 vt300
SRCS =		map.c misc.c set.c term.c tset.c wrterm.c
OBJS =		map.o misc.o set.o term.o tset.o wrterm.o

#CFLAGS =	-g -Wall #-DDEBUG
CFLAGS =	-O6 -Wall -fomit-frame-pointer -pipe
LDFLAGS =	-s -N
LDADD =		-ltermcap

DESTDIR = 	/usr
BINDIR =	$(DESTDIR)/bin
MANDIR =	$(DESTDIR)/man/man1
LIBDIR =	$(DESTDIR)/lib/tabset


all: ${PROG}

c.o:
	$(CC) $(CFLAGS) -c $@

tset: .depend ${OBJS}
	${CC} -o ${PROG} ${OBJS} $(LDFLAGS) ${LDADD}

install: $(PROG)
	$(INSTALL) -m 555 $(PROG) $(BINDIR)
	ln -sf $(PROG) $(BINDIR)/$(RESET)
	$(INSTALL) -m 444 $(MAN) $(MANDIR)
	$(INSTALL) -m 444 $(RESET).1 $(MANDIR)
	$(INSTALL) -d $(LIBDIR)
	(cd tabset; for f in $(LIBS); do $(INSTALL) -m 444 $$f $(LIBDIR); done)

uninstall:
	rm -f $(BINDIR)/$(PROG) $(BINDIR)/$(RESET)
	rm -f $(MANDIR)/$(MAN) $(MANDIR)/$(RESET).1

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

realclean: clean
	rm -f *~ .depend

.depend dep:
	rm -f .depend
	$(CPP) -M *.c > .depend
	
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
