# Copyright (c) 1993-2009, 2013-2014 Paul Mattes.
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of Paul Mattes nor his contributors may be used
#       to endorse or promote products derived from this software without
#       specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
# NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Makefile for tcl3270 (tcl-based scripted 3270 emulator)
# @configure_input@

RM = rm -f
CC = @CC@

all:: tcl3270

SRCS = XtGlue.c actions.c ansi.c apl.c charset.c ctlr.c fprint_screen.c ft.c \
	ft_cut.c ft_dft.c glue.c host.c idle.c kybd.c print.c proxy.c \
	readres.c resolver.c resources.c rpq.c see.c sf.c tables.c tcl3270.c \
	telnet.c toggles.c trace_ds.c unicode.c unicode_dbcs.c utf8.c util.c \
	xio.c

VOBJS = XtGlue.o actions.o ansi.o apl.o charset.o ctlr.o fallbacks.o \
	fprint_screen.o ft.o ft_cut.o ft_dft.o glue.o host.o idle.o kybd.o \
	print.o proxy.o readres.o resolver.o resources.o rpq.o see.o sf.o \
	tables.o tcl3270.o telnet.o toggles.o trace_ds.o unicode.o \
	unicode_dbcs.o utf8.o util.o xio.o

OBJS1 = $(VOBJS) version.o

LIBDIR = @libdir@
exec_prefix = @exec_prefix@
prefix = @prefix@
sysconfdir = @sysconfdir@
datarootdir = @datarootdir@
LIBX3270DIR = @LIBX3270DIR@
MANDIR = @mandir@
BINDIR = @bindir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

#CDEBUGFLAGS = -g -Wall

XCPPFLAGS = -I. -DLIBX3270DIR=\"$(LIBX3270DIR)\" @CPPFLAGS@ @XANSI@ @XPRECOMP@
CFLAGS = @CFLAGS@ $(XCPPFLAGS) $(CDEBUGFLAGS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

XVERSION = xversion.c
version.o: $(VOBJS) version.txt mkversion.sh
	$(RM) $(XVERSION)
	@chmod +x mkversion.sh version.txt
	sh ./mkversion.sh tcl3270 >$(XVERSION)
	$(CC) $(CFLAGS) -c -o $@ $(XVERSION)
	$(RM) $(XVERSION)

fallbacks.c: mkfb X3270.xad
	$(RM) $@
	./mkfb -c X3270.xad $@

tcl3270: $(OBJS1)
	$(CC) -o $@ $(OBJS1) $(LDFLAGS) $(LIBS)

install:: tcl3270
	[ -d $(DESTDIR)$(BINDIR) ] || \
		mkdir -p $(DESTDIR)$(BINDIR)
	$(INSTALL_PROGRAM) tcl3270 $(DESTDIR)$(BINDIR)/tcl3270

install.man:
	[ -d $(DESTDIR)$(MANDIR)/man1 ] || \
		mkdir -p $(DESTDIR)$(MANDIR)/man1
	$(INSTALL_DATA) tcl3270.man $(DESTDIR)$(MANDIR)/man1/tcl3270.1

clean::
	$(RM) tcl3270 *.o

depend:
	gccmakedep -- $(CFLAGS) -- -s "# DO NOT DELETE" $(SRCS)

# -------------------------------------------------------------------------
# dependencies generated by makedepend

# DO NOT DELETE
