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

CC =		gcc -m486
INSTALL = 	install

TSET =		tset
RESET =		reset
LIBS =		std stdcrt vt100 vt300
SRCS =		map.c misc.c set.c term.c tset.c ttytype.c wrterm.c
OBJS =		map.o misc.o set.o term.o tset.o ttytype.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: ${TSET}

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

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

install: $(TSET)
	$(INSTALL) -m 555 $(TSET) $(BINDIR)
	ln -sf $(TSET) $(BINDIR)/$(RESET)
	$(INSTALL) -m 444 $(TSET).1 $(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)/$(TSET) $(BINDIR)/$(RESET)
	rm -f $(MANDIR)/$(TSET).1 $(MANDIR)/$(RESET).1

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

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
