
/* add any extra load flags such as -static or -g .
   Don't remove the -L. as this is used to pick up libtclMotif.a
   in this directory instead of (possibly old) library in USRLIBDIR */
LOCAL_LDFLAGS =  -L. #-static -g

/* Include files for tcl, Motif and the Send package.
   Change the first two as needed (SEND is included in this package)
 */
TCL_INCLUDE   = /usr/local/include
MOTIF_INCLUDE = /usr/local/include -I/usr/include/Xm  -DNO_MESSAGE_CATALOG
SEND_INCLUDE  = ../send

/* The corresponding libraries.
   Change the first two as needed by setting the -L option 
 */
TCL_LIB   = -ltcl -lm
#if ProjectX < 6
MOTIF_LIB = -lXm -lXext -lXt -lX11
#else
MOTIF_LIB = -lXm -lXext -lXt -lSM -lICE -lX11
#endif

SEND_LIB  = -L../send -ltclXtSend
TM_LIB    = -L./ -ltclMotif

/* if you are adding extra widgets, put the link library for them in here e.g.
   EXTRA_WIDGETS_INCLUDE =  -I../../Mosaic-2.4/libhtmlw
   EXTRA_WIDGETS_LIB =  -L../../Mosaic-2.4/libhtmlw -lhtmlw -lXmu
*/
EXTRA_WIDGETS_INCLUDE =
EXTRA_WIDGETS_LIB =


/* what type of libraries do you want? */
#define DoNormalLib YES
#define DoSharedLib NO

/* do you want to support UIL files? */
#define UseUIL YES

/* simple -g debugging flag - set to YES or NO */
#define Debug YES

/* Connor Cahil's dbmalloc debugging malloc library.
   Worked fine on a Sun (renamed malloc.h to dbmalloc.h)
   - set to YES or NO
 */
#define ConnorDebug NO

/*  Mark Moraes' debugging malloc library.
    Worked fine under Linux (renamed malloc.h to dbmalloc.h)
   - set to YES or NO
 */
#define MoraesDebug NO

/* Checker lib for Linux
   Still doesn't work for me
 */
#define CheckerDebug NO

/* define this if you want the obsoleted main.c rather than
   the super-duper tcl extension method now used
 */
/* #define OLD_MAIN */


/***************************************************************************
 * Only look below here if you want to change the debugging options, 
 * or where the debugging mallocs are located.
 ***************************************************************************/

#include <Library.tmpl>

#if UseUIL
UIL = -DUSE_UIL
MRM_LIB = -lMrm
#else
UIL =
MRM_LIB =
#endif

#if Debug
EXTRA_DEFINES = -g
#endif

#if ConnorDebug
CDEBUGFLAGS = -g -DDEBUG_MALLOC
/* set the -I, -L options to where the include and lib files are */
EXTRA_DEFINES = -I/usr/local/include
DEBUG_LIB = -L/usr/local/include -ldbmalloc
#endif

#if MoraesDebug
CDEBUGFLAGS = -g -DDEBUG_MALLOC
/* set the -I, -L options to where the include and lib files are */
EXTRA_DEFINES = -I../../malloc
DEBUG_LIB = -L../../malloc -lmalloc_d
#endif

#if CheckerDebug
CDEBUGFLAGS = -g -checker
DEBUG_LIB = /usr/lib/libchecker.o
#endif

/***************************************************************************
 * No changes should be required below here
 ***************************************************************************/

INCLUDES = -I$(TCL_INCLUDE) -I$(MOTIF_INCLUDE) -I$(SEND_INCLUDE) $(EXTRA_WIDGETS_INCLUDE)
LOCAL_LIBRARIES = $(TM_LIB) $(SEND_LIB) $(DEBUG_LIB) $(TCL_LIB) $(EXTRA_WIDGETS_LIB) $(MRM_LIB) $(MOTIF_LIB)

OBJS1 = tmBasic.o \
	tmCreateWidget.o \
	tmCommands.o \
	tmDrag.o \
	tmTclCommands.o \
	tmExpand.o \
	tmWidget.o \
	tmUtils.o \
	tmConverters.o \
	tmResources.o \
	tmResult.o  \
	tmMakeEvent.o \
        tmExtern.o \
	tmXEvent.o \
	tmUTM.o

#ifdef OLD_MAIN
OBJS = tmMain.o 
#else
OBJS = tmAppInit.o
#endif

SRCS =	tmMain.c \
	tmAppInit.c \
	tmCreateWidget.c \
	tmCommands.c \
	tmDrag.c \
	tmTclCommands.c \
	tmExpand.c \
	tmWidget.c \
	tmUtils.c \
	tmConverters.c \
	tmResources.c \
	tmResult.c 

DEPLIBS = $(OBJS1)

DEFINES = $(UIL) -DTM_LIBRARY=\"LibDir\" -DTM_VERSION=\"1.3\"

#ifndef LibraryObjectRule
#define LibraryObjectRule() /* not found in R4! */
#endif

LibraryObjectRule()

#if DoNormalLib
#if ProjectX < 6 || !DoSharedLib
NormalLibraryTarget(tclMotif,$(OBJS1))
#else
UnsharedLibraryTarget(tclMotif,$(OBJS1),unshared,..)
#endif
InstallLibrary(tclMotif,$(USRLIBDIR))
#endif

#if DoSharedLib
#if DoNormalLib && (ProjectX < 6)
SharedLibraryTarget(tclMotif,1.2,$(OBJS1),shared,..)
#else
SharedLibraryTarget(tclMotif,1.2,$(OBJS1),.,.)
#endif
InstallSharedLibrary(tclMotif,1.2, $(USRLIBDIR))
#endif


ComplexProgramTarget(moat)

DependTarget()


/* put the startup file in place */
InstallNonExec(init_tclMotif.tcl, LibDir)
