/* set your compiler here if you want to override the default setup */
/* CC = gcc */

/* add any extra load flags such as -static or -g */
LOCAL_LDFLAGS =

/* 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
SEND_INCLUDE  = ../send

/* The corresponding libraries.
   Change the first two as needed by setting the -L option 
 */
TCL_LIB   = -ltcl -lm
MOTIF_LIB = -lXm -lXt -lX11
SEND_LIB  = -L../send -ltclXtSend
/* TM_LIB    = -L./ -ltclMotif */
/* TM_LIB    = libtclMotif.a */

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

/* 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

/* 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 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

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

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

#if DoSharedLib
LOCAL_LDFLAGS = -L$(USRLIBDIR) -ltclMotif
#else
LOCAL_LDFLAGS = libtclMotif.a
#endif

OBJS1 = tmBasic.o \
	tmCreateWidget.o \
	tmCommands.o \
	tmDrag.o \
	tmTclCommands.o \
	tmExpand.o \
	tmWidget.o \
	tmUtils.o \
	tmConverters.o \
	tmResources.o \
	tmResult.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

DEFINES = -DTM_LIBRARY=\".\" -DTM_VERSION=\"1.1\"

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

LibraryObjectRule()

#if DoNormalLib
NormalLibraryTarget(tclMotif,$(OBJS1))
InstallLibrary(tclMotif,$(USRLIBDIR))
#endif

#if DoSharedLib
#if DoNormalLib
SharedLibraryTarget(tclMotif,1.0,$(OBJS1),shared,..)
#else
SharedLibraryTarget(tclMotif,1.0,$(OBJS),.,.)
#endif
InstallSharedLibrary(tclMotif,1.0, $(USRLIBDIR))
#endif

/* ComplexProgramTarget(moat) */
AllTarget(moat)
NormalProgramTarget(moat, $(OBJS) $(OBJS1), $(DEPLIBS), $(LOCAL_LIBRARIES), $(LDLIBS))
