/* 
 * Generic Imake Template
 *
 * Future changes:
 * 
 * o Reorganize the structure to employ a config.Imakefile and reduce
 *   the complexity of Imake.tmpl.  Also, the use of site.def should be
 *   re-examined.
 *
 * o Support global project configurations.  This can be done by always
 *   including a Project.tmpl and altering the include path such that
 *   this is found prior to the minimal one in the global templates.
 */

/*
 *  added for the sipb-athena source tree.  -svalente
 */
#ifndef TOPDIR
#define TOPDIR /afs/sipb/project/sipb-athena/src
#endif

#define ATHENA_RULES

/* 
 * WARNING - HACK HACK HACK
 * To allow xmkmf to work with our setup: set CONFDIR to be TOPDIR/config.
 *
 * NEWTOP is still set to . since this is being run from the top of the
 * developer's project tree.  However, TOPDIR is simply the top of the
 * Athena source tree, which contains the Imake configuration files.
 */
#ifdef TOPDIR
#define UseInstalled
#define ConfDir TOPDIR/config
#endif

#include <site.def>

#ifndef ConfDir
#define ConfDir ${TOP}/config
#endif
#ifndef NEWTOP
#define NEWTOP .
#endif
#ifndef NEWCWD
#define NEWCWD .
#endif
#ifndef ALibDir
#define ALibDir $(ATHBASEDIR)/lib
#endif
#ifndef ABinDir
#define ABinDir $(ATHBASEDIR)/bin
#endif
#ifndef AIncDir
#define AIncDir $(ATHBASEDIR)/include
#endif
#ifndef AManDir
#define AManDir $(ATHBASEDIR)/man
#endif
#ifndef AEtcDir
#define AEtcDir $(ATHBASEDIR)/etc
#endif
#ifndef AConfDir
#define AConfDir /etc/athena
#endif
#ifndef ARBinDir
#define ARBinDir /bin/athena
#endif
#ifndef AREtcDir
#define AREtcDir /etc/athena
#endif
#ifndef AthXAppDir
#define AthXAppDir /usr/athena/lib/X11/app-defaults
#endif
#ifndef AthXBitDir
#define AthXBitDir /usr/athena/lib/X11/bitmaps
#endif
#ifndef AthXIncDir
#define AthXIncDir /usr/athena/include
#endif
#ifndef AthXLibDir
#define AthXLibDir /usr/athena/lib
#endif
#ifndef LintCFlag
#define LintCFlag -o
#endif
#ifndef CcCmd
#define CcCmd cc
#endif
#ifndef LdCmd
#define LdCmd cc
#endif
#ifndef AnsiCcCmd
#define AnsiCcCmd cc
#endif
#ifndef AnsiLdCmd
#define AnsiLdCmd cc
#endif
#ifndef AsCmd
#define AsCmd as
#endif
#ifndef RanLibCmd
#define RanLibCmd ranlib
#endif
#ifndef InstPgmFlags
#define InstPgmFlags -s
#endif
#ifndef InstScriptFlags
#define InstScriptFlags -m 755
#endif
#ifndef RmCmd
#define RmCmd rm -f
#endif
#ifndef CcFlags
#define CcFlags
#endif
#ifndef CDebugFlags
#define CDebugFlags -O
#endif
#ifndef ProfCcFlags
#define ProfCcFlags -p
#endif
#ifndef LdFlags
#define LdFlags
#endif
#ifndef LdPath
#define LdPath -L$(ATHLIBDIR) -L/usr/X11/lib
#endif
#ifndef LdLibs
#define LdLibs
#endif
#ifndef LintCmd
#define LintCmd lint
#endif
#ifndef LintFlags
#define LintFlags $(DEFINES) -I/usr/athena/include
#endif

#ifdef UseInstalled
# ifndef InstallCmd
# define InstallCmd install -c
# endif
# ifndef EtCmd
# define EtCmd compile_et
# endif
# ifndef SsCmd
# define SsCmd mk_cmds
# endif
#else /* !UseInstalled */
# ifndef InstallCmd
# define InstallCmd $(UTILDIR)install -c
# endif
# ifndef EtCmd
# define EtCmd $(TOP)/athena/athena.lib/et/compile_et
# endif
# ifndef SsCmd
# define SsCmd $(TOP)/athena/athena.lib/ss/mk_cmds
# endif
#endif /* UseInstalled */


SHELL=/bin/sh
MAKESHELL=/bin/sh

TOP = NEWTOP
CWD = NEWCWD
CONFIGSRC = ConfDir
DESTDIR=

IRULESRC = $(CONFIGSRC)		

#ifdef ProjectTop
PTOP = $(TOP)/ProjectTop
#endif

#ifdef UseInstalled
IMAKE= imake
IFLAGS= -I$(IRULESRC) $(OTHER_IFLAGS) -DTOPDIR=TOPDIR
XIFLAGS= -I$(ATHXLIBDIR)/X11/config -DUseInstalled
#else
UTILDIR=$(TOP)/util/bin/
IMAKE= $(UTILDIR)imake
IFLAGS= -I$(IRULESRC) $(OTHER_IFLAGS)
XTOP=$(TOP)/third/common/X11R4
XIFLAGS= -I$(XTOP)/config -DTOPDIR=$(XTOP) -DCURDIR=$(CWD)
#endif

ICONFIGFILE = ${IRULESRC}/Imake.tmpl ${IRULESRC}/Imake.rules \
	${IRULESRC}/site.def Imakefile
MKDIRHIER= sh $(IRULESRC)/mkdirhier.sh

ATHVERS = ${IRULESRC}/update.conf

ATHBASEDIR=/usr/athena

ATHLIBDIR=ALibDir
ATHBINDIR=ABinDir
ATHINCDIR=AIncDir
ATHETCDIR=AEtcDir
ATHCONFDIR=AConfDir
ATHMANDIR=AManDir
ATHRBINDIR=ARBinDir
ATHRETCDIR=AREtcDir

/* This should be removed, but too much depends on it */
ATHNEWDIR=$(ATHBINDIR)

ATHXAPPDIR=AthXAppDir
ATHXBITDIR=AthXBitDir
ATHXINCDIR=AthXIncDir
ATHXLIBDIR=AthXLibDir

#ifdef AfsDir
AFSDIR=AfsDir
#endif

LINTCFLAG=LintCFlag
LINTFLAGS=$(DEFINES) -I/usr/athena/include

INSTALL=InstallCmd
RANLIB=RanLibCmd
CC=CcCmd
LD=LdCmd
AS=AsCmd
RM=RmCmd

ETCMD=EtCmd
SSCMD=SsCmd

CDEBUG=CDebugFlags

CFLAGS=$(CDEBUG) CcFlags $(DEFINES) -I/usr/athena/include -I/usr/X11/include
LDFLAGS=LdFlags $(LDDEFS)
LDPATH=LdPath
LDLIBS=LdLibs

#include "Imake.rules"

all::
install:: install_dirs
install_dirs::
install:: 
install.man::

clean::
depend::

FRC::

/**/###########################################################################
/**/# start of Imakefile
/**/###########################################################################

#ifdef Project
#define InProject
#undef Project
#endif

#include INCLUDE_IMAKEFILE

#if defined(InProject) && !defined(Project)
#define Project
#endif

/*
 * PROJECT DECLARATION
 *
 * At the top of the project directory, simply include the following:
 *
 * 	#define Project
 *
 * This will declare that directory to be the top of the project tree.
 * The top of the project tree will be in the include path, so if there
 * are additional rules files that are being used by the Imakefiles, you
 * can simply do something like:
 *
 * 	#include "config/extra.rules"
 *
 * from any Imakefile in the tree.
 *
 * The Make variable $(PTOP) is also set to the top of the project tree,
 * so you can declare dependencies such as $(PTOP)/lib/libfoo.a.
 */

#ifdef Project
#ifndef ProjectTop
#define ProjectTop NEWCWD
#endif
PTOP = $(TOP)/ProjectTop
IPROJ = -DProject -DProjectTop=ProjectTop -I$(PTOP)
#endif


makefile_target()

clean::
	rm -f *~ *.o *.a core a.out

#ifdef ISUBDIRS
do_subdirs_imakefile(ISUBDIRS)
do_subdirs(ISUBDIRS)
#endif

#ifdef XSUBDIRS
do_subdirs_xmakefile(XSUBDIRS)
do_subdirs(XSUBDIRS)
#endif

#ifdef SUBDIRS
do_subdirs(SUBDIRS)
#endif SUBDIRS

Makefiles::

/**/###########################################################################
/**/# dependencies generated by makedepend
