## $XFree86: xc/programs/xterm/Makefile.in,v 3.27 1999/10/13 04:21:39 dawes Exp $ ##

#### Start of system configuration section. ####

srcdir		= @srcdir@
VPATH  		= @srcdir@

CC		= @CC@
CPP		= @CPP@
LINK		= $(CC) $(CFLAGS)
INSTALL		= @INSTALL@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@

X_CFLAGS	= @X_CFLAGS@
X_LIBS		= @X_LIBS@
X_EXTRA_LIBS	= @X_EXTRA_LIBS@

IMAKE_CFLAGS	= @IMAKE_CFLAGS@
EXTRA_CFLAGS	= @EXTRA_CFLAGS@
EXTRA_LOADFLAGS	= @IMAKE_LOADFLAGS@

CPPFLAGS	= -I. -I$(srcdir) -DHAVE_CONFIG_H $(X_CFLAGS) $(IMAKE_CFLAGS)
CFLAGS		= @CFLAGS@ $(EXTRA_CFLAGS)
LIBS		= @LIBS@

prefix		= @prefix@
exec_prefix	= @exec_prefix@

manext		= 1
bindir		= $(exec_prefix)/bin
libdir		= $(exec_prefix)/lib
mandir		= $(prefix)/man/man$(manext)
appsdir		= $(libdir)/X11/app-defaults

#### End of system configuration section. ####

SHELL		= /bin/sh
RM              = rm -f
AWK		= awk

LDFLAGS		=

DESTDIR		=
BINDIR		= $(DESTDIR)$(bindir)
LIBDIR		= $(DESTDIR)$(libdir)
MANDIR		= $(DESTDIR)$(mandir)
APPSDIR		= $(DESTDIR)$(appsdir)

INSTALL_DIRS    = $(BINDIR) $(APPSDIR) $(MANDIR)

EXTRAHDR	= @EXTRAHDRS@
EXTRASRC	= @EXTRASRCS@
EXTRAOBJ	= @EXTRAOBJS@

          SRCS1 = button.c charproc.c charsets.c cursor.c \
	  	  data.c doublechr.c fontutils.c input.c \
		  $(MAINSRC) menu.c misc.c print.c ptydata.c \
		  screen.c scrollbar.c tabs.c util.c \
		  VTPrsTbl.c $(EXTRASRC)
          OBJS1 = button.o charproc.o charsets.o cursor.o \
	  	  data.o doublechr.o fontutils.o input.o \
		  main.o menu.o misc.o print.o ptydata.o \
		  screen.o scrollbar.o tabs.o util.o \
		  VTPrsTbl.o $(EXTRAOBJ)
          SRCS2 = resize.c
          OBJS2 = resize.o
           SRCS = $(SRCS1) $(SRCS2)
           OBJS = $(OBJS1) $(OBJS2)
           HDRS = VTparse.h data.h error.h main.h menu.h proto.h \
                  ptyx.h version.h xterm.h $(EXTRAHDR)
       PROGRAMS = xterm resize

all:	$(PROGRAMS)

.SUFFIXES : .i .def .hin

.c.o:
@RULE_CC@
	@ECHO_CC@$(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/$*.c

.c.i:
@RULE_CC@
	@ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@

.def.hin:
	grep '^CASE_' $< | $(AWK) '{printf "#define %s %d\n", $$1, n++}' >$@

main.o: version.h

$(OBJS1) : ptyx.h xtermcfg.h

xterm : $(OBJS1)
	@ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LOADFLAGS)

resize : $(OBJS2)
	@ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS)

256colres.h : $(srcdir)/256colres.pl
	-rm -f $@
	perl $(srcdir)/256colres.pl > $@

88colres.h : $(srcdir)/88colres.pl
	-rm -f $@
	perl $(srcdir)/88colres.pl > $@

charproc.o : @CHARPROC_DEPS@

install-full \
install :: $(INSTALL_DIRS) xterm resize
	$(srcdir)/sinstall.sh "$(INSTALL_PROGRAM)" xterm  @XTERM_PATH@ $(BINDIR)/xterm
	$(INSTALL_PROGRAM) -s -m  755 resize $(BINDIR)/resize
	$(INSTALL_DATA) $(srcdir)/xterm.man    $(MANDIR)/xterm.$(manext)
	$(INSTALL_DATA) $(srcdir)/resize.man   $(MANDIR)/resize.$(manext)
	$(INSTALL_DATA) $(srcdir)/XTerm.ad     $(APPSDIR)/XTerm
	$(INSTALL_DATA) $(srcdir)/XTerm-col.ad $(APPSDIR)/XTerm-color
	@echo 'Completed installation of executables and documentation.'
install ::
	@echo 'Use "make install-ti" to install terminfo description.'

TERMINFO_DIR = @TERMINFO_DIR@
SET_TERMINFO = @SET_TERMINFO@

install-full \
install-ti :: $(TERMINFO_DIR)
	$(SET_TERMINFO) tic $(srcdir)/terminfo
	@echo 'Completed installation of terminfo description.'

install-full \
install-tc ::
	@test -f /etc/termcap && echo 'You must install the termcap entry manually by editing /etc/termcap'

installdirs: $(INSTALL_DIRS)

uninstall:
	-$(RM) $(BINDIR)/xterm
	-$(RM) $(BINDIR)/resize
	-$(RM) $(MANDIR)/xterm.$(manext)
	-$(RM) $(MANDIR)/resize.$(manext)
	-$(RM) $(APPSDIR)/XTerm
	-$(RM) $(APPSDIR)/XTerm-color

mostlyclean:
	-$(RM) *.[ois] XtermLog.* .pure core *~ *.bak *.BAK *.out

clean: mostlyclean
	-$(RM) $(PROGRAMS)

distclean: clean
	-$(RM) Makefile config.status config.cache config.log xtermcfg.h

realclean: distclean
	-$(RM) tags TAGS ctlseqs.ps

ctlseqs.ps : ctlseqs.ms
	tbl ctlseqs.ms | groff -ms >$@

lint:
	lint $(CPPFLAGS) $(SRCS1)
	lint $(CPPFLAGS) $(SRCS2)

tags:
	ctags $(SRCS) $(HDRS)

TAGS:
	etags $(SRCS) $(HDRS)

$(TERMINFO_DIR) $(INSTALL_DIRS):
	$(SHELL) ${srcdir}/mkdirs.sh $@

ALWAYS:
