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

/* add any extra load flags such as -static or -g .
   Don't remove the -L. - 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
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 -lXt -lX11
#else
MOTIF_LIB = -lXm -lXt -lSM -lICE -lX11
#endif

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

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

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

/* 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 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)
LOCAL_LIBRARIES = $(TM_LIB) $(SEND_LIB) $(DEBUG_LIB) $(TCL_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 

#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 = -DTM_LIBRARY=\".\" -DTM_VERSION=\"1.2\"

#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()
