# Imakefile for AthenaTools library on Project Athena

# NOTE:  When building on the DECstation, two modifications are
# necessary.  A modified ultrix.cf file (with "#define HasGcc YES"
# uncommented) should exist in the toplevel directory with links
# pointing to it in any subdirectories.  Second, gmake is necessary
# instead of make, because of a bug in Ultrix make.  The easiest
# way to do this is to make a link from make->gmake somewhere in
# the path *before* /bin.
#
# These Imakefiles depend upon motif1.1 being the default motif locker
# and motif1.0 mounted as /mit/motif1.0

#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'


#if defined(MipsArchitecture)
CDEBUGFLAGS = -g
PROTO = -D_NO_PROTO
#else
#if defined (AIXArchitecture)
CDEBUGFLAGS = -g
PROTO = -D_NO_PROTO
CC = c89
#else 
#endif
#endif

MACHINE = `/bin/athena/machtype` 
ATINCDIR = /mit/atdev/include
OLDINCDIR = /mit/atdev/include.old
ATMANDIR = /mit/atdev/man

M11DIR  = $(MACHINE).M11
SUBDIRS = $(M11DIR)

HEADERS = *.h
SRCS    = *.c
MANS	= \
	AtAxis.3X\
	AtBarchart.3X\
	AtCli.3X\
	AtContourPlot.3X\
	AtDialog.3X\
	AtFontFamily.3X\
	AtHelp.3X\
	AtLabel.3X\
	AtLayout.3X\
	AtMessageLine.3X\
	AtParameter.3X\
	AtPlot.3X\
	AtPlotter.3X\
	AtText.3X\
	AtTextPlot.3X\
	AtXYErrorPlot.3X\
	AtXYPlot.3X

# Rules to create links from the build directories to the source
# directory for all headers and sources.

links::
	(cd $(M11DIR); $(RM) *.[ch])

LinkFileList(links, $(HEADERS) $(SRCS), $(M11DIR), ..)

# Header install rules

# Make the directory hierarchies if they don't exist
MakeDirectories(install.header, $(ATINCDIR)/At)
MakeDirectories(install.header, $(OLDINCDIR)/At)

# Remove the really old header files, copy the old headers, then
# install the new header files.
install.header::
	-(cd $(OLDINCDIR)/At; $(RM) *.h)
	-(cd $(ATINCDIR)/At; $(MV) *.h $(OLDINCDIR)/At)

InstallMultipleDest(install.header, $(HEADERS), $(ATINCDIR)/At)


# Man page build rule

.SUFFIXES:  .man .3X
.man.3X:
	tbl $*.man > $*.3X

# Man page install rules
MakeDirectories(install.man, $(ATMANDIR)/man3)
install.man::
	(cd $(ATMANDIR)/man3; $(RM) *.3X)
InstallMultipleMan($(MANS), $(ATMANDIR)/man3)
install.man::
	/usr/etc/catman -M $(ATMANDIR) 3

# Rules for subdirectories

MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))



