/*---------------------------------------------------------------------------*/
/* Based on the Xmt source level Imakefile for the Xmt library, written by   */
/* David Flanagan.  Used with permission                                     */
/*---------------------------------------------------------------------------*/
/* 
 * Set Xdt-specific variables.
 * This must come first
 */
#include "../Xdt.tmpl"

/* 
 * rules for normal, shared, debugged and profiled libraries.
 */
#if ProjectX >= 5
#include <Library.tmpl>
#else
         CC = LibraryCcCmd
  CCOPTIONS = LibraryCCOptions
STD_DEFINES = LibraryDefines
CDEBUGFLAGS = LibraryCDebugFlags
#endif

SRCS =  \
	Child.c		\
	Misc.c		\
	QkHelp.c	\
	ResMgmt.c

OBJS =  \
	Child.o		\
	Misc.o		\
	QkHelp.o	\
	ResMgmt.o

HEADERS = \
	Child.h		\
	Misc.h		\
	QkHelp.h	\
	ResMgmt.h	\
	Xdt.h


/*
 * R4 and R5 have very different ways of building libraries.
 * We include both methods here, so this Imakefile should work
 * on systems with both X11R4 and X11R5 imake config files.
 */
#if ProjectX >= 5
/*
 * general rules for building normal, shared, debugged, and profiled 
 * object files for the library.  Defined in Library.tmpl
 */
LibraryObjectRule()

/* 
 * rules for building the library 
 */
#if DoSharedLib
#if DoNormalLib
SharedLibraryTarget(Xdt,XdtSharedLibraryRevision,$(OBJS),shared,..)
#else
SharedLibraryTarget(Xdt,XdtSharedLibraryRevision,$(OBJS),.,.)
#endif
SharedLibraryDataTarget(Xdt,XdtSharedLibraryRevision,$(UNSHAREDOBJS))
#endif
#if DoNormalLib
NormalLibraryTarget(Xdt,$(OBJS))
#endif
#if DoProfileLib
ProfiledLibraryTarget(Xdt,$(OBJS))
#endif
#if DoDebugLib
DebuggedLibraryTarget(Xdt,$(OBJS))
#endif

/* 
 * rules for installing the library
 */
#if DoSharedLib
InstallSharedLibrary(Xdt,XdtSharedLibraryRevision,$(XDTLIBDIR))
InstallSharedLibraryData(Xdt,XdtSharedLibraryRevision,$(XDTLIBDIR))
#endif
#if DoNormalLib
InstallLibrary(Xdt,$(XDTLIBDIR))
#endif
#if DoProfileLib
InstallLibrary(Xdt_p,$(XDTLIBDIR))
#endif
#if DoDebugLib
InstallLibrary(Xdt_d,$(XDTLIBDIR))
#endif

#else  /* if X11R4 config files */
#if DoSharedLib 
# if DoDebugLib
SharedAndDebuggedLibraryObjectRule()
# else
SharedLibraryObjectRule()
# endif
#else
# if DoDebugLib && DoProfileLib
DebuggedAndProfiledLibraryObjectRule()
# else
#  if DoDebugLib
DebuggedLibraryObjectRule()
#  else
#   if DoProfileLib
ProfiledLibraryObjectRule()
#   else
NormalLibraryObjectRule()
#   endif
#  endif
# endif
#endif

/*
 * always generate unshared library too 
 */
#if DoSharedLib
NormalSharedLibraryTarget(Xdt,XdtSharedLibraryRevision,$(OBJS))
NormalSharedLibraryDataTarget(Xdt,XdtSharedLibraryRevision,$(UNSHAREDOBJS))
InstallSharedLibrary(Xdt,XdtSharedLibraryRevision,$(XDTLIBDIR))
InstallSharedLibraryData(Xdt,XdtSharedLibraryRevision,$(XDTLIBDIR))
#endif
NormalLibraryTarget(Xdt,$(OBJS))
InstallLibrary(Xdt,$(XDTLIBDIR))

LintLibraryTarget(Xdt,$(SRCS))
InstallLintLibrary(Xdt,$(LINTLIBDIR))

#if DoProfileLib
ProfiledLibraryTarget(Xdt,$(OBJS))
InstallLibrary(Xdt_p,$(XDTLIBDIR))
#endif

#if DoDebugLib
DebuggedLibraryTarget(Xdt,$(OBJS))
#endif
#endif  /* R5 or R4 */

/* rule to install the header files */
InstallMultiple($(HEADERS),$(XDTINCDIR)/Xdt)

/* rule for make depend: depends all in $SRCS using $ALLDEFINES */
DependTarget()

