# $Id: Makefile.in,v 1.293 1998/11/29 11:26:08 zeller Exp $
# DDD Makefile.

# Copyright (C) 1995-1998 Technische Universitaet Braunschweig, Germany.
# Written by Andreas Zeller <zeller@ips.cs.tu-bs.de>.
# 
# This file is part of DDD.
# 
# DDD is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# DDD is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with DDD -- see the file COPYING.
# If not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 
# DDD is the data display debugger.
# For details, see the DDD World-Wide-Web page, 
# `http://www.cs.tu-bs.de/softech/ddd/',
# or send a mail to the DDD developers <ddd@ips.cs.tu-bs.de>.


### CUSTOMIZATION SECTION --- Please check the settings below.
# Typical values are enclosed in ().

## Directories.

# Common prefix for installation directories.  (/usr/local)
# NOTE: This directory must exist when you start the install.
prefix = @prefix@
exec_prefix = @exec_prefix@

# Where to fetch the source from.  (.)
srcdir = @srcdir@
VPATH = @srcdir@

# Where to put the binary.  (${exec_prefix}/bin)
bindir = @bindir@

# Where to put the info file.  (${prefix}/info)
infodir = @infodir@

# Where to put the manual page.  (${prefix}/man)
mandir  = @mandir@
man1dir = $(mandir)/man1
man1ext = .1


## Architecture (usually overridden by the top-level Makefile).

# The host we were compiled on.  (CPU-COMPANY-SYSTEM)
host_canonical = @host@

# The target we were compiled for.  (CPU-COMPANY-SYSTEM)
target_canonical = @host@


## Special commands.

# The sed command.  (sed)
SED = @SED@

# The rm command.
RM = rm -f

# The ln -s command for making symbolic links; plain ln should work
# too.  (ln -s)
LN_S = @LN_S@

# The m4 command, preferably GNU m4.   (m4)
M4 = @M4@

# The lex command (flex), its flags (-8), and its library (-lfl).
LEX = @LEX@
LFLAGS = @LFLAGS@
LEXLIB = @LEXLIB@

# The lex output root (lex.yy)
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@

# The yacc command (bison -y) and its flags ().
YACC = @YACC@
YFLAGS = @YFLAGS@

# The shell for executing commands in the Makefile.  (/bin/sh)
SHELL = @SH@

# The ar command.
AR = ar

# ar flags for creating a new archive.
AR_FLAGS = q

# ar flags for extracting files from an archive.
AR_X_FLAGS = x

# The ranlib command.  (ranlib)
RANLIB = @RANLIB@

# A compress command, reading from stdin and writing to stdout.  (gzip -c)
COMPRESS = @COMPRESS@

# An uncompress command, reading from stdin and writing to stdout.  (gunzip -c)
UNCOMPRESS = @UNCOMPRESS@

# The etags command.  (etags)
ETAGS = etags --c++


## The C++ compiler.

# What we use to compile C++ files.  (c++)
CXX = @CXX@

# The flags we use to compile C++ files.
# CXXOPT = -DNDEBUG -O2
CXXOPT = @CXXOPT@
# CXXDEBUG = -g
CXXDEBUG = @CXXDEBUG@
# CXXWARNINGS = -W -Wall
CXXWARNINGS = @CXXWARNINGS@
CXXFLAGS = $(CXXOPT) $(CXXDEBUG) $(CXXWARNINGS)

# Extra C++-specific flags.  (-fexternal-templates -felide-constructors)
CXXSTUFF = @CXXSTUFF@

# Possible extra libraries required for all C++ programs.  ()
CXXLIBS = @CXXLIBS@

# The `.exe' extension on Windows (Cygwin)
EXEEXT = @EXEEXT@


## The C compiler; for demos only

# What we use to compile C files.
# CC = cc
CC = @CC@

# The flags we use to compile C files.
# CFLAGS = -g
CFLAGS = @CFLAGS@


## The Pascal compiler (for demos only)

# What we use to compile Pascal files.
PC = pc

# The flags we use to compile Pascal files.
PFLAGS = -g


## The Modula-2 compiler (for demos only)

# What we use to compile Modula-2 files.
M2C = m2c

# The flags we use to compile Modula-2 files.
M2FLAGS = -g


## The FORTRAN compiler (for demos only)

# What we use to compile FORTRAN files.
FC = g77

# The flags we use to compile FORTRAN files.
FFLAGS = -g



## The C preprocessor.

# What we use for preprocessing.  (gcc -E -traditional-cpp)
CPP = @CPP_TRADITIONAL@

# Flags passed to the C preprocessor.  ()
CPPFLAGS = @CPPFLAGS@

# Definitions to be passed to the C preprocessor.  (-DHAVE_CONFIG_H)
DEFS = @DEFS@


## The Linker.

# Flags passed to the linker.  (-g -O)
LDFLAGS = @LDFLAGS@ @BIG_TOC@

# Use this for building statically linked executables with GCC.
# LDFLAGS = -static @LDFLAGS@ @BIG_TOC@



## Local libraries

# POSIX regex routines (from system or ../librx/librx.a)
# LIBRX      = @LIBRX@
LIBRX      =
# termcap routines (from system or ../termcap/libtermcap.a)
LIBTERMCAP = @LIBTERMCAP@
# -liberty library (../libiberty/libiberty.a)
LIBIBERTY  = @LIBIBERTY@
# Yacc library (-ly)
LIBY       = @LIBY@
# Math library (-lm)
LIBM       = @LIBM@
# C library (-lc)
LIBC       = @LIBC@
# Socket library (-lsocket)
LIBSOCKET  = @LIBSOCKET@
# NSL library (-lnsl)
LIBNSL     = @LIBNSL@
# Additional libraries required for non-X programs (-lsocket -lnsl)
NON_X_LIBS = @LIBS@

# All libraries shown above
LIBS = $(CXXLIBS) $(LIBSOCKET) $(LIBNSL) $(LIBRX) \
       $(LIBTERMCAP) $(LIBY) $(LIBIBERTY) $(LIBM)


## X Libraries

# Special flags for linking with X.  (-L/usr/X11R5/lib)
X_LDFLAGS = @X_LIBS@

# Motif library.  (-lXm)
LIBXM = @XM_LIBS@

# Use this alternative for building `semistatic' executables
# where Motif libraries are statically linked in.
# LIBXM = -Wl,-Bstatic @XM_LIBS@ -Wl,-Bdynamic

# Athena libraries.  (-lXaw -lXmu)
LIBXAW = @XAW_LIBS@

# X extension library; needed for Athena and Motif >= 2.0.  (-lXext)
LIBXEXT = @XEXT_LIBS@

# Xpm library; needed for DDD and sometimes for Motif >= 2.0.  (-lXpm)
LIBXPM = @XPM_LIBS@

# Xp library; sometimes needed for Motif >= 2.1.  (-lXp)
LIBXP = @XP_LIBS@

# gen library; sometimes needed for Motif >= 2.0.  (-lgen)
LIBGEN = @LIBGEN@

# X toolkit library.  (-lXt)
LIBXT = @XT_LIBS@

# X library.  (-lSM -lICE -lX11 -lnsl -lsocket)
LIBX11 = @X_PRE_LIBS@ @X11_LIBS@ @X_EXTRA_LIBS@

# All libraries shown above
ALL_X_LIBS = $(X_LDFLAGS) $(LIBXM) $(LIBXP) $(LIBXPM) $(LIBXAW) $(LIBXEXT) \
$(LIBXT) $(LIBX11) $(LIBGEN)


## Installation commands.

# General install program.  (install -c)
INSTALL = @INSTALL@

# Command for installing programs.  (install -c)
INSTALL_PROGRAM = @INSTALL_PROGRAM@

# Command for installing data.  (install -c -m 644)
INSTALL_DATA = @INSTALL_DATA@

# Transformed name of installed programs.  (s,x,x,)
transform=@program_transform_name@


## `make check' commands.

# A debugger for debugging DDD.  (gdb)
DEBUGGER = @DEBUGGER@

# The options for DDD when invoking `make check'.  ()
DDD_OPTIONS = @DEBUGGER_OPTION@


## The following definitions are needed for development only.
## Usually, you don't need any of these.

# The autoconf program.  (autoconf)
AUTOCONF = @AUTOCONF@

# The autoheader program.  (autoheader)
AUTOHEADER = @AUTOHEADER@

# The aclocal program.  (aclocal)
ACLOCAL = @ACLOCAL@

# The tar program.  (gtar)
TAR = @TAR@

# The groff program.  (groff)
GROFF = groff

# The nroff program.  (groff -Tascii)
# NROFF = nroff
NROFF = $(GROFF) -Tascii

# The makeinfo program.  (makeinfo)
MAKEINFO = @MAKEINFO@

# The texindex program.  (texindex)
TEXINDEX = texindex

# The texi2html program.  (texi2html)
TEXI2HTML = texi2html

# The TeX program.  (tex)
TEX = tex

# The ad2c program.
AD2C = $(SED) -n -f $(srcdir)/ad2c.sed

# The vsl2c program.
VSL2C = $(SED) -f $(srcdir)/vsl2c.sed

# The dvips program.  (dvips)
DVIPS = @DVIPS@

# The ls program.  (ls)
LS = ls

# The head program.  (head)
HEAD = head

# The make program, if not predefined.  ()
@SET_MAKE@

# The mv command.  (mv)
MV = mv

# The echo command.  (echo)
ECHO = echo

# The awk command.  (awk)
AWK = @AWK@

# The cat command.  (cat)
CAT = cat

# The cmp command.  (cmp)
CMP = cmp

# The grep command.  (grep)
GREP = grep

# The sort command.  (sort)
SORT = sort

# The diff command.  (diff)
DIFF = @DIFF@

# The touch command.  (touch)
TOUCH = touch

# The date command.  (date)
DATE = date

# The strip command.  (strip)
STRIP = strip

# The mkdir and rmdir commands.  (mkdir) (rmdir)
MKDIR = mkdir
RMDIR = rmdir

# The sleep command.  (sleep)
SLEEP = sleep

# The fig2dev command.  (fig2dev)
FIG2DEV = fig2dev
FIG2PS = $(FIG2DEV) -L ps

# Some XPM/PPM/PostScript converters, from the netpbm and pbmplus packages.
PBMTOXBM   = pbmtoxbm
PGMENHANCE = pgmenhance
PGMTOPBM   = pgmtopbm
PNMARITH   = pnmarith
PNMCUT     = pnmcut
PNMDEPTH   = pnmdepth
PNMGAMMA   = pnmgamma
PNMINVERT  = pnminvert
PNMMARGIN  = pnmmargin
PNMPASTE   = pnmpaste
PNMTOPS    = pnmtops
PPMTOPGM   = ppmtopgm
PPMTOXPM   = ppmtoxpm
XBMTOPBM   = xbmtopbm
XPMTOPPM   = xpmtoppm

# The face-generating program from the `compface' package.  (xbm2xface.pl)
XBM2XFACE  = xbm2xface.pl


### END OF CUSTOMIZATION SECTION ---
### You shouldn't need to change anything below this line.


## The names.
# Program and distribution base name.  (ddd)
ddd = @ddd@

# Product name.  (DDD)
DDD = @DDD@

# The version number.  (1.4c)
VERSION = @VERSION@

# Canonical program and distribution base name.
ddd_canonical = $(ddd)-$(VERSION)-$(target_canonical)

# Index file fix.
FIX_INDEX = $(SED) -f $(srcdir)/fixindex.sed

# Newhelp command.
NEWHELP = sed="$(SED)" $(SHELL) $(srcdir)/newhelp

# Makeman command.
MAKEMAN = srcdir="$(srcdir)" cpp="$(CPP)" $(SHELL) $(srcdir)/makeman \
-D__MAN_VERSION__="\"$(DDD) $(VERSION)\"" -D__MAN_TITLE__="\"$(DDD) Tools\""

# Get-node command.
GET_NODE = $(SHELL) $(srcdir)/get-node

## More compilation settings.
# C++ binding flags. For binary distribution only.
# CXXSTATIC_BINDING = -Bstatic
CXXSTATIC_BINDING = @CXXSTATIC_BINDING@
# CXXDYNAMIC_BINDING = -Bdynamic
CXXDYNAMIC_BINDING = @CXXDYNAMIC_BINDING@
CXXBINDING = 

## C++ compile commands.
COMPILE.cc = $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CXXSTUFF) -c
LINK.cc = $(CXX) $(CXXBINDING) $(LDFLAGS)
COMPILE_AND_LINK.cc = \
    $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CXXSTUFF) $(CXXBINDING) $(LDFLAGS)

## C compile commands.
COMPILE.c = $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c
LINK.c = $(CC) $(LDFLAGS)
COMPILE_AND_LINK.c = \
    $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(LDFLAGS)

## Pascal compile commands.
COMPILE_AND_LINK.p = $(PC) $(CPPFLAGS) $(DEFS) $(PFLAGS)
COMPILE.p = $(COMPILE_AND_LINK.p) -c
LINK.p = $(PC)

## Modula-2 compile commands.
COMPILE_AND_LINK.m2 = $(M2C) $(M2FLAGS)
COMPILE.m2 = $(COMPILE_AND_LINK.m2) -c
LINK.m2 = $(M2C)

## FORTRAN compile commands.
COMPILE_AND_LINK.f = $(FC) $(FFLAGS)
COMPILE.f = $(COMPILE_AND_LINK.f) -c
LINK.f = $(FC)

## YACC commands.
YY = yy
YACCTOCXX = $(SHELL) $(srcdir)/yacctoC
YACC.Y = $(YACC) $(YFLAGS)

## LEX commands.
LEXTOCXX = $(SHELL) $(srcdir)/lextoC
LEX.L = $(LEX) $(LFLAGS)

## Where to look for X include files.  (-I/usr/X11R5/include)
X_INCLUDE = @X_CFLAGS@

## Where to look for include files.
INCLUDE = -I. -I$(srcdir) -I$(srcdir)/.. $(X_INCLUDE)

## Implicit rules.
.SUFFIXES: .C .cc .c .mod .p .Y .YY .L .txt .i .xbm .xbmxx .xpm .xpmxx \
	   .xface .C~ .c~ .f .f~ .sh .sh~
.C.o:
	$(COMPILE.cc) $(INCLUDE) -o $@ $<
.cc.o:
	$(COMPILE.cc) $(INCLUDE) -o $@ $<
.c.o:
	$(COMPILE.c) $(INCLUDE) -o $@ $<
.p.o:
	$(COMPILE.p) -o $@ $<
.C.i:
	$(COMPILE.cc) $(INCLUDE) -E -o $@ $<
.cc.i:
	$(COMPILE.cc) $(INCLUDE) -E -o $@ $<
.c.i:
	$(COMPILE.c) $(INCLUDE) -E -o $@ $<
.p.i:
	$(COMPILE.p) -E -o $@ $<
.Y:
	$(YACC.Y) $<
	$(YACCTOCXX)
	$(RM) y.tab.c y.tab.h
	$(LINK.cc) -o $@ y.tab.C $(LDLIBS)
	$(RM) y.tab.C y.tab.H
.Y.C:
	$(YACC) $(YFLAGS) $<
	$(YACCTOCXX)
	$(MV) y.tab.C $@
	$(RM) y.tab.H y.tab.c y.tab.h
.Y.h:
	$(YACC) -d $(YFLAGS) $<
	$(YACCTOCXX)
	$(MV) y.tab.H $@
	$(RM) y.tab.C y.tab.c y.tab.h
.Y.o:
	$(YACC) $(YFLAGS) $<
	$(YACCTOCXX)
	$(COMPILE.cc) y.tab.C
	$(RM) y.tab.C y.tab.H y.tab.c y.tab.h
.Y.YY:
	$(YACC) -v $(YFLAGS) $<
	$(MV) y.output $@
	$(RM) y.tab.c y.tab.h
.L:
	$(LEX.L) $<
	$(LEXTOCXX)
	$(LINK.cc) -o $@ $(LEX_OUTPUT_ROOT).C $(LDLIBS)
	$(RM) $(LEX_OUTPUT_ROOT).C $(LEX_OUTPUT_ROOT).c
.L.C:
	$(LEX.L) $<
	$(LEXTOCXX)
	$(MV) $(LEX_OUTPUT_ROOT).C $@
	$(RM) $(LEX_OUTPUT_ROOT).c
.L.o:
	$(LEX.L) $<
	$(LEXTOCXX)
	$(COMPILE.cc) -o $@ $(LEX_OUTPUT_ROOT).C
	$(RM) $(LEX_OUTPUT_ROOT).C $(LEX_OUTPUT_ROOT).c


# Jacek M. Holeczek <holeczek@heracles.cto.us.edu.pl> says these `dummy'
# rules are required to disable default rules under AIX MAKE.  They
# should do no harm using other MAKEs.
.C:
.C~:
.c:
.c~:
.f:
.f~:
.sh:
.sh~:


## Script rules
.txt.C:
	@$(ECHO) "Creating $@"
	@( \
	$(ECHO) '// $@ -- generated automatically from `$<'"'."; \
	$(SED) '/^ *#/d' $< | \
	$(SED) 's/^ *include \([^"][^.]*\)\..*$$/#include "\1.C"/' | \
	$(SED) 's/^ *include "\([^"][^.]*\)[^"]*"/#include "\1.C"/' | \
	$(SED) '/^[^#]/s/\(["'"'"'\\]\)/\\\1/g' | \
	$(SED) '/^[^#]/s/.*/"&\\n"/' | \
	$(SED) 's//\\b/g' | \
	$(SED) 's/^$$/"\\n"/' \
	) > tmp.C; \
	$(CPP) -C -P -undef $(CPPFLAGS) $(DEFS) $(INCLUDE) tmp.C > $@; \
	$(RM) tmp.C

## Icon rules
.xpm.xbm:
	@$(ECHO) "Creating $@"
	@-base=`$(ECHO) $@ | $(SED) 's,.*/,,' | $(SED) 's/[.]x[bp]m.*//'`; \
	$(SED) 's/[	 ][cg]4*[ 	][#a-zA-Z0-9][#a-zA-Z0-9]*//g' $< | \
	$(SED) 's/[nN]one/white/g' | \
	$(XPMTOPPM) | $(PNMDEPTH) 255 | $(PPMTOPGM) | $(PGMTOPBM) | \
	$(PBMTOXBM) | $(SED) "s/noname/$${base}/g" | \
	$(SED) "s/static char/static unsigned char/g" > $@~
	@test -s $@~ && $(MV) $@~ $@ || ($(RM) $@~; test -s $@)

.xbm.xface:
	@$(ECHO) "Creating $@"
	@$(ECHO) "X-Face:`$(XBM2XFACE) $<`" > $@~
	@test -s $@~ && $(MV) $@~ $@ || ($(RM) $@~; test -s $@)

# This jewel makes an `emboss' effect in two steps:
# 1. Create a displaced mask in FILE-mask.pbm, using `pnmcut' and `pnmpaste'
# 2. Add the mask to FILE.xbm, using `pnmarith'.
.xbm.xpmxx:
	@$(ECHO) "Creating $@"
	@-base=`$(ECHO) $@ | $(SED) 's,.*/,,' | $(SED) 's/[.]x[bp]m.*//'`; \
	$(SED) 's/unsigned //' $< | \
	$(XBMTOPBM) > $${base}-object.pbm; \
	$(PNMMARGIN) 1 $${base}-object.pbm | \
	$(PNMCUT) 0 0 29 25 | \
	$(PNMINVERT) | \
	$(PNMPASTE) -and $${base}-object.pbm 0 0 > $${base}-mask.pbm; \
	$(PPMTOXPM) $${base}-object.pbm | \
	$(SED) 's/#00*/grey50/' | \
	$(SED) 's/#FF*/grey/' | \
	$(XPMTOPPM) > $${base}-button.ppm; \
	$(PNMARITH) -add $${base}-button.ppm $${base}-mask.pbm | \
	$(PPMTOXPM) | \
	$(SED) 's/c #BE[BE]*/c none   g none   m none  s Background/' | \
	$(SED) 's/c #7F[7F]*/c grey50 g grey50 m black/' | \
	$(SED) 's/c #FF*/c white  g white  m white/' | \
	$(SED) "s/noname/$${base}_xx_xpm/" > $@~; \
	$(RM) $${base}-object.pbm $${base}-mask.pbm $${base}-button.ppm
	@test -s $@~ && $(MV) $@~ $@ || ($(RM) $@~; test -s $@)

.xpm.xbmxx:
	@$(ECHO) "Creating $@"
	@-base=`$(ECHO) $@ | $(SED) 's,.*/,,' | $(SED) 's/[.]x[bp]m.*//'`; \
	$(SED) 's/[ 	]c[	 ][#a-zA-Z0-9][#a-zA-Z0-9]*//' $< | \
	$(SED) 's/ g black  / g grey50 /' | \
	$(SED) 's/ g white  / g grey75 /' | \
	$(SED) 's/g \([a-zA-Z0-9]*\) /c \1 g \1 /' | \
	$(SED) 's/[nN]one/white/g' | \
	$(XPMTOPPM) | $(PNMDEPTH) 255 | $(PPMTOPGM) | $(PGMTOPBM) | \
	$(PBMTOXBM) | $(SED) "s/noname/$${base}_xx/" | \
	$(SED) "s/static char/static unsigned char/g" > $@~
	@test -s $@~ && $(MV) $@~ $@ || ($(RM) $@~; test -s $@)



## Libraries and object files
# General-purpose utilities: strings, regexps, run-type type info...
BASE_OBJECTS = \
	compare.o    \
	cook.o       \
	cwd.o        \
	glob.o       \
	hash.o       \
	home.o       \
	rxclass.o    \
	sigName.o    \
	strclass.o   \
	tabs.o       \
	uniquify.o   \
	PrintGC.o    \
	SignalB.o    \
	TypeInfo.o   \
	UniqueId.o   \
	MemCheck.o

# Instantiated templates
TEMPLATE_OBJECTS = \
	IntIntAA.o   \
	StringA.o    \
	StringMap.o  \
	StringSA.o   \
	VoidArray.o  \
	WidgetSA.o

# Interprocess communication
# Top-level class is `Agent', declared in `Agent.h'
AGENT_OBJECTS = \
	Agent.o      \
	AgentM.o     \
	AsyncAgent.o \
	ChunkQueue.o \
	DataLength.o \
	HandlerL.o   \
	LiterateA.o  \
	TimeOut.o    \
	TTYAgent.o

# Miscellaneous utilities for X programs: Motif strings, hourglasses,
# context-sensitive help...
XSTUFF_OBJECTS = \
	charsets.o   \
	converters.o \
	events.o     \
	findParent.o \
	findWindow.o \
	fileSBF.o    \
	frame.o      \
	longName.o   \
	selection.o  \
	simpleMenu.o \
	verify.o     \
	ComboBox.o   \
	Delay.o      \
	DestroyCB.o  \
	ExitCB.o     \
	InitImage.o  \
	LabelH.o     \
	LessTifH.o   \
	MString.o    \
	MakeMenu.o   \
	SpinBox.o    \
	Swallower.o  \
	XErrorB.o

# Box library - rectangular composible graphical items
# Top-level class is `Box', declared in `Box.h'
BOX_OBJECTS = \
	printBox.o   \
	AlignBox.o   \
	ArcBox.o     \
	BinBox.o     \
	Box.o        \
	BoxD.o       \
	BoxExtend.o  \
	BoxPoint.o   \
	BoxRegion.o  \
	BoxSize.o    \
	ColorBox.o   \
	CompositeB.o \
	DiagBox.o    \
	DummyBox.o   \
	FixBox.o     \
	FontFixBox.o \
	FontTable.o  \
	HatBox.o     \
	LineBox.o    \
	ListBox.o    \
	MarkBox.o    \
	MatchBox.o   \
	PrimitiveB.o \
	SlopeBox.o   \
	StringBox.o  \
	THatBox.o    \
	TagBox.o     \
	TrueBox.o

# VSL library - building boxes from structured data
# Top-level class is `VSLLib', declared in `VSLLib.h'
VSL_OBJECTS = \
	ArgNode.o    \
	BuiltinCN.o  \
	CallNode.o   \
	ConstNode.o  \
	DefCallN.o   \
	DummyNode.o  \
	LetNode.o    \
	NameNode.o   \
	ListNode.o   \
	TestNode.o   \
	TrueNode.o   \
	VSEFlags.o   \
	VSLArgList.o \
	VSLBuiltin.o \
	VSLDef.o     \
	VSLDefList.o \
        VSLErr.o     \
	VSLLib.o     \
	VSLNode.o    \
        VSLRead.o

# Graph structure, graph layout and graph editor widget
# Top-level classes are `Graph', declared in `Graph.h'
# and the `GraphEdit' widget, deckared in `GraphEdit.h'.
GRAPH_OBJECTS = \
	ArcGraphE.o  \
	BoxEdgeA.o   \
	BoxGraphN.o  \
	EdgeA.o      \
	EdgeAPA.o    \
	Graph.o      \
	GraphEdge.o  \
	GraphEdit.o  \
	GraphGC.o    \
	GraphNode.o  \
	GraphNPA.o   \
	HintGraphN.o \
	LineGraphE.o \
	LineGESI.o   \
	PannedGE.o   \
	PosGraphN.o  \
	RegionGN.o   \
	ScrolledGE.o \
	layout.o

# All these objects were originally part of the NORA library; they are
# now maintained as part of DDD.
LIB_OBJECTS = \
	$(BASE_OBJECTS)   \
	$(TEMPLATE_OBJECTS)  \
	$(AGENT_OBJECTS)  \
	$(XSTUFF_OBJECTS) \
	$(BOX_OBJECTS)    \
	$(VSL_OBJECTS)    \
	$(GRAPH_OBJECTS)

# The DDD application itself.  `ddd.C' is the main program, `SourceView.C'
# is the source window, `DataDisp.C' is the data window.
DDD_OBJECTS = \
	annotation.o \
	args.o       \
	buttons.o    \
	cmdtty.o     \
	comm-manag.o \
	complete.o   \
	configinfo.o \
	ctrl.o       \
	data.o       \
	dbx-lookup.o \
	deref.o      \
	disp-read.o  \
	editing.o    \
	environ.o    \
	examine.o    \
	exectty.o    \
	exit.o       \
	expired.o    \
	file.o       \
	filetype.o   \
	fonts.o      \
	fortranize.o \
	gdbinit.o    \
	history.o    \
	hostname.o   \
	index.o      \
	isid.o       \
	java.o 	     \
	logo.o       \
	logplayer.o  \
	mainloop.o   \
	mydialogs.o  \
	options.o    \
	plotter.o    \
	post.o       \
	print.o      \
	question.o   \
	regexps.o    \
	resources.o  \
	sashes.o     \
	select.o     \
	session.o    \
	settings.o   \
	shell.o      \
	shorten.o    \
	show.o       \
	source.o     \
	status.o     \
	string-fun.o \
	tictactoe.o  \
	tips.o       \
	toolbar.o    \
	ungrab.o     \
	value-read.o \
	windows.o    \
	wm.o         \
	xconfig.o    \
	AliasGE.o    \
	ArgField.o   \
	BreakPoint.o \
	BreakPM.o    \
	CodeCache.o  \
	Command.o    \
	DataDisp.o   \
	DispBox.o    \
	DispBuffer.o \
	DispGraph.o  \
	DispNode.o   \
	DispNodeM.o  \
	DispValue.o  \
	DispValueA.o \
	DispValueT.o \
	EntryType.o  \
	GDBAgent.o   \
	HelpCB.o     \
	HistoryD.o   \
	HistoryF.o   \
	MinMaxA.o    \
	PlotAgent.o  \
	PlotArea.o   \
	PosBuffer.o  \
	ProgressM.o  \
	RefreshDI.o  \
	SmartC.o     \
	SourceView.o \
	UndoBuffer.o \
	UndoBE.o     \
	WhatNextCB.o

# Objects required for userinfo
USERINFO_OBJECTS =

# Objects required for huffencode and huffdecode
HUFFMAN_OBJECTS = strclass.o cook.o rxclass.o

## All objects.
OBJECTS = $(LIB_OBJECTS) $(DDD_OBJECTS)

## The program files.
PROGS = $(ddd_canonical)$(EXEEXT) $(ddd)$(EXEEXT)

## The program files to be installed.
INSTALL_PROGS = $(ddd)$(EXEEXT)

## Extra demonstration files.
DEMOS = userinfo$(EXEEXT) stringify$(EXEEXT) huffencode$(EXEEXT) \
	huffdecode$(EXEEXT) cxxtest$(EXEEXT) ctest$(EXEEXT) grabtest$(EXEEXT) \
	ftest$(EXEEXT) ptest$(EXEEXT) m2test$(EXEEXT) \
	test-file$(EXEEXT) test-graph$(EXEEXT) vsl$(EXEEXT) ttytest$(EXEEXT) \
	bug$(EXEEXT) tString$(EXEEXT) mmtest$(EXEEXT) gcore$(EXEEXT) \
	logplayer$(EXEEXT)

## Where to find texinfo files and so
MAKEINFO_FLAGS = \
	-I. -I$(srcdir) -I$(srcdir)/../readline/doc -I$(srcdir)/../texinfo

## The index files
IDXS = *.cp *.fn *.ky *.pg *.tp *.vr

## The dvi files.
DVIS =

## The postscript files.
PSS = $(srcdir)/../doc/ddd.man-nopics.ps $(srcdir)/../doc/ddd.man.ps

## PostScript pictures in the DDD manual.
# All of these are generated from FIG and XPM files.
picdir = $(srcdir)/PICS
PICS = \
	$(picdir)/dddsplash.ps          \
	$(picdir)/ddd-aliases.ps        \
	$(picdir)/ddd-all.ps            \
	$(picdir)/ddd-arguments.ps      \
	$(picdir)/ddd-attach.ps         \
	$(picdir)/ddd-backtrace.ps	\
	$(picdir)/ddd-bp-popup.ps       \
	$(picdir)/ddd-bp-properties.ps  \
	$(picdir)/ddd-button-editor.ps  \
	$(picdir)/ddd-clusters.ps       \
	$(picdir)/ddd-code.ps           \
	$(picdir)/ddd-console.ps        \
	$(picdir)/ddd-data-prefs.ps     \
	$(picdir)/ddd-define-command.ps \
	$(picdir)/ddd-display.ps        \
	$(picdir)/ddd-drag.ps           \
	$(picdir)/ddd-edit-breakpoints.ps \
	$(picdir)/ddd-edit-displays.ps  \
	$(picdir)/ddd-examine.ps        \
	$(picdir)/ddd-font-prefs.ps     \
	$(picdir)/ddd-general-prefs.ps  \
	$(picdir)/ddd-helpers.ps  	\
	$(picdir)/ddd-hide-display.ps   \
	$(picdir)/ddd-history.ps        \
	$(picdir)/ddd-layout.ps         \
	$(picdir)/ddd-line-popup.ps     \
	$(picdir)/ddd-locals.ps	        \
	$(picdir)/ddd-open.ps           \
	$(picdir)/ddd-open-session.ps   \
	$(picdir)/ddd-plots.ps          \
	$(picdir)/ddd-print-graph.ps    \
	$(picdir)/ddd-print-output.ps   \
	$(picdir)/ddd-print-popup.ps    \
	$(picdir)/ddd-registers.ps      \
	$(picdir)/ddd-repeats.ps        \
	$(picdir)/ddd-rotate-display.ps \
	$(picdir)/ddd-save-session.ps   \
	$(picdir)/ddd-select-display.ps \
	$(picdir)/ddd-separate.ps       \
	$(picdir)/ddd-set.ps	        \
	$(picdir)/ddd-settings.ps       \
	$(picdir)/ddd-shortcuts.ps      \
	$(picdir)/ddd-shortcut-editor.ps \
	$(picdir)/ddd-signals.ps        \
	$(picdir)/ddd-source-popup.ps   \
	$(picdir)/ddd-source-prefs.ps   \
	$(picdir)/ddd-source.ps         \
	$(picdir)/ddd-startup-prefs.ps  \
	$(picdir)/ddd-status-displays.ps \
	$(picdir)/ddd-threads.ps        \
	$(picdir)/ddd-tool.ps           \
	$(picdir)/ddd-toolbar.ps        \
	$(picdir)/ddd-toolbars.ps       \
	$(picdir)/ddd-value-tip.ps      \
	$(picdir)/disclaimer.ps

## The HTML files.
# HTML_BASES = ddd_toc.html dddint_toc.html
# HTML_PATTERNS = $(srcdir)/ddd_*.html $(srcdir)/dddint_*.html
# HTMLS = $(HTML_BASES) $(HTML_PATTERNS)
HTMLS = 

## The manual page.
MANS = ddd.man

## The (derived) icons.
# Icon directories
icondir = $(srcdir)/../icons
toolbardir = $(icondir)/toolbar

# XBM icons are derived from XPM sources
XBM_ICONS = \
	$(toolbardir)/breakat.xbm \
	$(toolbardir)/clearat.xbm \
	$(toolbardir)/delete.xbm \
	$(toolbardir)/deref.xbm \
	$(toolbardir)/disable.xbm \
	$(toolbardir)/display.xbm \
	$(toolbardir)/findbwd.xbm \
	$(toolbardir)/findfwd.xbm \
	$(toolbardir)/enable.xbm \
	$(toolbardir)/hide.xbm \
	$(toolbardir)/lookup.xbm \
	$(toolbardir)/maketemp.xbm \
	$(toolbardir)/newbreak.xbm \
	$(toolbardir)/newdisplay.xbm \
	$(toolbardir)/newwatch.xbm \
	$(toolbardir)/plot.xbm \
	$(toolbardir)/print.xbm \
	$(toolbardir)/properties.xbm \
	$(toolbardir)/rotate.xbm \
	$(toolbardir)/set.xbm \
	$(toolbardir)/show.xbm \
	$(toolbardir)/undisplay.xbm \
	$(toolbardir)/unwatch.xbm \
	$(toolbardir)/watch.xbm 

# XPMXX icons (insensitive XPM icons) are derived from XBM sources
XPM_XX_ICONS = \
	$(toolbardir)/breakat.xpmxx \
	$(toolbardir)/clearat.xpmxx \
	$(toolbardir)/delete.xpmxx \
	$(toolbardir)/deref.xpmxx \
	$(toolbardir)/disable.xpmxx \
	$(toolbardir)/display.xpmxx \
	$(toolbardir)/findbwd.xpmxx \
	$(toolbardir)/findfwd.xpmxx \
	$(toolbardir)/enable.xpmxx \
	$(toolbardir)/hide.xpmxx \
	$(toolbardir)/lookup.xpmxx \
	$(toolbardir)/maketemp.xpmxx \
	$(toolbardir)/newbreak.xpmxx \
	$(toolbardir)/newdisplay.xpmxx \
	$(toolbardir)/newwatch.xpmxx \
	$(toolbardir)/plot.xpmxx \
	$(toolbardir)/print.xpmxx \
	$(toolbardir)/properties.xpmxx \
	$(toolbardir)/rotate.xpmxx \
	$(toolbardir)/set.xpmxx \
	$(toolbardir)/show.xpmxx \
	$(toolbardir)/undisplay.xpmxx \
	$(toolbardir)/unwatch.xpmxx \
	$(toolbardir)/watch.xpmxx 

# XBMXX icons (insensitive XBM icons) are derived from XPM sources
XBM_XX_ICONS = \
	$(toolbardir)/breakat.xbmxx \
	$(toolbardir)/clearat.xbmxx \
	$(toolbardir)/delete.xbmxx \
	$(toolbardir)/deref.xbmxx \
	$(toolbardir)/disable.xbmxx \
	$(toolbardir)/display.xbmxx \
	$(toolbardir)/findbwd.xbmxx \
	$(toolbardir)/findfwd.xbmxx \
	$(toolbardir)/enable.xbmxx \
	$(toolbardir)/hide.xbmxx \
	$(toolbardir)/lookup.xbmxx \
	$(toolbardir)/maketemp.xbmxx \
	$(toolbardir)/newbreak.xbmxx \
	$(toolbardir)/newdisplay.xbmxx \
	$(toolbardir)/newwatch.xbmxx \
	$(toolbardir)/plot.xbmxx \
	$(toolbardir)/print.xbmxx \
	$(toolbardir)/properties.xbmxx \
	$(toolbardir)/rotate.xbmxx \
	$(toolbardir)/set.xbmxx \
	$(toolbardir)/show.xbmxx \
	$(toolbardir)/undisplay.xbmxx \
	$(toolbardir)/unwatch.xbmxx \
	$(toolbardir)/watch.xbmxx

# All derived icons
# Order is significant here!  First sources, then derived files.
ICONS = \
	$(icondir)/ddd.xbm \
	$(icondir)/dddmask.xbm \
	$(icondir)/dddsplash.xbm \
	$(icondir)/ddd.xface \
	$(XBM_ICONS) \
	$(XPM_XX_ICONS) \
	$(XBM_XX_ICONS)


## Readme files built from ddd.texinfo
README_FILES = 

## GDB symbol files
SYMS = $(ddd).syms $(ddd_canonical).syms


## Intermediate files

# Architecture-independent files required for building DDD.
# In a distribution, these should be already built.
#
# Order is significant here!  First source files, then derived files.
PROG_STUFF       = vsl-lex.C vsl-gramma.h vsl-gramma.C rxscan.C \
	 	   acconfig.h acspecial.h stamp-h.in config.h \
		   $(srcdir)/tips.m4 $(srcdir)/tips.html \
		   $(srcdir)/Ddd.in Ddd.ad.h host.h \
		   $(srcdir)/ddd.vsl $(srcdir)/ddd.vsl.h \
		   vr.h version.h configinfo.C \
		   ddd.1 ddd.man.txt ddd.man.txt.gz ddd.man.txt.gz.C \
                   COPYING.gz.C NEWS.gz.C xlibdir.C eps-code.h .gdbinit

# Extra files to be built for the distribution
# In a distribution, these should be already built.
DIST_STUFF	 = $(PROG_STUFF) $(MANS) $(PSS) $(ICONS)

# Temporary Files to be cleaned, keeping configuration intact
CLEAN_STUFF	 = $(ddd)-$(VERSION)-* $(PROGS) $(DEMOS) \
		   core *.o *.a *.s *.i \
		   tmp* *.tmp .*hist* *.syms *.log dddgraph.* \
		   *.aux *.cp *.cps *.fn *.fns *.flc \
		   *.ky *.kys *.log *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs \
		   *.tar *.tar.gz *~ lex.* y.tab.* site.* *.sum \
		   *.diff *.private USERINFO *.huff.C \
		   *.txt.gz COPYING.gz NEWS.gz *.gz.C

# Architecture-dependent files to be deleted from distribution
DISTCLEAN_STUFF	 = $(CLEAN_STUFF) \
		   config.status config.h host.h paths.h \
		   Makefile MakeOut LOG OOBR OOBR-FTR TAGS \
		   config.log config.cache configinfo.C stamp-h \
		   Ddd Ddd.ad.h ddd.man-nopics $(PICS)

# Any files that can be reconstructed, except configure script
REALCLEAN_STUFF	 = $(DISTCLEAN_STUFF) $(DIST_STUFF) \
		   header.str trailer.str eps-code.h vr.h $(MANS)

# All files that can be reconstructed (but may require special programs)
ULTRACLEAN_STUFF = $(REALCLEAN_STUFF) \
		   config.h.in stamp-h.in configure Makedeps \
		   $(README_FILES) $(HTMLS) $(srcdir)/Ddd.in


## Targets as specified in GNU standards.
all:	ddd-message $(PROG_STUFF) $(PROGS) ddd-done
	@:
.PHONY: all

.PHONY: ddd-message
ddd-message:
	@$(ECHO) "Building $(ddd_canonical)..."

.PHONY: ddd-done
ddd-done: $(ddd)$(EXEEXT)
	@$(ECHO) "Building $(ddd_canonical)... done."
	@$(ECHO) "You may now type \`$(MAKE) check' for a test."

.PHONY: install
install: install-prog install-man
	@:

.PHONY: install-strip
install-strip:
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install

.PHONY: uninstall
uninstall: uninstall-prog uninstall-man
	@:

# install-prog does not depend on $(PROGS) 
# since we may have precompiled packages
.PHONY: install-prog
install-prog:
	-parent=`$(ECHO) $(bindir) | $(SED) -e 's@/[^/]*$$@@'`; \
	grandparent=`$(ECHO) $$parent | $(SED) -e 's@/[^/]*$$@@'`; \
	test -d $$grandparent || $(MKDIR) $$grandparent; \
	test -d $$parent || $(MKDIR) $$parent
	-test -d $(bindir) || $(MKDIR) $(bindir)
	for p in $(INSTALL_PROGS); do \
	    $(INSTALL_PROGRAM) \
		$$p $(bindir)/`$(ECHO) $$p | $(SED) '$(transform)'`; \
	done

.PHONY: uninstall-prog
uninstall-prog:
	for p in $(INSTALL_PROGS); do \
	    $(RM) $(bindir)/`$(ECHO) $$p | $(SED) '$(transform)'`; \
	done

.PHONY: install-info
install-info: $(INFO_BASES)
	-parent=`$(ECHO) $(infodir) | $(SED) -e 's@/[^/]*$$@@'`; \
	grandparent=`$(ECHO) $$parent | $(SED) -e 's@/[^/]*$$@@'`; \
	test -d $$grandparent || $(MKDIR) $$grandparent; \
	test -d $$parent || $(MKDIR) $$parent
	-test -d $(infodir) || $(MKDIR) $(infodir)
	for i in $(INFOS); do \
	    test -s $$i && $(INSTALL_DATA) $$i $(infodir); \
	done

.PHONY: uninstall-info
uninstall-info:
	cd $(infodir); $(RM) $(INFOS)

.PHONY: install-man
install-man: ddd.1
	-parent=`$(ECHO) $(man1dir) | $(SED) -e 's@/[^/]*$$@@'`; \
	grandparent=`$(ECHO) $$parent | $(SED) -e 's@/[^/]*$$@@'`; \
	test -d $$grandparent || $(MKDIR) $$grandparent; \
	test -d $$parent || $(MKDIR) $$parent
	-test -d $(man1dir) || $(MKDIR) $(man1dir)
	test -f ddd.1 || cd $(srcdir); \
	$(INSTALL_DATA) ddd.1 \
		$(man1dir)/`$(ECHO) ddd$(man1ext) | $(SED) '$(transform)'`

.PHONY: uninstall-man
uninstall-man:
	$(RM) $(man1dir)/`$(ECHO) ddd$(man1ext) | $(SED) '$(transform)'`

.PHONY: picsclean
picsclean:
	$(RM) $(PICS) ./#*#
	-cd $(picdir) && $(RM) $(CLEAN_STUFF) ./#*#

.PHONY: iconclean
iconclean:
	$(RM) $(ICONS) ./#*#
	-cd $(icondir) && $(RM) $(CLEAN_STUFF) ./#*#
	-cd $(toolbardir) && $(RM) $(CLEAN_STUFF) ./#*#

.PHONY: clean
clean:
	$(RM) $(CLEAN_STUFF) ./#*#
	-cd $(picdir) && $(RM) $(CLEAN_STUFF) ./#*#

.PHONY: distclean
distclean:
	$(RM) $(DISTCLEAN_STUFF) ./#*#

.PHONY: mostlyclean
mostlyclean: clean
	@:

.PHONY: realclean maintainer-clean
realclean maintainer-clean:
	@echo 'This command is intended for maintainers to use; it'
	@echo 'deletes files that may need special tools to rebuild.'
	$(RM) $(REALCLEAN_STUFF) ./#*#

.PHONY: ultraclean
ultraclean:
	@echo 'This command is intended for maintainers to use; it'
	@echo 'deletes files that may need special tools to rebuild.'
	$(RM) $(ULTRACLEAN_STUFF) ./#*#

.PHONY: info
info:	$(INFO_BASES)
	@:

.PHONY: dvi
dvi:	$(DVIS)
	@:

.PHONY: ps
ps:	$(PSS)
	@:

.PHONY: man
man:	$(MANS)
	@:

.PHONY: postscript
postscript: $(PSS)
	@:

.PHONY: html
html:	$(HTML_BASES)
	@:

.PHONY: readme
readme:	$(README_FILES)
	@:

.PHONY: diststuff
diststuff: $(DIST_STUFF)
	-for file in $(DIST_STUFF); do test -f $$file && $(TOUCH) $$file; done
	$(MAKE) depend

.PHONY: dist
dist:	
	@$(ECHO) see the top-level directory for making dist files.
	@false

.PHONY: strip
strip:	$(PROGS)
	-$(STRIP) $(PROGS)

.PHONY: progs programs
progs:	$(PROGS)
	@:
programs: $(PROGS)
	@:

.PHONY: demos
demos:	$(DEMOS)
	@:


## A TECO-ism: `make love'

.PHONY: love
love:
	@$(ECHO) 'not war?'


## Another joke: `make money fast'

.PHONY: money fast
money:
	@$(ECHO) '$$1,000,000'
fast:
	@:


## A joke.
# Newsgroups: rec.humor.funny.reruns
# From: sater@cs.vu.nl (Hans van Staveren)
# Subject: Good news and bad news
# Approved: rhf-reruns@clari.net
# Keywords: heard it, funny, originally appeared in second quarter, 1990
# Message-ID: <Sba5.2ff7@clarinet.com>
# Date: Tue, 14 Oct 97 19:20:05 EDT
# Lines: 20
# Xref: news.tu-bs.de rec.humor.funny.reruns:535
#
# From the RHF archives as selected by Brad Templeton, Maddi Hausmann
# and Jim Griffith.  This newsgroup posts former jokes from the
# newsgroup rec.humor.funny.  Visit http://comedy.clari.net/rhf to
# browse the RHF pages and archives on the web.

.PHONY: joke fun
joke fun:
	@$(ECHO)
	@$(ECHO)
	@$(ECHO)
	@$(ECHO) 'A man gets a telephone call from a doctor. The doctor says:'
	@$(ECHO) ' "About this medical test I did on you, I have some good news'
	@$(ECHO) '  and some bad news."'
	@$(SLEEP) 5
	@$(ECHO)
	@$(ECHO) 'The man asks for the good news first:'
	@$(ECHO) 
	@$(SLEEP) 2
	@$(ECHO) ' "The good news is that you have 24 hours to live", says the doctor.'
	@$(SLEEP) 3
	@$(ECHO)
	@$(ECHO) 'The man, incredulously:'
	@$(ECHO) ' "If that is the good news, then what is the bad news??"'
	@$(SLEEP) 4
	@$(ECHO)
	@$(ECHO) ' "I couldn'\''t reach you on the phone yesterday."'


## FORCE target

.PHONY: FORCE
FORCE:
	@:


## The resource header and app-default files.

Ddd.ad.h: Ddd $(srcdir)/ad2c.sed
	$(AD2C) Ddd > $@~ && $(MV) $@~ $@

$(srcdir)/Ddd.in: $(srcdir)/Ddd.in.m4 $(srcdir)/tips.m4 \
	$(srcdir)/macros.m4 $(srcdir)/colors.m4 
	( \
	( \
		echo "define(srcdir, \`$(srcdir)')dnl"; \
		echo "include(srcdir()/Ddd.in.m4)dnl" \
	) | $(M4); \
        ( \
		echo "define(srcdir, \`$(srcdir)')dnl"; \
		echo "include(srcdir()/tips.m4)dnl" \
	) | $(M4); \
	) > $@~ && $(MV) $@~ $@


## The VSL header files.

VSLDIR  = $(srcdir)/../vsllib

VSL_CPP = $(CPP) -I$(VSLDIR) -I$(prefix)/lib/vsl-include

VSLSOURCES = \
	$(VSLDIR)/std.vsl \
	$(VSLDIR)/builtin.vsl \
	$(VSLDIR)/tab.vsl \
	$(VSLDIR)/fonts.vsl \
	$(VSLDIR)/colors.vsl

$(srcdir)/ddd.vsl.h: $(srcdir)/ddd.vsl $(srcdir)/vsl2c.sed $(VSLSOURCES)
	$(CAT) $(srcdir)/ddd.vsl > tmp.c
	$(VSL_CPP) tmp.c | $(VSL2C) > $@
	$(RM) tmp.c

$(srcdir)/ddd.vsl: $(srcdir)/ddd.vsl.m4 $(srcdir)/colors.m4
	( \
		echo "define(srcdir, \`$(srcdir)')dnl"; \
		echo "include(srcdir()/ddd.vsl.m4)dnl" \
	) | $(M4) > $@~ && $(MV) $@~ $@


## The TIPS files.

.PHONY: tips

tips: $(srcdir)/tips.m4 $(srcdir)/tips.html

$(srcdir)/tips.m4: $(srcdir)/../TIPS $(srcdir)/tips2m4.awk
	$(AWK) -f $(srcdir)/tips2m4.awk $(srcdir)/../TIPS > $@~ && $(MV) $@~ $@

$(srcdir)/tips.html: $(srcdir)/../TIPS
	( \
		echo "define(srcdir, \`$(srcdir)')dnl"; \
		echo "define(macros, \`$(srcdir)/html.m4')dnl"; \
		echo "include(srcdir()/../TIPS)dnl" \
	) | $(M4) | $(AWK) -f $(srcdir)/tips2html.awk | \
	$(SED) 's/\\133/\[/g' | $(SED) 's/\\135/\]/g' | \
	$(SED) 's/@\([A-Z][A-Z]*\)@/\1/g' | $(SED) 's/@ /@/g' \
	> $@~ && $(MV) $@~ $@


# `make depend' fails to find this dependency :-(
DispBox.o: ddd.vsl.h

# And these are never computed:
ddd.vsl.h: $(srcdir)/../vsllib/std.vsl
ddd.vsl.h: $(srcdir)/../vsllib/fonts.vsl
ddd.vsl.h: $(srcdir)/../vsllib/colors.vsl
ddd.vsl.h: $(srcdir)/../vsllib/builtin.vsl
ddd.vsl.h: $(srcdir)/../vsllib/tab.vsl


## The programs.

$(ddd)$(EXEEXT): $(ddd_canonical)$(EXEEXT)
	$(RM) $@ $(SYMS); $(LN_S) $(ddd_canonical)$(EXEEXT) $@

$(ddd_canonical)$(EXEEXT): ddd.o $(OBJECTS)
	$(LINK.cc) -o $@ ddd.o $(OBJECTS) $(ALL_X_LIBS) $(LIBS)


## The demonstration programs.

userinfo$(EXEEXT): userinfo.o $(USERINFO_OBJECTS)
	-$(LINK.cc) -o $@ userinfo.o $(USERINFO_OBJECTS) $(NON_X_LIBS) $(LIBS)

rxtest$(EXEEXT): rxtest.o $(HUFFMAN_OBJECTS)
	-$(LINK.cc) -o $@ rxtest.o $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

huffencode$(EXEEXT): huffencode.o $(HUFFMAN_OBJECTS)
	$(LINK.cc) -o $@ huffencode.o $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

huffdecode$(EXEEXT): huffdecode.o $(HUFFMAN_OBJECTS)
	$(LINK.cc) -o $@ huffdecode.o $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

stringify$(EXEEXT): stringify.o
	$(LINK.cc) -o $@ stringify.o $(LIBS)

mmtest$(EXEEXT): mmtest.o $(LIB_OBJECTS) 
	$(LINK.cc) -o $@ mmtest.o $(LIB_OBJECTS) $(ALL_X_LIBS) $(LIBS)

gcore$(EXEEXT): gcore.o $(HUFFMAN_OBJECTS)
	$(LINK.cc) -o $@ gcore.o $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

logplayer$(EXEEXT): $(srcdir)/logplayer.C $(HUFFMAN_OBJECTS)
	$(COMPILE_AND_LINK.cc) -DMAIN $(INCLUDE) -o $@ \
	$(srcdir)/logplayer.C $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

test-file$(EXEEXT): test-file.o
	$(LINK.cc) -o $@ test-file.o $(ALL_X_LIBS)

test-graph$(EXEEXT): test-graph.o $(LIB_OBJECTS) 
	$(LINK.cc) -o $@ test-graph.o $(LIB_OBJECTS) $(ALL_X_LIBS) $(LIBS)

vsl$(EXEEXT):	vsl.o DocSpace.o $(LIB_OBJECTS)
	$(LINK.cc) -o $@ vsl.o DocSpace.o $(LIB_OBJECTS) $(ALL_X_LIBS) $(LIBS)

ttytest$(EXEEXT): ttytest.o $(BASE_OBJECTS) $(AGENT_OBJECTS)
	$(LINK.cc) -o $@ ttytest.o $(BASE_OBJECTS) $(AGENT_OBJECTS) \
	$(ALL_X_LIBS) $(LIBS)

bug$(EXEEXT):	bug.o
	$(LINK.cc) -o $@ bug.o $(LIBS)

tString$(EXEEXT): tString.o  $(HUFFMAN_OBJECTS)
	$(LINK.cc) -o $@ tString.o $(HUFFMAN_OBJECTS) $(NON_X_LIBS) $(LIBS)

cxxtest$(EXEEXT): cxxtest.o
	$(LINK.cc) -o $@ cxxtest.o $(LIBS)

grabtest$(EXEEXT): grabtest.o
	$(LINK.cc) -o $@ grabtest.o $(ALL_X_LIBS) $(LIBS)

ctest$(EXEEXT):  ctest.o
	$(LINK.c) -o $@ ctest.o

ptest$(EXEEXT):  ptest.o
	$(LINK.p) -o $@ ptest.o

m2test$(EXEEXT): $(srcdir)/m2test.mod
	$(COMPILE_AND_LINK.m2) -o $@ -e $@ $(srcdir)/m2test.mod \
	-lmodula2 -ltermcap

ftest$(EXEEXT):	ftest.o
	$(LINK.f) -o $@ ftest.o

.PHONY: jtest
jtest: 	
	cd $(srcdir)/jtest; $(MAKE) jtest

swallow$(EXEEXT): swallow.o findWindow.o Swallower.o
	$(LINK.cc) -o $@ swallow.o findWindow.o Swallower.o \
	$(ALL_X_LIBS) $(LIBS)

# We don't want no optimizing, but debugging info in our test files
cxxtest.o: $(srcdir)/cxxtest.C
	$(CXX) $(INCLUDE) @CXXDEBUG@ -c -o $@ $(srcdir)/cxxtest.C

ctest.o: $(srcdir)/ctest.c
	$(CC) $(INCLUDE) -g -c -o $@ $(srcdir)/ctest.c

grabtest.o: $(srcdir)/grabtest.C
	$(CXX) $(X_INCLUDE) @CXXDEBUG@ -c -o $@ $(srcdir)/grabtest.C

bug.o:	$(srcdir)/bug.C
	$(CXX) $(INCLUDE) @CXXDEBUG@ -c -o $@ $(srcdir)/bug.C

huffdecode.o: $(srcdir)/huffdecode.C ddd.man.huff.C
	$(COMPILE.cc) -DMAIN -DHUFFTEXT='"$(srcdir)/ddd.man.huff.C"' \
	$(INCLUDE) -o $@ $(srcdir)/huffdecode.C

ftest.o: $(srcdir)/ftest.f
	$(COMPILE.f) -c -o $@ $(srcdir)/ftest.f


## For demonstration and debugging purposes
.PHONY: check
check: Ddd $(ddd)$(EXEEXT) cxxtest$(EXEEXT)
	XUSERFILESEARCHPATH=. XAPPLRESDIR=. ./ddd $(DDD_OPTIONS) cxxtest$(EXEEXT)

.PHONY: debug
debug: Ddd $(ddd)$(EXEEXT) cxxtest$(EXEEXT) .gdbinit $(ddd).syms
	$(DEBUGGER) ./$(ddd)

$(ddd).syms: $(ddd_canonical).syms
	$(RM) $@; $(LN_S) $(ddd_canonical).syms $@

$(ddd_canonical).syms: $(ddd_canonical)$(EXEEXT)
	nice $(DEBUGGER) -batch -nx -mapped -readnow $(ddd_canonical)$(EXEEXT)

.PHONY: syms
syms:   $(ddd).syms
	@:



# Create useful stuff in background
.PHONY: stuff
stuff:  $(ddd)$(EXEEXT)
	$(MAKE) $(ddd).syms > make.log 2>&1 &
	@:

# A convient target for setting up a debugging environment.
.PHONY: it
it:	all cxxtest$(EXEEXT) ctest$(EXEEXT) stuff
	@:



## Lex and Yacc stuff.

# VSL parsers.
vsl-lex.C: $(srcdir)/vsl-lex.L
	$(LEX.L) $(srcdir)/vsl-lex.L
	$(LEXTOCXX) -prefix vsl
	$(MV) $(LEX_OUTPUT_ROOT).C $@
	$(RM) $(LEX_OUTPUT_ROOT).c

vsl-gramma.h vsl-gramma.C: $(srcdir)/vsl-gramma.Y
	$(YACC.Y) -d $(srcdir)/vsl-gramma.Y
	$(YACCTOCXX) -prefix vsl
	$(MV) y.tab.H vsl-gramma.h
	$(MV) y.tab.C vsl-gramma.C
	$(RM) y.tab.c y.tab.h

# DDD regexp parsers.
rxscan.C: $(srcdir)/rxscan.L
	$(LEX.L) $(srcdir)/rxscan.L
	$(LEXTOCXX) -prefix ddd
	$(MV) $(LEX_OUTPUT_ROOT).C $@
	$(RM) $(LEX_OUTPUT_ROOT).c

# `make depend' fails to find these dependencies :-(
VSLRead.o: vsl-lex.C vsl-gramma.h vsl-gramma.C
regexps.o: rxscan.C


## The manual page in PostScript format, including all pictures.

$(srcdir)/../doc/ddd.man.ps: ddd.man $(PICS)
	$(GROFF) -man ddd.man > $@~ && $(MV) $@~ $@

$(srcdir)/../doc/ddd.man-nopics.ps: ddd.man-nopics
	$(GROFF) -man ddd.man-nopics > $@~ && $(MV) $@~ $@

$(picdir)/ddd-all.ps: \
	$(picdir)/ddd-all.fig $(picdir)/ddd-all.xpm
	cd $(picdir); $(FIG2PS) ddd-all.fig > ddd-all.ps

$(picdir)/ddd-console.ps: \
	$(picdir)/ddd-console.fig $(picdir)/ddd-console.xpm
	cd $(picdir); $(FIG2PS) ddd-console.fig > ddd-console.ps

$(picdir)/ddd-history.ps: \
	$(picdir)/ddd-history.fig $(picdir)/ddd-history.xpm
	cd $(picdir); $(FIG2PS) ddd-history.fig > ddd-history.ps

$(picdir)/ddd-open.ps: \
	$(picdir)/ddd-open.fig $(picdir)/ddd-open.xpm
	cd $(picdir); $(FIG2PS) ddd-open.fig > ddd-open.ps

$(picdir)/ddd-source.ps: \
	$(picdir)/ddd-source.fig $(picdir)/ddd-source.xpm
	cd $(picdir); $(FIG2PS) ddd-source.fig > ddd-source.ps

$(picdir)/ddd-line-popup.ps: \
	$(picdir)/ddd-line-popup.fig $(picdir)/ddd-line-popup.xpm
	cd $(picdir); $(FIG2PS) ddd-line-popup.fig > ddd-line-popup.ps

$(picdir)/ddd-bp-popup.ps: \
	$(picdir)/ddd-bp-popup.fig $(picdir)/ddd-bp-popup.xpm
	cd $(picdir); $(FIG2PS) ddd-bp-popup.fig > ddd-bp-popup.ps

$(picdir)/ddd-source-popup.ps: \
	$(picdir)/ddd-source-popup.fig $(picdir)/ddd-source-popup.xpm
	cd $(picdir); $(FIG2PS) ddd-source-popup.fig > ddd-source-popup.ps

$(picdir)/ddd-arguments.ps: \
	$(picdir)/ddd-arguments.fig $(picdir)/ddd-arguments.xpm
	cd $(picdir); $(FIG2PS) ddd-arguments.fig > ddd-arguments.ps

$(picdir)/ddd-tool.ps: $(picdir)/ddd-tool.fig $(picdir)/ddd-tool.xpm
	cd $(picdir); $(FIG2PS) ddd-tool.fig > ddd-tool.ps

$(picdir)/ddd-backtrace.ps: \
	$(picdir)/ddd-backtrace.fig $(picdir)/ddd-backtrace.xpm
	cd $(picdir); $(FIG2PS) ddd-backtrace.fig > ddd-backtrace.ps

$(picdir)/ddd-value-tip.ps: \
	$(picdir)/ddd-value-tip.fig $(picdir)/ddd-value-tip.xpm
	cd $(picdir); $(FIG2PS) ddd-value-tip.fig > ddd-value-tip.ps

$(picdir)/ddd-print-popup.ps: \
	$(picdir)/ddd-print-popup.fig $(picdir)/ddd-print-popup.xpm
	cd $(picdir); $(FIG2PS) ddd-print-popup.fig > ddd-print-popup.ps

$(picdir)/ddd-select-display.ps: \
	$(picdir)/ddd-select-display.fig $(picdir)/ddd-select-display.xpm
	cd $(picdir); $(FIG2PS) ddd-select-display.fig > ddd-select-display.ps

$(picdir)/ddd-hide-display.ps: \
	$(picdir)/ddd-hide-display.fig $(picdir)/ddd-hide-display.xpm
	cd $(picdir); $(FIG2PS) ddd-hide-display.fig > ddd-hide-display.ps

$(picdir)/ddd-rotate-display.ps: \
	$(picdir)/ddd-rotate-display.fig $(picdir)/ddd-rotate-display.xpm
	cd $(picdir); $(FIG2PS) ddd-rotate-display.fig > ddd-rotate-display.ps

$(picdir)/ddd-locals.ps: \
	$(picdir)/ddd-locals.fig $(picdir)/ddd-locals.xpm
	cd $(picdir); $(FIG2PS) ddd-locals.fig > ddd-locals.ps

$(picdir)/ddd-status-displays.ps: \
	$(picdir)/ddd-status-displays.fig $(picdir)/ddd-status-displays.xpm
	cd $(picdir); $(FIG2PS) ddd-status-displays.fig > ddd-status-displays.ps

$(picdir)/ddd-set.ps: \
	$(picdir)/ddd-set.fig $(picdir)/ddd-set.xpm
	cd $(picdir); $(FIG2PS) ddd-set.fig > ddd-set.ps

$(picdir)/ddd-layout.ps: \
	$(picdir)/ddd-layout.fig $(picdir)/ddd-layout.xpm
	cd $(picdir); $(FIG2PS) ddd-layout.fig > ddd-layout.ps

$(picdir)/ddd-print-graph.ps: \
	$(picdir)/ddd-print-graph.fig $(picdir)/ddd-print-graph.xpm
	cd $(picdir); $(FIG2PS) ddd-print-graph.fig > ddd-print-graph.ps

$(picdir)/ddd-print-output.ps: \
	$(picdir)/ddd-print-output.fig $(picdir)/ddd-graph.eps
	cd $(picdir); $(FIG2PS) ddd-print-output.fig > ddd-print-output.ps

$(picdir)/ddd-code.ps: \
	$(picdir)/ddd-code.fig $(picdir)/ddd-code.xpm
	cd $(picdir); $(FIG2PS) ddd-code.fig > ddd-code.ps

$(picdir)/ddd-registers.ps: \
	$(picdir)/ddd-registers.fig $(picdir)/ddd-registers.xpm
	cd $(picdir); $(FIG2PS) ddd-registers.fig > ddd-registers.ps

$(picdir)/ddd-general-prefs.ps: \
	$(picdir)/ddd-general-prefs.fig $(picdir)/ddd-general-prefs.xpm 
	cd $(picdir); $(FIG2PS) ddd-general-prefs.fig > ddd-general-prefs.ps

$(picdir)/ddd-helpers.ps: \
	$(picdir)/ddd-helpers.fig $(picdir)/ddd-helpers.xpm 
	cd $(picdir); $(FIG2PS) ddd-helpers.fig > ddd-helpers.ps

$(picdir)/ddd-source-prefs.ps: \
	$(picdir)/ddd-source-prefs.fig $(picdir)/ddd-source-prefs.xpm
	cd $(picdir); $(FIG2PS) ddd-source-prefs.fig > ddd-source-prefs.ps

$(picdir)/ddd-data-prefs.ps: \
	$(picdir)/ddd-data-prefs.fig $(picdir)/ddd-data-prefs.xpm
	cd $(picdir); $(FIG2PS) ddd-data-prefs.fig > ddd-data-prefs.ps

$(picdir)/ddd-startup-prefs.ps: \
	$(picdir)/ddd-startup-prefs.fig $(picdir)/ddd-startup-prefs.xpm
	cd $(picdir); $(FIG2PS) ddd-startup-prefs.fig > ddd-startup-prefs.ps

$(picdir)/ddd-settings.ps: \
	$(picdir)/ddd-settings.fig $(picdir)/ddd-settings.xpm
	cd $(picdir); $(FIG2PS) ddd-settings.fig > ddd-settings.ps

$(picdir)/ddd-threads.ps: \
	$(picdir)/ddd-threads.fig $(picdir)/ddd-threads.xpm
	cd $(picdir); $(FIG2PS) ddd-threads.fig > ddd-threads.ps

$(picdir)/ddd-aliases.ps: \
	$(picdir)/ddd-aliases.fig $(picdir)/ddd-aliases.xpm
	cd $(picdir); $(FIG2PS) ddd-aliases.fig > ddd-aliases.ps

$(picdir)/ddd-edit-displays.ps: \
	$(picdir)/ddd-edit-displays.fig $(picdir)/ddd-edit-displays.xpm
	cd $(picdir); $(FIG2PS) ddd-edit-displays.fig > ddd-edit-displays.ps

$(picdir)/ddd-attach.ps: \
	$(picdir)/ddd-attach.fig $(picdir)/ddd-attach.xpm
	cd $(picdir); $(FIG2PS) ddd-attach.fig > ddd-attach.ps

$(picdir)/ddd-save-session.ps: \
	$(picdir)/ddd-save-session.fig $(picdir)/ddd-save-session.xpm
	cd $(picdir); $(FIG2PS) ddd-save-session.fig > ddd-save-session.ps

$(picdir)/ddd-open-session.ps: \
	$(picdir)/ddd-open-session.fig $(picdir)/ddd-open-session.xpm
	cd $(picdir); $(FIG2PS) ddd-open-session.fig > ddd-open-session.ps

$(picdir)/ddd-button-editor.ps: \
	$(picdir)/ddd-button-editor.fig $(picdir)/ddd-button-editor.xpm
	cd $(picdir); $(FIG2PS) ddd-button-editor.fig > ddd-button-editor.ps

$(picdir)/ddd-shortcuts.ps: \
	$(picdir)/ddd-shortcuts.fig $(picdir)/ddd-shortcuts.xpm
	cd $(picdir); $(FIG2PS) ddd-shortcuts.fig > ddd-shortcuts.ps

$(picdir)/ddd-shortcut-editor.ps: \
	$(picdir)/ddd-shortcut-editor.fig $(picdir)/ddd-shortcut-editor.xpm
	cd $(picdir); $(FIG2PS) ddd-shortcut-editor.fig > ddd-shortcut-editor.ps

$(picdir)/ddd-drag.ps: \
	$(picdir)/ddd-drag.fig \
	$(picdir)/ddd-drag1.xpm $(picdir)/ddd-drag2.xpm $(picdir)/ddd-drag3.xpm
	cd $(picdir); $(FIG2PS) ddd-drag.fig > ddd-drag.ps

$(picdir)/disclaimer.ps: \
	$(picdir)/disclaimer.fig
	cd $(picdir); $(FIG2PS) disclaimer.fig > disclaimer.ps

$(picdir)/ddd-separate.ps: \
	$(picdir)/ddd-separate.fig $(picdir)/ddd-separate.xpm
	cd $(picdir); $(FIG2PS) ddd-separate.fig > ddd-separate.ps

$(picdir)/ddd-bp-properties.ps: \
	$(picdir)/ddd-bp-properties.fig $(picdir)/ddd-bp-properties.xpm
	cd $(picdir); $(FIG2PS) ddd-bp-properties.fig > ddd-bp-properties.ps

$(picdir)/ddd-edit-breakpoints.ps: \
	$(picdir)/ddd-edit-breakpoints.fig $(picdir)/ddd-edit-breakpoints.xpm
	cd $(picdir); $(FIG2PS) ddd-edit-breakpoints.fig > ddd-edit-breakpoints.ps

$(picdir)/ddd-display.ps: \
	$(picdir)/ddd-display.fig $(picdir)/ddd-display.xpm
	cd $(picdir); $(FIG2PS) ddd-display.fig > ddd-display.ps

$(picdir)/ddd-repeats.ps: \
	$(picdir)/ddd-repeats.fig $(picdir)/ddd-repeats.xpm
	cd $(picdir); $(FIG2PS) ddd-repeats.fig > ddd-repeats.ps

$(picdir)/ddd-toolbar.ps: $(picdir)/ddd-toolbar.fig $(picdir)/ddd-toolbar.xpm
	cd $(picdir); $(FIG2PS) ddd-toolbar.fig > ddd-toolbar.ps

$(picdir)/ddd-font-prefs.ps: \
	$(picdir)/ddd-font-prefs.fig $(picdir)/ddd-font-prefs.xpm
	cd $(picdir); $(FIG2PS) ddd-font-prefs.fig > ddd-font-prefs.ps

$(picdir)/ddd-define-command.ps: \
	$(picdir)/ddd-define-command.fig $(picdir)/ddd-define-command.xpm
	cd $(picdir); $(FIG2PS) ddd-define-command.fig > ddd-define-command.ps

$(picdir)/ddd-signals.ps: \
	$(picdir)/ddd-signals.fig $(picdir)/ddd-signals.xpm
	cd $(picdir); $(FIG2PS) ddd-signals.fig > ddd-signals.ps

$(picdir)/ddd-examine.ps: \
	$(picdir)/ddd-examine.fig $(picdir)/ddd-examine.xpm
	cd $(picdir); $(FIG2PS) ddd-examine.fig > ddd-examine.ps

$(picdir)/ddd-clusters.ps: \
	$(picdir)/ddd-clusters.fig \
	$(picdir)/clustered.ps \
	$(picdir)/unclustered.ps
	cd $(picdir); $(FIG2PS) ddd-clusters.fig > ddd-clusters.ps

$(picdir)/ddd-plots.ps: \
	$(picdir)/ddd-plots.fig $(picdir)/ddd-plots.xpm
	cd $(picdir); $(FIG2PS) ddd-plots.fig > ddd-plots.ps

$(picdir)/ddd-toolbars.ps: \
	$(picdir)/ddd-toolbars.fig \
	$(picdir)/ddd-toolbar-1.xpm \
	$(picdir)/ddd-toolbar-2.xpm \
	$(picdir)/ddd-toolbar-3.xpm \
	$(picdir)/ddd-toolbar-4.xpm
	cd $(picdir); $(FIG2PS) ddd-toolbars.fig > ddd-toolbars.ps


# The logo comes in XPM source
$(picdir)/dddsplash.ps: $(icondir)/dddsplash.xpm
	$(XPMTOPPM) $(icondir)/dddsplash.xpm | $(PNMDEPTH) 255 | \
	$(PNMTOPS) -noturn > $@~ && $(MV) $@~ $@


## Icons and logos.

.PHONY: icons
icons:	$(ICONS)
	@:

# All X bitmaps are derived from the XPM sources.

$(icondir)/dddmask.xpm: $(icondir)/ddd.xpm
	$(SED) 's/[wW]hite/black/g' $(icondir)/ddd.xpm > $@

$(icondir)/ddd.xbm: $(icondir)/ddd.xpm

$(icondir)/ddd.xface: $(icondir)/ddd.xbm

$(icondir)/dddmask.xbm: $(icondir)/dddmask.xpm

# Original filter for dddsplash to extract g4 info
# $(SED) 's/[	 ][cmg][ 	][#a-zA-Z0-9][#a-zA-Z0-9]*//g' | \

$(icondir)/dddsplash.xbm: $(icondir)/dddsplash.xpm
	@$(ECHO) "Creating $@"
	@-$(CAT) $(icondir)/dddsplash.xpm | \
	$(XPMTOPPM) | $(PNMDEPTH) 255 | $(PNMGAMMA) 0.4 | $(PPMTOPGM) | \
	$(PGMENHANCE) -7 | \
	$(PGMTOPBM) | $(PBMTOXBM) | $(SED) 's/noname/dddsplash/g' | \
	$(SED) "s/static char/static unsigned char/g" > $@~
	@test -s $@~ && $(MV) $@~ $@ || ($(RM) $@~; test -s $@)


## Configuration stuff.

Makefile: $(srcdir)/Makefile.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

Ddd: $(srcdir)/Ddd.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

.gdbinit: $(srcdir)/.gdbinit.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4
	-cd $(srcdir) && $(AUTOCONF)
config.status: $(srcdir)/configure
	-$(SHELL) ./config.status --recheck || $(SHELL) $(srcdir)/configure -v

$(srcdir)/aclocal.m4: $(srcdir)/configure.in $(srcdir)/acinclude.m4
	-cd $(srcdir) && $(ACLOCAL)

.PRECIOUS: Makefile configure config.status config.h Ddd

# autoheader might not change config.h.in
$(srcdir)/config.h.in: stamp-h.in
$(srcdir)/stamp-h.in: \
	$(srcdir)/configure.in \
	$(srcdir)/aclocal.m4 \
	$(srcdir)/acconfig.h
	cd $(srcdir) && $(AUTOHEADER)
	$(DATE) > $@~ && $(MV) $@~ $@

$(srcdir)/acconfig.h: $(srcdir)/acconfig.h.in $(srcdir)/acspecial.h
	( \
		echo "define(srcdir, \`$(srcdir)')dnl"; \
		echo "include(srcdir()/acconfig.h.in)dnl" \
	) | $(M4) > $@~ && $(MV) $@~ $@

$(srcdir)/acspecial.h: $(srcdir)/configure.in
	$(GREP) '^ICE_[a-zA-Z0-9_]* *(' $(srcdir)/configure.in > $@~ && \
	$(MV) $@~ $@


# config.status might not change config.h
config.h: stamp-h
stamp-h: config.h.in config.status
	CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
	$(DATE) > $@~ && $(MV) $@~ $@


# We use configure to create `version.h'.
# To make sure these are not touched upon every invocation,
# we create temporary vr.* files instead and touch the version.* files
# only if the vr.* files changed.
version.h: vr.h
	@$(CMP) vr.h $@ 2> /dev/null || ( $(CAT) vr.h > $@~ && $(MV) $@~ $@ )
vr.h: vr.h.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

## The manual page
ddd.man: $(srcdir)/ddd.man.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

# Same, but in 7-bit format
ddd.1:   ddd.man $(srcdir)/unumlaut.sed
	-$(SED) -f $(srcdir)/unumlaut.sed ddd.man > $@~ && $(MV) $@~ $@

# ddd.man.txt does NOT depend on ddd.man since we don't want it to get
# re-created after each configuration.
ddd.man.txt: $(srcdir)/ddd.man.in configure.in $(srcdir)/umlaut8.sed
	$(MAKE) ddd.man
	-$(SED) -f $(srcdir)/umlaut7.sed ddd.man | \
	$(NROFF) -man | $(SED) -f $(srcdir)/umlaut8.sed > $@~ && $(MV) $@~ $@

# ddd.man.txt may reside in $(srcdir) or `.' , hence the `$?'
ddd.man.txt.gz: ddd.man.txt
	$(COMPRESS) $? > $@~ && $(MV) $@~ $@

ddd.man.txt.gz.C: ddd.man.txt.gz
	$(MAKE) stringify$(EXEEXT)
	-./stringify < $? > $@~ && $(MV) $@~ $@


# ddd.man.huff.C does NOT depend on huffencode since we don't want it
# to get re-created after each configuration.
ddd.man.huff.C: ddd.man.txt
	$(MAKE) huffencode$(EXEEXT)
	-./huffencode < ddd.man.txt > $@~ && $(MV) $@~ $@

# The `no pictures' variant of ddd.man.
ddd.man-nopics: ddd.man
	$(GREP) -v '^\.PSPIC' ddd.man > ddd.man-nopics

# COPYING.huff.C does NOT depend on huffencode since we don't want it
# to get re-created after each configuration.
COPYING.huff.C: $(srcdir)/../COPYING
	$(MAKE) huffencode$(EXEEXT)
	-$(SED) 's///' < $(srcdir)/../COPYING | ./huffencode > $@~ && \
	$(MV) $@~ $@

COPYING.gz: $(srcdir)/../COPYING
	$(COMPRESS) $(srcdir)/../COPYING > $@

COPYING.gz.C: COPYING.gz
	$(MAKE) stringify$(EXEEXT)
	-./stringify < COPYING.gz > $@~ && $(MV) $@~ $@

# NEWS.huff.C does NOT depend on huffencode since we don't want it
# to get re-created after each configuration.
NEWS.huff.C: $(srcdir)/../NEWS
	$(MAKE) huffencode$(EXEEXT)
	-$(SED) 's///' < $(srcdir)/../NEWS | ./huffencode > $@~ && \
	$(MV) $@~ $@

NEWS.gz: $(srcdir)/../NEWS
	$(COMPRESS) $(srcdir)/../NEWS > $@~ && $(MV) $@~ $@

NEWS.gz.C: NEWS.gz
	$(MAKE) stringify$(EXEEXT)
	-./stringify < NEWS.gz > $@~ && $(MV) $@~ $@

# `make depend' fails to find this dependency :-(
show.o: COPYING.gz.C NEWS.gz.C ddd.man.txt.gz.C


## The xlibdir script
xlibdir.C: xlibdir.txt

# `make depend' fails to find this dependency :-(
xconfig.o: xlibdir.C


## The host type
host.h: $(srcdir)/host.h.in config.status
	$(CAT) $(srcdir)/host.h.in | \
	$(SED) "s%@HOST_CANONICAL@%$(host_canonical)%" | \
	$(SED) "s%@TARGET_CANONICAL@%$(target_canonical)%" > $@~ && \
	$(MV) $@~ $@

## Tags.
.PHONY:	tags
tags:	$(srcdir)/TAGS

$(srcdir)/TAGS:	FORCE
	@cd $(srcdir); \
	if [ `ls -c TAGS *.[Ch] | head -1` != TAGS ]; then \
	echo 'Creating $@...'; \
	$(ETAGS) *.[Ch] > $@; \
	echo 'Creating $@...done.'; \
	else \
	echo "'"'$@` is up to date.'; \
	fi

## Statistics.
# Count lines of C++/lex/yacc source code.
# Lines containing only comments or documentation and empty lines are ignored.

.PHONY: loc stats
loc stats:
	cd $(srcdir); \
	for list in '$(LIB_OBJECTS)' '$(DDD_OBJECTS)' '$(OBJECTS)'; do \
	pattern=`$(ECHO) $$list | $(SED) 's/\([a-zA-Z0-9_]*\)\.o/\1\\.*/g'`; \
	$(ECHO) "Lines of code for $$pattern"; \
	$(CAT) `$(LS) $$pattern | grep '\.[ChLY]'` | \
		$(GREP) -v '^[ 	]*//' | \
		$(GREP) -v '^"' | \
		$(GREP) -v '^[ 	]*$$' | wc -l; \
	done


## EPS code stuff.

$(srcdir)/header.str: $(srcdir)/header.ps
	$(SED) 's/^.*$$/"&\\n"/' $(srcdir)/header.ps > $@~ && $(MV) $@~ $@

$(srcdir)/trailer.str: $(srcdir)/trailer.ps
	$(SED) 's/^.*$$/"&\\n"/' $(srcdir)/trailer.ps > $@~ && $(MV) $@~ $@

$(srcdir)/eps-code.h: \
	$(srcdir)/header.str $(srcdir)/trailer.str $(srcdir)/eps-code.x
	$(SED) -e '/prolog/r $(srcdir)/header.str' \
	       -e '/trailer/r $(srcdir)/trailer.str' $(srcdir)/eps-code.x \
	> $@~ && $(MV) $@~ $@


## Configuration info stuff
configinfo.C: USERINFO $(srcdir)/config-info
	$(SHELL) $(srcdir)/config-info $(srcdir)/USERINFO USERINFO > $@~ && \
	$(MV) $@~ $@

# configinfo.C:	Makefile config.h

configinfo.o:	configinfo.C configinfo.h

# If `~/.ddd_userinfo' exists, use this file as personal identification.
USERINFO: userinfo$(EXEEXT)
	-(cat $$HOME/.ddd_userinfo 2> /dev/null || \
	./userinfo || echo '(unknown)') > $@~ && $(MV) $@~ $@
	@$(ECHO) ""
	@$(ECHO) "Please check your name and e-mail address:"
	@$(ECHO) ""
	@$(CAT) $@
	@$(ECHO) ""
	@$(ECHO) "This information will be compiled into $(DDD)."
	@$(ECHO) "If it is not correct, please edit $@ and re-compile."
	@$(ECHO) ""


## Update the shared source tree.  For development only.

PUB_DEST=/ftp/ips/pub/misc/$(ddd)-$(VERSION)/ddd
PUB_SRC=`ls -t /usr/local/share/CVS/ddd/ddd | $(SED) 's/,v//'`
GTEST=/usr/local/gnubin/test

.PHONY: pub
pub:	$(PROG_STUFF) configure $(PUB_DEST)/USERINFO
	@for file in $(PUB_SRC) $(PROG_STUFF) configure Makedeps; do \
	    if $(GTEST) ./$$file -nt $(PUB_DEST)/$$file; then \
		echo -n Updating $(PUB_DEST)/$$file...; \
		cp -p ./$$file $(PUB_DEST)/$$file; \
		echo done.; \
	    fi; \
	done

# This is no longer needed, since we have `~/.ddd_userinfo'.
# $(PUB_DEST)/USERINFO:
# 	-$(ECHO) 'DDD Development Team <ddd@ips.cs.tu-bs.de>' > $@~ && \
# 	$(MV) $@~ $@


## Make dependency stuff.

.PHONY: depend
depend: FORCE $(PROG_STUFF)

.PRECIOUS: $(srcdir)/Makedeps
$(srcdir)/Makedeps depend:
	@$(ECHO) "Creating $(srcdir)/Makedeps..."
	@( $(ECHO) \#' DO NOT EDIT -- generated automagically by make depend';\
	$(ECHO) \#' Source: $$Id: Makefile.in,v 1.293 1998/11/29 11:26:08 zeller Exp $$'; \
	$(ECHO) ; \
	srcdir=`echo $(srcdir) | $(SED) 's%\.%\\\\.%g'`; \
	$(CXX) -M $(CPPFLAGS) $(DEFS) $(INCLUDE) $(srcdir)/*.C \
	| $(SED) "s% $$srcdir/% %g" \
	| $(SED) 's% /[^ ]*%%g' \
	| $(SED) 's% \./% %g' \
	| $(GREP) -v '^ *\\$$' \
	| $(SED) "s% \.\./% \$$(srcdir)/\.\./%g" \
	| $(SED) 's%^ *$$%& config.h%g' ) > Makedeps~
	@$(MV) Makedeps~ $(srcdir)/Makedeps
	@$(ECHO) "Creating $(srcdir)/Makedeps...done."

## If your `make' cannot handle the following line,
## just replace it by the contents of `@srcdir@/Makedeps'.
include @srcdir@/Makedeps
